radiumfu / enterprise-log-search-and-archive

Automatically exported from code.google.com/p/enterprise-log-search-and-archive
0 stars 0 forks source link

update_node_mysql creating duplicate unique key #131

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Upgrading elsa node

What is the expected output? What do you see instead?
After every upgrade of node, duplicate unique keys are added to the tables 
'fields' and 'imports'.
See below for a before and after "show create table fields \G"  on the table 
'fields'.  Notice the dup unique key stanzas, and after an upgrade, the new 
'field_4' entry.

What version of the product are you using? On what operating system?
latest as of 2013/05/02 19:37 GMT

Please provide any additional information below.
# Before upgrade, but I've already upgraded a few times so notice the dups 
(fields_2, fields_3)
mysql> show create table fields \G
*************************** 1. row ***************************
       Table: fields
Create Table: CREATE TABLE `fields` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `field` varchar(255) NOT NULL,
  `field_type` enum('string','int') NOT NULL,
  `pattern_type` enum('NONE','QSTRING','ESTRING','STRING','DOUBLE','NUMBER','IPv4','PCRE-IPv4') NOT NULL,
  `input_validation` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `field` (`field`,`field_type`),
  UNIQUE KEY `field_2` (`field`,`field_type`),
  UNIQUE KEY `field_3` (`field`,`field_type`)
) ENGINE=InnoDB AUTO_INCREMENT=125 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

# After the upgrade.  New unique key 'field_4'
mysql> show create table fields \G
*************************** 1. row ***************************
       Table: fields
Create Table: CREATE TABLE `fields` (
  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  `field` varchar(255) NOT NULL,
  `field_type` enum('string','int') NOT NULL,
  `pattern_type` enum('NONE','QSTRING','ESTRING','STRING','DOUBLE','NUMBER','IPv4','PCRE-IPv4') NOT NULL,
  `input_validation` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `field` (`field`,`field_type`),
  UNIQUE KEY `field_2` (`field`,`field_type`),
  UNIQUE KEY `field_3` (`field`,`field_type`),
  UNIQUE KEY `field_4` (`field`,`field_type`)
) ENGINE=InnoDB AUTO_INCREMENT=136 DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

Original issue reported on code.google.com by kebut...@gmail.com on 2 May 2013 at 7:46

GoogleCodeExporter commented 8 years ago
Thanks, fixed in 837.

Original comment by mchol...@gmail.com on 3 May 2013 at 5:43