From 42cb10b6aaea7af40dd340fff798dcaa1236d11c Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 20 Nov 2012 14:45:41 +0000 Subject: [PATCH] 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 --- perl-xCAT/xCAT/Table.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 94fee2c21..db68819e5 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -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