make zmupdate_1.31.19 re-runable.

This commit is contained in:
Isaac Connor 2018-01-08 14:49:57 -05:00
parent baa360cd3d
commit e877fa1d61
2 changed files with 21 additions and 4 deletions

View File

@ -93,7 +93,25 @@ end;
delimiter ; delimiter ;
ALTER TABLE Events DROP INDEX Archived; set @exist := (select count(*) from information_schema.statistics where table_name = 'Events' and index_name = 'Archived' and table_schema = database());
ALTER TABLE Events DROP INDEX Frames; set @sqlstmt := if( @exist > 0, 'DROP INDEX Archived ON Events', "SELECT 'Archived INDEX is already removed.'");
CREATE INDEX Events_StorageId_idx on Events (StorageId); PREPARE stmt FROM @sqlstmt;
EXECUTE stmt;
set @exist := (select count(*) from information_schema.statistics where table_name = 'Events' and index_name = 'Frames' and table_schema = database());
set @sqlstmt := if( @exist > 0, 'DROP INDEX Frames ON Events', "SELECT 'Frames INDEX is already removed.'");
PREPARE stmt FROM @sqlstmt;
EXECUTE stmt;
set @exist := (select count(*) from information_schema.statistics where table_name = 'Events' and index_name = 'Events_StorageId_idx' and table_schema = database());
set @sqlstmt := if( @exist > 0, "SELECT 'Index Events_StorageId_idx already exists.'", 'CREATE INDEX Events_StorageId_idx on Events (StorageId)');
PREPARE stmt FROM @sqlstmt;
EXECUTE stmt;
set @exist := (select count(*) from information_schema.statistics where table_name = 'Events' and index_name = 'Events_EndTime_DiskSpace_idx' and table_schema = database());
set @sqlstmt := if( @exist > 0, "SELECT 'Index Events_EndTime_DiskSpace_idx already exists.'", 'CREATE INDEX Events_EndTime_DiskSpace_idx on Events (EndTime, DiskSpace)');
PREPARE stmt FROM @sqlstmt;
EXECUTE stmt;
UPDATE Storage SET DiskSpace=(SELECT SUM(DiskSpace) FROM Events WHERE StorageId=Storage.Id);

View File

@ -119,7 +119,6 @@ while( 1 ) {
or Fatal( "Can't execute: ".$sth->errstr() ); or Fatal( "Can't execute: ".$sth->errstr() );
while( my $monitor = $sth->fetchrow_hashref() ) { while( my $monitor = $sth->fetchrow_hashref() ) {
my $now = time(); my $now = time();
next if $monitor->{Function} eq 'None'; next if $monitor->{Function} eq 'None';
my $restart = 0; my $restart = 0;