diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 5517a0aea..4545b2971 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -65,7 +65,7 @@ use DBI; $DBI::dbi_debug = 9; # increase the debug output use strict; -use Scalar::Util qw/weaken/; +use Scalar::Util qw/blessed weaken/; use xCAT::Utils; require xCAT::Schema; require xCAT::NodeRange; @@ -1625,6 +1625,12 @@ sub rollback return dbc_call($self, 'rollback', @_); } $self->{dbh}->rollback; + + #the rollback undoes the changes of every table on this handle, so their caches are invalid + #new() registers a table before it opens it, so a table that failed to open stays unblessed + foreach my $table (@{ $dbobjsforhandle->{ $self->{dbh} } || [ \$self ] }) { + $$table->_refresh_cache() if blessed($$table); + } if ($self->{intransaction} and not $self->{autocommit} and $self->{realautocommit}) { #on rollback, if sharing a DB handle for autocommit and non-autocommit, put the handle back to autocommit