From c122edd400223f2de32241e7358a3f3454c6d63b Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 11 May 2012 18:43:15 +0000 Subject: [PATCH] More aggressively retain cache git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12643 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/NodeRange.pm | 1 + perl-xCAT/xCAT/Table.pm | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 4895381fd..c82bea962 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -184,6 +184,7 @@ sub expandatom { #TODO: implement table selection as an atom (nodetype.os==rhels if ($recurselevel > 4096) { die "NodeRange seems to be hung on evaluating $atom, recursion limit hit"; } unless (scalar(@allnodeset) and (($allnodesetstamp+5) > time())) { #Build a cache of all nodes, some corner cases will perform worse, but by and large it will do better. We could do tests to see where the breaking points are, and predict how many atoms we have to evaluate to mitigate, for now, implement the strategy that keeps performance from going completely off the rails $allnodesetstamp=time(); + $nodelist->_set_use_cache(1); @allnodeset = $nodelist->getAllAttribs('node','groups'); %allnodehash = map { $_->{node} => 1 } @allnodeset; } diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index d886f673b..ded46ea88 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -2122,7 +2122,8 @@ sub _clear_cache { #PRIVATE FUNCTION TO EXPIRE CACHED DATA EXPLICITLY $self->{_cache_ref} -= 1; return; } elsif ($self->{_cache_ref} == 1) { #If it is 1, decrement to zero and carry on - $self->{_cache_ref} = 0; + return; + #$self->{_cache_ref} = 0; } #it shouldn't have been zero, but whether it was 0 or 1, ensure that the cache is gone $self->{_use_cache}=0; # Signal slow operation to any in-flight operations that may fail with empty cache