-Fix sf bug 2845378, stale cache data being returned in noderange expansions
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4057 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
5cff276e78
commit
95c0a1000d
@ -397,6 +397,7 @@ sub extnoderange { #An extended noderange function. Needed as the more straight
|
||||
$return->{intersectinggroups}=[sort keys %grouphash];
|
||||
}
|
||||
$retaincache=0;
|
||||
$nodelist->_clear_cache();
|
||||
undef ($nodelist);
|
||||
@allnodeset=();
|
||||
return $return;
|
||||
@ -523,6 +524,7 @@ sub noderange {
|
||||
$recurselevel--;
|
||||
} else {
|
||||
unless ($retaincache) {
|
||||
$nodelist->_clear_cache();
|
||||
undef $nodelist;
|
||||
@allnodeset=();
|
||||
}
|
||||
|
@ -216,6 +216,8 @@ sub handle_dbc_request {
|
||||
return $opentables{$tablename}->{$autocommit}->_set_use_cache(@args);
|
||||
} elsif ($functionname eq '_build_cache') {
|
||||
return $opentables{$tablename}->{$autocommit}->_build_cache(@args);
|
||||
} elsif ($functionname eq '_clear_cache') {
|
||||
return $opentables{$tablename}->{$autocommit}->_clear_cache(@args);
|
||||
} else {
|
||||
die "undefined function $functionname";
|
||||
}
|
||||
@ -1367,16 +1369,32 @@ sub getNodesAttribs {
|
||||
my @nodeentries=$self->getNodeAttribs($_,\@attribs);
|
||||
$rethash->{$_} = \@nodeentries; #$self->getNodeAttribs($_,\@attribs);
|
||||
}
|
||||
$self->_clear_cache;
|
||||
$self->{_use_cache} = 0;
|
||||
$self->{nodelist}->_clear_cache;
|
||||
$self->{nodelist}->{_use_cache} = 0;
|
||||
return $rethash;
|
||||
}
|
||||
|
||||
sub _clear_cache { #PRIVATE FUNCTION TO EXPIRE CACHED DATA EXPLICITLY
|
||||
#This is no longer sufficient to do at destructor time, as Table objects actually live an indeterminite amount of time now
|
||||
my $self = shift;
|
||||
if ($dbworkerpid) {
|
||||
return dbc_call($self,'_clear_cache',$_);
|
||||
}
|
||||
$self->{_use_cache}=0; # Signal slow operation to any in-flight operations that may fail with empty cache
|
||||
undef $self->{_tablecache};
|
||||
undef $self->{_nodecache};
|
||||
}
|
||||
|
||||
sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY
|
||||
my $self = shift;
|
||||
if ($dbworkerpid) {
|
||||
return dbc_call($self,'_build_cache',@_);
|
||||
}
|
||||
my $oldusecache = $self->{_use_cache}; #save previous 'use_cache' setting
|
||||
$self->{_use_cache} = 0; #This function must disable cache
|
||||
#to function
|
||||
my $attriblist = shift;
|
||||
unless (grep /^node$/,@$attriblist) {
|
||||
push @$attriblist,'node';
|
||||
@ -1390,6 +1408,7 @@ sub _build_cache { #PRIVATE FUNCTION, PLEASE DON'T CALL DIRECTLY
|
||||
}
|
||||
}
|
||||
|
||||
$self->{_use_cache} = $oldusecache; #Restore setting to previous value
|
||||
$self->{_cachestamp} = time;
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user