Fix problem where a Table object with alternate autocommit setting would not have cache expired by peer activity.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@14371 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2012-11-20 14:45:41 +00:00
parent 4b8ed14152
commit 42cb10b6aa

View File

@ -299,7 +299,11 @@ sub handle_dbc_request {
$opentables{$tablename}->{$autocommit} = xCAT::Table->new(@args);
}
if ($opentables{$tablename}->{$autocommit}) {
return 1;
if ($opentables{$tablename}->{$autocommit^1}) {
$opentables{$tablename}->{$autocommit}->{cachepeer}=$opentables{$tablename}->{$autocommit^1};
$opentables{$tablename}->{$autocommit^1}->{cachepeer}=$opentables{$tablename}->{$autocommit};
}
return 1;
} else {
return 0;
}
@ -312,6 +316,10 @@ sub handle_dbc_request {
unless ($opentables{$tablename}->{$autocommit}) {
return undef;
}
if ($opentables{$tablename}->{$autocommit^1}) {
$opentables{$tablename}->{$autocommit}->{cachepeer}=$opentables{$tablename}->{$autocommit^1};
$opentables{$tablename}->{$autocommit^1}->{cachepeer}=$opentables{$tablename}->{$autocommit};
}
}
}
if ($functionname eq 'getAllAttribs') {
@ -2096,6 +2104,7 @@ sub getNodesAttribs {
sub _refresh_cache { #if cache exists, force a rebuild, leaving reference counts alone
my $self = shift; #dbworker check not currently required
if ($self->{cachepeer}->{_cachestamp}) { $self->{cachepeer}->{_cachestamp}=0; }
if ($self->{_use_cache}) { #only do things if cache is set up
$self->_build_cache(1); #for now, rebuild the whole thing.
#in the future, a faster cache update may be possible