Introduce a level param, and use it to turn on checks that shouldn't need to be done anymore, due to foreign keys
This commit is contained in:
parent
5fe7b3f55f
commit
e6525ce59e
|
@ -63,6 +63,7 @@ delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
|
|||
my $report = 0;
|
||||
my $interactive = 0;
|
||||
my $continuous = 0;
|
||||
my $level = 1;
|
||||
my $monitor_id = 0;
|
||||
my $version;
|
||||
my $force = 0;
|
||||
|
@ -74,6 +75,7 @@ GetOptions(
|
|||
continuous =>\$continuous,
|
||||
force =>\$force,
|
||||
interactive =>\$interactive,
|
||||
level =>\$level,
|
||||
'monitor_id=i' =>\$monitor_id,
|
||||
report =>\$report,
|
||||
'storage_id=i' =>\$storage_id,
|
||||
|
@ -485,7 +487,9 @@ MAIN: while( $loop ) {
|
|||
redo MAIN;
|
||||
}
|
||||
|
||||
if ( $level > 1 ) {
|
||||
# Remove orphaned events (with no monitor)
|
||||
# Shouldn't be possible anymore with FOREIGN KEYS in place
|
||||
$cleaned = 0;
|
||||
Debug("Checking for Orphaned Events");
|
||||
my $selectOrphanedEventsSql = 'SELECT Events.Id, Events.Name
|
||||
|
@ -507,6 +511,7 @@ MAIN: while( $loop ) {
|
|||
}
|
||||
}
|
||||
redo MAIN if $cleaned;
|
||||
} # end if level > 1
|
||||
|
||||
# Remove empty events (with no frames)
|
||||
$cleaned = 0;
|
||||
|
@ -552,6 +557,7 @@ MAIN: while( $loop ) {
|
|||
}
|
||||
redo MAIN if $cleaned;
|
||||
|
||||
if ( $level > 1 ) {
|
||||
# Remove orphaned stats records
|
||||
$cleaned = 0;
|
||||
Debug("Checking for Orphaned Stats");
|
||||
|
@ -570,6 +576,7 @@ MAIN: while( $loop ) {
|
|||
}
|
||||
}
|
||||
redo MAIN if ( $cleaned );
|
||||
}
|
||||
|
||||
# New audit to close any events that were left open for longer than MIN_AGE seconds
|
||||
my $selectUnclosedEventsSql =
|
||||
|
|
Loading…
Reference in New Issue