From 426c34f342d718d43f09d15f83d5ebb5f793da41 Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 4 Dec 2012 05:52:20 +0000 Subject: [PATCH] fix for bug 3208: exclude eventlog and auditlog with lsdef -a, performance improvements for lsdef -t eventlog and lsdef -t auditlog git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14532 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/DBobjUtils.pm | 14 +++++++------- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index bceddda1b..656cceabe 100644 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -396,13 +396,13 @@ sub getobjdefs xCAT::MsgUtils->message("E", $rsp, $::callback); } } - } elsif ($objtype eq 'auditlog') { - # Special case for auditlog - # All the auditlog attributes are in auditlog table, + } elsif (($objtype eq 'auditlog') || ($objtype eq 'eventlog')) { + # Special case for auditlog/eventlog + # All the auditlog/eventlog attributes are in auditlog/eventlog table, # Do not need to read the table multiple times for each attribute. - # The auditlog is likely be very big over time, + # The auditlog/eventlog is likely be very big over time, # performance is a big concern with the general logic - my @TableRowArray = xCAT::DBobjUtils->getDBtable('auditlog'); + my @TableRowArray = xCAT::DBobjUtils->getDBtable($objtype); foreach my $objname (sort @{$type_obj{$objtype}}) { if (@TableRowArray) { @@ -418,7 +418,7 @@ sub getobjdefs if (defined($entry->{$k}) ) { $foundinfo++; if ($verbose == 1) { - $objhash{$objname}{$k} = "$entry->{$k}\t(Table:auditlog - Key:$k)"; + $objhash{$objname}{$k} = "$entry->{$k}\t(Table:$objtype - Key:$k)"; } else { $objhash{$objname}{$k} = $entry->{$k}; } @@ -426,7 +426,7 @@ sub getobjdefs } if ($foundinfo) { - $objhash{$objname}{'objtype'} = 'auditlog'; + $objhash{$objname}{'objtype'} = $objtype; } # There should not be multiple entries with the same recid last; diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index dc1d68790..ee1ffe9d8 100644 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -803,6 +803,10 @@ sub processArgs # for every type of data object get the list of defined objects foreach my $t (keys %{xCAT::Schema::defspec}) { + # exclude the auditlog and eventlog, + # the auditlog and eventlog tables might be very big + # use lsdef -t auditlog or lsdef -t eventlog instead + if (($t eq 'auditlog') || ($t eq 'eventlog')) { next; } $::objectsfrom_opta = 1;