mirror of https://github.com/Icinga/icinga2.git
DB IDO: Fix duplicate entries in {host,service}depencencies table
fixes #7765
This commit is contained in:
parent
cfe986e9c5
commit
9d97094390
|
@ -55,9 +55,10 @@ More details in the [Icinga FAQ](https://www.icinga.org/icinga/faq/).
|
|||
|
||||
#### Changes
|
||||
|
||||
* [DB IDO schema upgrade](14-upgrading-icinga-2.md#upgrading-icinga-2) to `1.13.0` required!
|
||||
|
||||
TODO
|
||||
|
||||
#### Issues
|
||||
|
||||
TODO
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Upgrading Icinga 2
|
||||
# <a id="upgrading-icinga-2"></a> Upgrading Icinga 2
|
||||
|
||||
Upgrading Icinga 2 is usually quite straightforward. Ordinarily the only manual steps involved
|
||||
are scheme updates for the IDO database.
|
||||
|
@ -20,13 +20,13 @@ The Icinga 2 DB IDO module will check for the required database schema version o
|
|||
and generate an error message if not satisfied.
|
||||
|
||||
|
||||
**Example:** You are upgrading Icinga 2 from version `2.0.2` to `2.2.0`. Look into
|
||||
**Example:** You are upgrading Icinga 2 from version `2.0.2` to `2.3.0`. Look into
|
||||
the *upgrade* directory:
|
||||
|
||||
$ ls /usr/share/icinga2-ido-mysql/schema/upgrade/
|
||||
2.0.2.sql 2.1.0.sql 2.2.0.sql
|
||||
2.0.2.sql 2.1.0.sql 2.2.0.sql 2.3.0.sql
|
||||
|
||||
There are two new upgrade files called `2.1.0.sql` and `2.2.0.sql`
|
||||
There are two new upgrade files called `2.1.0.sql`, `2.2.0.sql` and `2.3.0.sql`
|
||||
which must be applied incrementially to your IDO database.
|
||||
|
||||
## <a id="upgrading-postgresql-db"></a> Upgrading the PostgreSQL database
|
||||
|
@ -46,12 +46,11 @@ Apply all database schema upgrade files incrementially.
|
|||
The Icinga 2 DB IDO module will check for the required database schema version on startup
|
||||
and generate an error message if not satisfied.
|
||||
|
||||
**Example:** You are upgrading Icinga 2 from version `2.0.2` to `2.1.0`. Look into
|
||||
**Example:** You are upgrading Icinga 2 from version `2.0.2` to `2.3.0`. Look into
|
||||
the *upgrade* directory:
|
||||
|
||||
$ ls /usr/share/icinga2-ido-pgsql/schema/upgrade/
|
||||
2.0.2.sql 2.1.0.sql 2.2.0.sql
|
||||
2.0.2.sql 2.1.0.sql 2.2.0.sql 2.3.0.sql
|
||||
|
||||
There are two new upgrade files called `2.1.0.sql` and `2.2.0.sql`
|
||||
There are two new upgrade files called `2.1.0.sql`, `2.2.0.sql` and `2.3.0.sql`
|
||||
which must be applied incrementially to your IDO database.
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ CREATE TABLE IF NOT EXISTS icinga_hostdependencies (
|
|||
fail_on_down smallint default 0,
|
||||
fail_on_unreachable smallint default 0,
|
||||
PRIMARY KEY (hostdependency_id),
|
||||
UNIQUE KEY instance_id (instance_id,config_type,host_object_id,dependent_host_object_id,dependency_type,inherits_parent,fail_on_up,fail_on_down,fail_on_unreachable)
|
||||
KEY instance_id (instance_id,config_type,host_object_id,dependent_host_object_id,dependency_type,inherits_parent,fail_on_up,fail_on_down,fail_on_unreachable)
|
||||
) ENGINE=InnoDB COMMENT='Host dependency definitions';
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
@ -1026,7 +1026,7 @@ CREATE TABLE IF NOT EXISTS icinga_servicedependencies (
|
|||
fail_on_unknown smallint default 0,
|
||||
fail_on_critical smallint default 0,
|
||||
PRIMARY KEY (servicedependency_id),
|
||||
UNIQUE KEY instance_id (instance_id,config_type,service_object_id,dependent_service_object_id,dependency_type,inherits_parent,fail_on_ok,fail_on_warning,fail_on_unknown,fail_on_critical)
|
||||
KEY instance_id (instance_id,config_type,service_object_id,dependent_service_object_id,dependency_type,inherits_parent,fail_on_ok,fail_on_warning,fail_on_unknown,fail_on_critical)
|
||||
) ENGINE=InnoDB COMMENT='Service dependency definitions';
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
@ -1603,6 +1603,6 @@ CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, co
|
|||
-- -----------------------------------------
|
||||
-- set dbversion
|
||||
-- -----------------------------------------
|
||||
INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.12.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.12.0', modify_time=NOW();
|
||||
INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.13.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.13.0', modify_time=NOW();
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
-- -----------------------------------------
|
||||
-- upgrade path for Icinga 2.3.0
|
||||
--
|
||||
-- -----------------------------------------
|
||||
-- Copyright (c) 2015 Icinga Development Team (http://www.icinga.org)
|
||||
--
|
||||
-- Please check http://docs.icinga.org for upgrading information!
|
||||
-- -----------------------------------------
|
||||
|
||||
-- -----------------------------------------
|
||||
-- #7765 drop unique constraint
|
||||
-- -----------------------------------------
|
||||
|
||||
ALTER TABLE icinga_servicedependencies DROP KEY instance_id;
|
||||
ALTER TABLE icinga_hostdependencies DROP KEY instance_id;
|
||||
|
||||
ALTER TABLE icinga_servicedependencies ADD KEY instance_id (instance_id,config_type,service_object_id,dependent_service_object_id,dependency_type,inherits_parent,fail_on_ok,fail_on_warning,fail_on_unknown,fail_on_critical);
|
||||
ALTER TABLE icinga_hostdependencies ADD KEY instance_id (instance_id,config_type,host_object_id,dependent_host_object_id,dependency_type,inherits_parent,fail_on_up,fail_on_down,fail_on_unreachable);
|
||||
|
||||
|
||||
-- -----------------------------------------
|
||||
-- update dbversion
|
||||
-- -----------------------------------------
|
||||
|
||||
INSERT INTO icinga_dbversion (name, version, create_time, modify_time) VALUES ('idoutils', '1.13.0', NOW(), NOW()) ON DUPLICATE KEY UPDATE version='1.13.0', modify_time=NOW();
|
||||
|
|
@ -562,8 +562,8 @@ CREATE TABLE icinga_hostdependencies (
|
|||
fail_on_down INTEGER default 0,
|
||||
fail_on_unreachable INTEGER default 0,
|
||||
CONSTRAINT PK_hostdependency_id PRIMARY KEY (hostdependency_id) ,
|
||||
CONSTRAINT UQ_hostdependencies UNIQUE (instance_id,config_type,host_object_id,dependent_host_object_id,dependency_type,inherits_parent,fail_on_up,fail_on_down,fail_on_unreachable)
|
||||
) ;
|
||||
CREATE INDEX idx_hostdependencies ON icinga_hostdependencies(instance_id,config_type,host_object_id,dependent_host_object_id,dependency_type,inherits_parent,fail_on_up,fail_on_down,fail_on_unreachable);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -1053,8 +1053,8 @@ CREATE TABLE icinga_servicedependencies (
|
|||
fail_on_unknown INTEGER default 0,
|
||||
fail_on_critical INTEGER default 0,
|
||||
CONSTRAINT PK_servicedependency_id PRIMARY KEY (servicedependency_id) ,
|
||||
CONSTRAINT UQ_servicedependencies UNIQUE (instance_id,config_type,service_object_id,dependent_service_object_id,dependency_type,inherits_parent,fail_on_ok,fail_on_warning,fail_on_unknown,fail_on_critical)
|
||||
) ;
|
||||
CREATE INDEX idx_servicedependencies ON icinga_servicedependencies(instance_id,config_type,service_object_id,dependent_service_object_id,dependency_type,inherits_parent,fail_on_ok,fail_on_warning,fail_on_unknown,fail_on_critical);
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
@ -1633,5 +1633,5 @@ CREATE INDEX commenthistory_delete_idx ON icinga_commenthistory (instance_id, co
|
|||
-- set dbversion
|
||||
-- -----------------------------------------
|
||||
|
||||
SELECT updatedbversion('1.12.0');
|
||||
SELECT updatedbversion('1.13.0');
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
-- -----------------------------------------
|
||||
-- upgrade path for Icinga 2.3.0
|
||||
--
|
||||
-- -----------------------------------------
|
||||
-- Copyright (c) 2015 Icinga Development Team (http://www.icinga.org)
|
||||
--
|
||||
-- Please check http://docs.icinga.org for upgrading information!
|
||||
-- -----------------------------------------
|
||||
|
||||
-- -----------------------------------------
|
||||
-- #7765 drop unique constraint
|
||||
-- -----------------------------------------
|
||||
|
||||
ALTER TABLE icinga_servicedependencies DROP CONSTRAINT uq_servicedependencies;
|
||||
ALTER TABLE icinga_hostdependencies DROP CONSTRAINT uq_hostdependencies;
|
||||
|
||||
CREATE INDEX idx_servicedependencies ON icinga_servicedependencies(instance_id,config_type,service_object_id,dependent_service_object_id,dependency_type,inherits_parent,fail_on_ok,fail_on_warning,fail_on_unknown,fail_on_critical);
|
||||
CREATE INDEX idx_hostdependencies ON icinga_hostdependencies(instance_id,config_type,host_object_id,dependent_host_object_id,dependency_type,inherits_parent,fail_on_up,fail_on_down,fail_on_unreachable);
|
||||
|
||||
|
||||
-- -----------------------------------------
|
||||
-- update dbversion
|
||||
-- -----------------------------------------
|
||||
|
||||
SELECT updatedbversion('1.13.0');
|
||||
|
Loading…
Reference in New Issue