mirror of https://github.com/Icinga/icinga2.git
Alter DowntimeRemoval behaviour
This adds an additional index to the downtimehistory and updates the dbevents in a way that it uses that index
This commit is contained in:
parent
36fddaf09b
commit
30be02bcae
|
@ -29,7 +29,7 @@
|
||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
#include <boost/thread/mutex.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"
|
#define IDO_COMPAT_SCHEMA_VERSION "1.14.2"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
|
|
|
@ -586,6 +586,7 @@ void DbEvents::RemoveDowntimeInternal(std::vector<DbQuery>& queries, const Downt
|
||||||
query1.Type = DbQueryDelete;
|
query1.Type = DbQueryDelete;
|
||||||
query1.Category = DbCatDowntime;
|
query1.Category = DbCatDowntime;
|
||||||
query1.WhereCriteria = new Dictionary();
|
query1.WhereCriteria = new Dictionary();
|
||||||
|
|
||||||
query1.WhereCriteria->Set("object_id", checkable);
|
query1.WhereCriteria->Set("object_id", checkable);
|
||||||
query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
|
query1.WhereCriteria->Set("entry_time", DbValue::FromTimestamp(downtime->GetEntryTime()));
|
||||||
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
-- mysql.sql
|
-- mysql.sql
|
||||||
-- DB definition for IDO MySQL
|
-- 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_service_contacts_service_id on icinga_service_contacts(service_id);
|
||||||
CREATE INDEX idx_host_contacts_host_id on icinga_host_contacts(host_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
|
-- set dbversion
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.14.2', NOW(), 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.2', modify_time=NOW();
|
ON DUPLICATE KEY UPDATE version='1.14.3', modify_time=NOW();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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();
|
|
@ -2,7 +2,7 @@
|
||||||
-- pgsql.sql
|
-- pgsql.sql
|
||||||
-- DB definition for IDO Postgresql
|
-- 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_service_contacts_service_id on icinga_service_contacts(service_id);
|
||||||
CREATE INDEX idx_host_contacts_host_id on icinga_host_contacts(host_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
|
-- set dbversion
|
||||||
-- -----------------------------------------
|
-- -----------------------------------------
|
||||||
|
|
||||||
SELECT updatedbversion('1.14.2');
|
SELECT updatedbversion('1.14.3');
|
||||||
|
|
||||||
|
|
|
@ -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');
|
Loading…
Reference in New Issue