From d02b8d9de864c45a484708b551c6f7216fa239d8 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Tue, 15 Sep 2009 15:33:33 +0000 Subject: [PATCH] -Fix for circumstances where a single Table object lifetime spans the period before DB worker is initialized and after git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4136 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Table.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index a59ba969b..71dc6e14e 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -217,7 +217,18 @@ sub handle_dbc_request { } else { return 0; } - } elsif ($functionname eq 'getAllAttribs') { + } else { + unless (defined $opentables{$tablename}->{$autocommit}) { + #We are servicing a Table object that used to be + #non data-worker. Create a new DB worker side Table like the one + #that requests this + $opentables{$tablename}->{$autocommit} = xCAT::Table->new($tablename,-create=>0,-autocommit=>$autocommit); + unless ($opentables{$tablename}->{$autocommit}) { + return undef; + } + } + } + if ($functionname eq 'getAllAttribs') { return $opentables{$tablename}->{$autocommit}->getAllAttribs(@args); } elsif ($functionname eq 'getAttribs') { return $opentables{$tablename}->{$autocommit}->getAttribs(@args);