]> granicus.if.org Git - icinga2/commitdiff
Alter DowntimeRemoval behaviour
authorJean Flach <jean-marcel.flach@icinga.com>
Wed, 9 Aug 2017 15:41:43 +0000 (17:41 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Tue, 7 Nov 2017 15:37:12 +0000 (16:37 +0100)
This adds an additional index to the downtimehistory and updates the
dbevents in a way that it uses that index

lib/db_ido/dbconnection.hpp
lib/db_ido/dbevents.cpp
lib/db_ido_mysql/schema/mysql.sql
lib/db_ido_mysql/schema/upgrade/2.8.0.sql [new file with mode: 0644]
lib/db_ido_pgsql/schema/pgsql.sql
lib/db_ido_pgsql/schema/upgrade/2.8.0.sql [new file with mode: 0644]

index dc677d075cd20a3ded1550b5a111cdd81d8bf11d..f26735f3aea37dff86638f79e42b05c3b0cb4c33 100644 (file)
@@ -29,7 +29,7 @@
 #include <boost/thread/once.hpp>
 #include <boost/thread/mutex.hpp>
 
-#define IDO_CURRENT_SCHEMA_VERSION "1.14.2"
+#define IDO_CURRENT_SCHEMA_VERSION "1.14.3"
 #define IDO_COMPAT_SCHEMA_VERSION "1.14.2"
 
 namespace icinga
index 706e3ddd357016a2c332582dc11453daeabe93a0..557a0e65db0b9c3a9e6a24f6073b62f1d38edf78 100644 (file)
@@ -586,6 +586,7 @@ void DbEvents::RemoveDowntimeInternal(std::vector<DbQuery>& queries, const Downt
        query1.Type = DbQueryDelete;
        query1.Category = DbCatDowntime;
        query1.WhereCriteria = new Dictionary();
+
        query1.WhereCriteria->Set("object_id", checkable);
        query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
        query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
index 77f022b052cb01fab156906ccefa8b479c41ab51..8f7238a979873fd540c88a0793271ae01e3f94e8 100644 (file)
@@ -2,7 +2,7 @@
 -- mysql.sql
 -- DB definition for IDO MySQL
 --
--- Copyright (c) 2009-2016 Icinga Development Team (https://www.icinga.com/)
+-- Copyright (c) 2009-2017 Icinga Development Team (https://www.icinga.com/)
 --
 -- -- --------------------------------------------------------
 
@@ -1681,10 +1681,15 @@ CREATE INDEX idx_hostdependencies_dependent_host_object_id on icinga_hostdepende
 CREATE INDEX idx_service_contacts_service_id on icinga_service_contacts(service_id);
 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);
+
+
 -- -----------------------------------------
 -- set dbversion
 -- -----------------------------------------
-INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.14.2', NOW(), NOW())
-ON DUPLICATE KEY UPDATE version='1.14.2', modify_time=NOW();
+INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.14.3', NOW(), NOW())
+ON DUPLICATE KEY UPDATE version='1.14.3', modify_time=NOW();
 
 
diff --git a/lib/db_ido_mysql/schema/upgrade/2.8.0.sql b/lib/db_ido_mysql/schema/upgrade/2.8.0.sql
new file mode 100644 (file)
index 0000000..5e0facf
--- /dev/null
@@ -0,0 +1,22 @@
+-- -----------------------------------------
+-- upgrade path for Icinga 2.8.0
+--
+-- -----------------------------------------
+-- Copyright (c) 2017 Icinga Development Team (https://www.icinga.com)
+--
+-- Please check https://docs.icinga.com for upgrading information!
+-- -----------------------------------------
+
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+
+-- -----------------------------------------
+-- #5458 IDO: Improve downtime removal/cancel
+-- -----------------------------------------
+
+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);
+
+-- -----------------------------------------
+-- set dbversion
+-- -----------------------------------------
+INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.14.3', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.14.3', modify_time=NOW();
index fda5ea5916ffa6040cee10de9300c07003a1a1a9..bbd54b4bee45d4deb25998eeb2069721f4504798 100644 (file)
@@ -2,7 +2,7 @@
 -- pgsql.sql
 -- DB definition for IDO Postgresql
 --
--- Copyright (c) 2009-2016 Icinga Development Team (https://www.icinga.com/)
+-- Copyright (c) 2009-2017 Icinga Development Team (https://www.icinga.com/)
 --
 -- --------------------------------------------------------
 
@@ -1721,9 +1721,13 @@ CREATE INDEX idx_hostdependencies_dependent_host_object_id on icinga_hostdepende
 CREATE INDEX idx_service_contacts_service_id on icinga_service_contacts(service_id);
 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);
+
 -- -----------------------------------------
 -- set dbversion
 -- -----------------------------------------
 
-SELECT updatedbversion('1.14.2');
+SELECT updatedbversion('1.14.3');
 
diff --git a/lib/db_ido_pgsql/schema/upgrade/2.8.0.sql b/lib/db_ido_pgsql/schema/upgrade/2.8.0.sql
new file mode 100644 (file)
index 0000000..6204867
--- /dev/null
@@ -0,0 +1,21 @@
+-- -----------------------------------------
+-- upgrade path for Icinga 2.8.0
+--
+-- -----------------------------------------
+-- Copyright (c) 2017 Icinga Development Team (https://www.icinga.com)
+--
+-- Please check https://docs.icinga.com for upgrading information!
+-- -----------------------------------------
+
+-- -----------------------------------------
+-- #5458 IDO: Improve downtime removal/cancel
+-- -----------------------------------------
+
+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);
+
+-- -----------------------------------------
+-- set dbversion
+-- -----------------------------------------
+
+SELECT updatedbversion('1.14.3');