Fix Storage DiskSpace updating when Event.DiskSpace IS NULL
This commit is contained in:
parent
e877fa1d61
commit
348764985b
|
@ -36,11 +36,17 @@ begin
|
||||||
set diff = NEW.DiskSpace - OLD.DiskSpace;
|
set diff = NEW.DiskSpace - OLD.DiskSpace;
|
||||||
IF ( NEW.StorageId = OLD.StorageID ) THEN
|
IF ( NEW.StorageId = OLD.StorageID ) THEN
|
||||||
|
|
||||||
|
IF ( diff ) THEN
|
||||||
call update_storage_stats(OLD.StorageId, diff);
|
call update_storage_stats(OLD.StorageId, diff);
|
||||||
|
END IF;
|
||||||
ELSE
|
ELSE
|
||||||
|
IF ( NEW.DiskSpace ) THEN
|
||||||
call update_storage_stats(NEW.StorageId, NEW.DiskSpace);
|
call update_storage_stats(NEW.StorageId, NEW.DiskSpace);
|
||||||
|
END IF;
|
||||||
|
IF ( OLD.DiskSpace ) THEN
|
||||||
call update_storage_stats(OLD.StorageId, -OLD.DiskSpace);
|
call update_storage_stats(OLD.StorageId, -OLD.DiskSpace);
|
||||||
END IF;
|
END IF;
|
||||||
|
END IF;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -51,7 +57,7 @@ delimiter ;
|
||||||
drop trigger if exists event_insert_trigger;
|
drop trigger if exists event_insert_trigger;
|
||||||
|
|
||||||
delimiter //
|
delimiter //
|
||||||
|
/*
|
||||||
create trigger event_insert_trigger
|
create trigger event_insert_trigger
|
||||||
|
|
||||||
after insert
|
after insert
|
||||||
|
@ -65,7 +71,7 @@ begin
|
||||||
call update_storage_stats(NEW.StorageId, NEW.DiskSpace);
|
call update_storage_stats(NEW.StorageId, NEW.DiskSpace);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
*/
|
||||||
//
|
//
|
||||||
|
|
||||||
delimiter ;
|
delimiter ;
|
||||||
|
|
Loading…
Reference in New Issue