diff --git a/CHANGELOG b/CHANGELOG index 7159a596b9..31899189e5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Cacti CHANGELOG 1.2.21 +-issue#4531: Remove 12 duplicate indexes from database -issue#4683: When adding device, errors may be reported whilst updating templates -issue#4684: Undefined variable warning causes error image not to be generated -issue#4688: Two syntax error: typo and Null-Coalescing-Operator for PHP 5.4 diff --git a/cacti.sql b/cacti.sql index 49d0dc51ff..84e7ce2cfa 100644 --- a/cacti.sql +++ b/cacti.sql @@ -1358,8 +1358,7 @@ INSERT INTO `data_source_profiles` VALUES (3,'66d35da8f75c912ede3dbe901fedcae0', CREATE TABLE `data_source_profiles_cf` ( `data_source_profile_id` mediumint(8) unsigned NOT NULL DEFAULT '0', `consolidation_function_id` smallint(5) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`data_source_profile_id`,`consolidation_function_id`), - KEY `data_source_profile_id` (`data_source_profile_id`) + PRIMARY KEY (`data_source_profile_id`,`consolidation_function_id`) ) ENGINE=InnoDB ROW_FORMAT=Dynamic COMMENT='Maps the Data Source Profile Consolidation Functions'; -- @@ -1605,7 +1604,6 @@ CREATE TABLE data_template_rrd ( data_input_field_id mediumint(8) unsigned NOT NULL default '0', PRIMARY KEY (id), UNIQUE KEY `duplicate_dsname_contraint` (`local_data_id`,`data_source_name`,`data_template_id`), - KEY local_data_id (local_data_id), KEY data_template_id (data_template_id), KEY local_data_template_rrd_id (local_data_template_rrd_id) ) ENGINE=InnoDB ROW_FORMAT=Dynamic; @@ -1674,8 +1672,7 @@ CREATE TABLE graph_template_input ( CREATE TABLE graph_template_input_defs ( graph_template_input_id int(10) unsigned NOT NULL default '0', graph_template_item_id int(12) unsigned NOT NULL default '0', - PRIMARY KEY (graph_template_input_id,graph_template_item_id), - KEY graph_template_input_id (graph_template_input_id) + PRIMARY KEY (graph_template_input_id,graph_template_item_id) ) ENGINE=InnoDB ROW_FORMAT=Dynamic COMMENT='Stores the relationship for what graph items are associated'; -- @@ -1959,7 +1956,6 @@ CREATE TABLE host ( last_updated timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY poller_id_disabled (poller_id, disabled), - KEY site_id (site_id), KEY external_id (external_id), KEY disabled (disabled), KEY status (status), @@ -2023,8 +2019,7 @@ CREATE TABLE host_snmp_query ( sort_field varchar(50) NOT NULL default '', title_format varchar(50) NOT NULL default '', reindex_method tinyint(3) unsigned NOT NULL default '0', - PRIMARY KEY (host_id,snmp_query_id), - KEY host_id (host_id) + PRIMARY KEY (host_id,snmp_query_id) ) ENGINE=InnoDB ROW_FORMAT=Dynamic; -- @@ -2054,8 +2049,7 @@ CREATE TABLE host_template ( CREATE TABLE host_template_graph ( host_template_id mediumint(8) unsigned NOT NULL default '0', graph_template_id mediumint(8) unsigned NOT NULL default '0', - PRIMARY KEY (host_template_id,graph_template_id), - KEY host_template_id (host_template_id) + PRIMARY KEY (host_template_id,graph_template_id) ) ENGINE=InnoDB ROW_FORMAT=Dynamic; -- @@ -2069,8 +2063,7 @@ CREATE TABLE host_template_graph ( CREATE TABLE host_template_snmp_query ( host_template_id mediumint(8) unsigned NOT NULL default '0', snmp_query_id mediumint(8) unsigned NOT NULL default '0', - PRIMARY KEY (host_template_id, snmp_query_id), - KEY host_template_id (host_template_id) + PRIMARY KEY (host_template_id, snmp_query_id) ) ENGINE=InnoDB ROW_FORMAT=Dynamic; -- @@ -2374,7 +2367,6 @@ CREATE TABLE `processes` ( `last_update` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`pid`,`tasktype`,`taskname`,`taskid`), KEY `tasktype` (`tasktype`), - KEY `pid` (`pid`), KEY `id` (`id`) ) ENGINE=MEMORY COMMENT='Stores Process Status for Cacti Background Processes'; @@ -2550,8 +2542,7 @@ CREATE TABLE snmp_query_graph_rrd ( data_template_rrd_id int(10) unsigned NOT NULL default '0', snmp_field_name varchar(50) NOT NULL default '0', PRIMARY KEY (snmp_query_graph_id,data_template_id,data_template_rrd_id), - KEY data_template_rrd_id (data_template_rrd_id), - KEY snmp_query_graph_id (snmp_query_graph_id) + KEY data_template_rrd_id (data_template_rrd_id) ) ENGINE=InnoDB ROW_FORMAT=Dynamic; -- @@ -2962,8 +2953,7 @@ CREATE TABLE `snmpagent_cache_notifications` ( `mib` varchar(50) NOT NULL, `attribute` varchar(50) NOT NULL, `sequence_id` smallint(6) NOT NULL, - PRIMARY KEY (`name`,`mib`,`attribute`,`sequence_id`), - KEY `name` (`name`) + PRIMARY KEY (`name`,`mib`,`attribute`,`sequence_id`) ) ENGINE=InnoDB ROW_FORMAT=Dynamic COMMENT='Notifcations and related attributes'; -- @@ -2980,7 +2970,6 @@ CREATE TABLE `snmpagent_cache_textual_conventions` ( `type` varchar(50) NOT NULL DEFAULT '', `description` varchar(5000) NOT NULL DEFAULT '', PRIMARY KEY (`name`,`mib`,`type`), - KEY `name` (`name`), KEY `mib` (`mib`) ) ENGINE=InnoDB ROW_FORMAT=Dynamic COMMENT='Textual conventions'; @@ -3026,8 +3015,7 @@ CREATE TABLE `snmpagent_managers_notifications` ( `notification` varchar(50) NOT NULL, `mib` varchar(50) NOT NULL, PRIMARY KEY(`manager_id`,`notification`,`mib`), - KEY `mib` (`mib`), - KEY `manager_id_notification` (`manager_id`,`notification`) + KEY `mib` (`mib`) ) ENGINE=InnoDB ROW_FORMAT=Dynamic COMMENT='snmp notifications to receivers'; -- diff --git a/docs/audit_schema.sql b/docs/audit_schema.sql index 3f5e24d115..e9490ed236 100644 --- a/docs/audit_schema.sql +++ b/docs/audit_schema.sql @@ -1146,7 +1146,6 @@ INSERT INTO `table_indexes` VALUES ('data_local',1,'snmp_index',1,'snmp_index',' INSERT INTO `table_indexes` VALUES ('data_local',1,'snmp_query_id',1,'snmp_query_id','A',2,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_source_profiles',1,'name',1,'name','A',3,'171',NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_source_profiles',0,'PRIMARY',1,'id','A',3,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('data_source_profiles_cf',1,'data_source_profile_id',1,'data_source_profile_id','A',6,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_source_profiles_cf',0,'PRIMARY',1,'data_source_profile_id','A',6,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_source_profiles_cf',0,'PRIMARY',2,'consolidation_function_id','A',12,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_source_profiles_rra',1,'data_source_profile_id',1,'data_source_profile_id','A',6,NULL,NULL,'','BTREE',''); @@ -1185,7 +1184,6 @@ INSERT INTO `table_indexes` VALUES ('data_template_rrd',1,'data_template_id',1,' INSERT INTO `table_indexes` VALUES ('data_template_rrd',0,'duplicate_dsname_contraint',1,'local_data_id','A',12,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_template_rrd',0,'duplicate_dsname_contraint',2,'data_source_name','A',123,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_template_rrd',0,'duplicate_dsname_contraint',3,'data_template_id','A',123,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('data_template_rrd',1,'local_data_id',1,'local_data_id','A',12,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_template_rrd',1,'local_data_template_rrd_id',1,'local_data_template_rrd_id','A',17,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('data_template_rrd',0,'PRIMARY',1,'id','A',123,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('external_links',0,'PRIMARY',1,'id','A',0,NULL,NULL,'','BTREE',''); @@ -1196,7 +1194,6 @@ INSERT INTO `table_indexes` VALUES ('graph_local',1,'snmp_index',1,'snmp_index', INSERT INTO `table_indexes` VALUES ('graph_local',1,'snmp_query_graph_id',1,'snmp_query_graph_id','A',2,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('graph_local',1,'snmp_query_id',1,'snmp_query_id','A',2,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('graph_template_input',0,'PRIMARY',1,'id','A',139,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('graph_template_input_defs',1,'graph_template_input_id',1,'graph_template_input_id','A',316,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('graph_template_input_defs',0,'PRIMARY',1,'graph_template_input_id','A',316,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('graph_template_input_defs',0,'PRIMARY',2,'graph_template_item_id','A',633,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('graph_templates',1,'multiple_name',1,'multiple','A',2,NULL,NULL,'','BTREE',''); @@ -1239,7 +1236,6 @@ INSERT INTO `table_indexes` VALUES ('host',1,'poller_id_disabled',2,'disabled',' INSERT INTO `table_indexes` VALUES ('host',1,'poller_id_last_updated',1,'poller_id','A',1,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host',1,'poller_id_last_updated',2,'last_updated','A',1,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host',0,'PRIMARY',1,'id','A',1,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('host',1,'site_id',1,'site_id','A',1,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host',1,'site_id_location',1,'site_id','A',1,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host',1,'site_id_location',2,'location','A',1,NULL,NULL,'YES','BTREE',''); INSERT INTO `table_indexes` VALUES ('host',1,'status',1,'status','A',1,NULL,NULL,'','BTREE',''); @@ -1257,15 +1253,12 @@ INSERT INTO `table_indexes` VALUES ('host_snmp_cache',0,'PRIMARY',3,'field_name' INSERT INTO `table_indexes` VALUES ('host_snmp_cache',0,'PRIMARY',4,'snmp_index','A',6,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_snmp_cache',1,'snmp_index',1,'snmp_index','A',6,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_snmp_cache',1,'snmp_query_id',1,'snmp_query_id','A',2,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('host_snmp_query',1,'host_id',1,'host_id','A',1,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_snmp_query',0,'PRIMARY',1,'host_id','A',1,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_snmp_query',0,'PRIMARY',2,'snmp_query_id','A',1,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_template',1,'name',1,'name','A',6,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_template',0,'PRIMARY',1,'id','A',6,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('host_template_graph',1,'host_template_id',1,'host_template_id','A',12,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_template_graph',0,'PRIMARY',1,'host_template_id','A',12,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_template_graph',0,'PRIMARY',2,'graph_template_id','A',48,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('host_template_snmp_query',1,'host_template_id',1,'host_template_id','A',14,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_template_snmp_query',0,'PRIMARY',1,'host_template_id','A',14,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('host_template_snmp_query',0,'PRIMARY',2,'snmp_query_id','A',14,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('plugin_config',1,'directory',1,'directory','A',0,NULL,NULL,'','BTREE',''); @@ -1328,7 +1321,6 @@ INSERT INTO `table_indexes` VALUES ('poller_time',1,'poller_id_end_time',1,'poll INSERT INTO `table_indexes` VALUES ('poller_time',1,'poller_id_end_time',2,'end_time','A',0,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('poller_time',0,'PRIMARY',1,'id','A',0,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('processes',1,'id',1,'id',NULL,0,NULL,NULL,'','HASH',''); -INSERT INTO `table_indexes` VALUES ('processes',1,'pid',1,'pid',NULL,0,NULL,NULL,'','HASH',''); INSERT INTO `table_indexes` VALUES ('processes',0,'PRIMARY',1,'pid',NULL,NULL,NULL,NULL,'','HASH',''); INSERT INTO `table_indexes` VALUES ('processes',0,'PRIMARY',2,'tasktype',NULL,NULL,NULL,NULL,'','HASH',''); INSERT INTO `table_indexes` VALUES ('processes',0,'PRIMARY',3,'taskname',NULL,NULL,NULL,NULL,'','HASH',''); @@ -1364,7 +1356,6 @@ INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd',1,'data_template_rrd_ INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd',0,'PRIMARY',1,'snmp_query_graph_id','A',66,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd',0,'PRIMARY',2,'data_template_id','A',66,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd',0,'PRIMARY',3,'data_template_rrd_id','A',66,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd',1,'snmp_query_graph_id',1,'snmp_query_graph_id','A',66,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd_sv',1,'data_template_id',1,'data_template_id','A',18,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd_sv',0,'PRIMARY',1,'id','A',75,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmp_query_graph_rrd_sv',1,'snmp_query_graph_id',1,'snmp_query_graph_id','A',75,NULL,NULL,'','BTREE',''); @@ -1374,20 +1365,16 @@ INSERT INTO `table_indexes` VALUES ('snmpagent_cache',1,'mib_name',1,'mib','A',6 INSERT INTO `table_indexes` VALUES ('snmpagent_cache',1,'mib_name',2,'name','A',137,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache',1,'name',1,'name','A',137,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache',0,'PRIMARY',1,'oid','A',137,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('snmpagent_cache_notifications',1,'name',1,'name','A',17,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_notifications',0,'PRIMARY',1,'name','A',17,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_notifications',0,'PRIMARY',2,'mib','A',17,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_notifications',0,'PRIMARY',3,'attribute','A',17,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_notifications',0,'PRIMARY',4,'sequence_id','A',17,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_textual_conventions',1,'mib',1,'mib','A',2,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('snmpagent_cache_textual_conventions',1,'name',1,'name','A',2,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_textual_conventions',0,'PRIMARY',1,'name','A',2,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_textual_conventions',0,'PRIMARY',2,'mib','A',2,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_cache_textual_conventions',0,'PRIMARY',3,'type','A',2,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_managers',1,'hostname',1,'hostname','A',0,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_managers',0,'PRIMARY',1,'id','A',0,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('snmpagent_managers_notifications',1,'manager_id_notification',1,'manager_id','A',0,NULL,NULL,'','BTREE',''); -INSERT INTO `table_indexes` VALUES ('snmpagent_managers_notifications',1,'manager_id_notification',2,'notification','A',0,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_managers_notifications',1,'mib',1,'mib','A',0,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_managers_notifications',0,'PRIMARY',1,'manager_id','A',0,NULL,NULL,'','BTREE',''); INSERT INTO `table_indexes` VALUES ('snmpagent_managers_notifications',0,'PRIMARY',2,'notification','A',0,NULL,NULL,'','BTREE',''); diff --git a/install/upgrades/1_1_26.php b/install/upgrades/1_1_26.php index af0895294e..24be3506da 100644 --- a/install/upgrades/1_1_26.php +++ b/install/upgrades/1_1_26.php @@ -28,11 +28,11 @@ function upgrade_to_1_1_26() { db_install_add_key('poller_output_realtime', 'key', 'time', array('time')); db_install_add_key('poller_time', 'key', 'poller_id_end_time', array('poller_id', 'end_time')); - if (db_column_exists('poller_time', 'rrd_next_step')) { - db_install_add_key('poller_time', 'key', 'poller_id_rrd_next_step', array('poller_id', 'rrd_next_step')); + if (db_column_exists('poller_item', 'rrd_next_step')) { + db_install_add_key('poller_item', 'key', 'poller_id_rrd_next_step', array('poller_id', 'rrd_next_step')); } if (db_column_exists('poller_item', 'rrd_next_step')) { - db_install_add_key('poller_item', 'key', 'rrd_next_step', array('rrd_next_step')); + db_install_drop_key('poller_item', 'key', 'rrd_next_step'); } } diff --git a/install/upgrades/1_1_28.php b/install/upgrades/1_1_28.php index b65f0e1132..568a2a012c 100644 --- a/install/upgrades/1_1_28.php +++ b/install/upgrades/1_1_28.php @@ -26,6 +26,6 @@ function upgrade_to_1_1_28() { db_install_add_key('poller', 'index', 'disabled', array('disabled')); db_install_drop_key('host', 'key', 'poller_id'); db_install_add_key('host', 'index', 'poller_id_disabled', array('poller_id', 'disabled')); - db_install_add_key('poller_item', 'index', 'local_data_id', array('local_data_id')); + db_install_drop_key('poller_item', 'index', 'local_data_id'); db_install_add_key('poller_item', 'index', 'poller_id_action', array('poller_id', 'action')); } diff --git a/install/upgrades/1_2_21.php b/install/upgrades/1_2_21.php new file mode 100644 index 0000000000..3c39e3a96d --- /dev/null +++ b/install/upgrades/1_2_21.php @@ -0,0 +1,41 @@ +