]> granicus.if.org Git - icinga2/commitdiff
Fix commenthistory
authorJean Flach <jean-marcel.flach@icinga.com>
Thu, 10 Aug 2017 14:42:02 +0000 (16:42 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Tue, 7 Nov 2017 15:37:12 +0000 (16:37 +0100)
refs #5492

lib/db_ido/dbevents.cpp
lib/db_ido_mysql/schema/mysql.sql
lib/db_ido_mysql/schema/upgrade/2.8.0.sql
lib/db_ido_pgsql/schema/pgsql.sql
lib/db_ido_pgsql/schema/upgrade/2.8.0.sql

index 557a0e65db0b9c3a9e6a24f6073b62f1d38edf78..315bd5384acf36b763d4bd4034a65cfb2b07d91d 100644 (file)
@@ -409,7 +409,7 @@ void DbEvents::RemoveCommentInternal(std::vector<DbQuery>& queries, const Commen
        query1.Category = DbCatComment;
        query1.WhereCriteria = new Dictionary();
        query1.WhereCriteria->Set("object_id", checkable);
-       query1.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time));
+       query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time));
        query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
        query1.WhereCriteria->Set("name", comment->GetName());
        queries.push_back(query1);
@@ -430,7 +430,7 @@ void DbEvents::RemoveCommentInternal(std::vector<DbQuery>& queries, const Commen
 
        query2.WhereCriteria = new Dictionary();
        query2.WhereCriteria->Set("object_id", checkable);
-       query2.WhereCriteria->Set("comment_time", DbValue::FromTimestamp(entry_time));
+       query2.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(entry_time));
        query2.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
        query2.WhereCriteria->Set("name", comment->GetName());
        queries.push_back(query2);
index 8f7238a979873fd540c88a0793271ae01e3f94e8..2acff559ab60dd5bbc0721fadd5a2cf909237c96 100644 (file)
@@ -1682,9 +1682,12 @@ CREATE INDEX idx_service_contacts_service_id on icinga_service_contacts(service_
 CREATE INDEX idx_host_contacts_host_id on icinga_host_contacts(host_id);
 
 -- #5458
-CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
-CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
+create index idx_downtimehistory_remove on icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
+create index idx_scheduleddowntime_remove on icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
 
+-- #5492
+CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
+CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
 
 -- -----------------------------------------
 -- set dbversion
index 5e0facf9f8af5517d47bd029cc83c2c1f20f0c07..5fed9831258efca725490d22da1823094df5ed9d 100644 (file)
@@ -16,6 +16,13 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
 CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
 CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
 
+-- -----------------------------------------
+-- #5492 IDO: Improve comment removal
+-- -----------------------------------------
+
+CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
+CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
+
 -- -----------------------------------------
 -- set dbversion
 -- -----------------------------------------
index bbd54b4bee45d4deb25998eeb2069721f4504798..fb033d2b7135f9e0eea35cc4cd6da8b05e00102d 100644 (file)
@@ -1725,6 +1725,10 @@ CREATE INDEX idx_host_contacts_host_id on icinga_host_contacts(host_id);
 CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
 CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
 
+-- #5492
+CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
+CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
+
 -- -----------------------------------------
 -- set dbversion
 -- -----------------------------------------
index 620486748c2db5e2c9ecfcb3ab12f21c37ce6c62..8e49f17ebb885e1f954901ee2ff4f28eb7e4b2bc 100644 (file)
 CREATE INDEX idx_downtimehistory_remove ON icinga_downtimehistory (object_id, entry_time, scheduled_start_time, scheduled_end_time);
 CREATE INDEX idx_scheduleddowntime_remove ON icinga_scheduleddowntime (object_id, entry_time, scheduled_start_time, scheduled_end_time);
 
+-- -----------------------------------------
+-- #5492
+-- -----------------------------------------
+
+CREATE INDEX idx_commenthistory_remove ON icinga_commenthistory (object_id, entry_time);
+CREATE INDEX idx_comments_remove ON icinga_comments (object_id, entry_time);
 -- -----------------------------------------
 -- set dbversion
 -- -----------------------------------------