[jira] [Commented] (CLOUDSTACK-5214) Potential bug with CS 4.1.1 to 4.2.1 db upgrade

2013-12-08 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13842903#comment-13842903
 ] 

ASF subversion and git services commented on CLOUDSTACK-5214:
-

Commit 8a68cd7e51cceef9b30ba47d0c8b3ed705df630e in branch refs/heads/4.2 from 
[~aprateek]
[ https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;h=8a68cd7 ]

CLOUDSTACK-5214: create vm_snapshots if it does not exist


 Potential bug with CS 4.1.1 to 4.2.1 db upgrade
 ---

 Key: CLOUDSTACK-5214
 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-5214
 Project: CloudStack
  Issue Type: Bug
  Security Level: Public(Anyone can view this level - this is the 
 default.) 
  Components: Management Server, Upgrade
Affects Versions: 4.1.1
 Environment: CloudStack 4.1.1 to 4.2.1, CentOS 6.4 KVM
Reporter: Milamber
Priority: Blocker
 Fix For: Future


 Hello,
 Yesterday, I've upgraded a CloudStack 4.1.1 installation to CloudStack 4.2.1, 
 I've received this error when I started the management service the first time 
 after upgrade (below).
 To fix it, I've changed this line in schema-410to420.sql
 CREATE TABLE `cloud`.`vm_snapshots` (
 to
 CREATE TABLE IF NOT EXISTS `cloud`.`vm_snapshots` (
 And I've restored the cloud db backup from the mysql dump executed just 
 before upgrade, and (re-)start the management service.
 All is good after. 
 =
 2013-11-20 00:12:31,057 INFO  [utils.component.ComponentContext] 
 (Timer-1:null) Running SystemIntegrityChecker managementServerNode
 2013-11-20 00:12:31,057 INFO  [utils.component.ComponentContext] 
 (Timer-1:null) Running SystemIntegrityChecker databaseUpgradeChecker
 2013-11-20 00:12:31,057 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Grabbing lock to check for database upgrade.
 2013-11-20 00:12:31,059 DEBUG [upgrade.dao.VersionDaoImpl] (Timer-1:null) 
 Checking to see if the database is at a version before it was the version 
 table is created
 2013-11-20 00:12:31,063 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) DB version = 4.1.1 Code Version = 4.2.1-SNAPSHOT
 2013-11-20 00:12:31,063 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Database upgrade must be performed from 4.1.1 to 4.2.1-SNAPSHOT
 2013-11-20 00:12:31,064 DEBUG [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Running upgrade Upgrade410to420 to upgrade from 4.1.0-4.1.1 to 
 4.2.0
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) Looking 
 for db/schema-410to420.sql in the classpath
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) System 
 resource: file:/usr/share/cloudstack-management/setup/db/schema-410to420.sql
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) Absolute 
 path =  /usr/share/cloudstack-management/setup/db/schema-410to420.sql
 []
 2013-11-20 00:12:32,546 ERROR [utils.db.ScriptRunner] (Timer-1:null) Error 
 executing: CREATE TABLE `cloud`.`vm_snapshots` (   `id` bigint(20) unsigned 
 NOT NULL auto_increment COMMENT 'Primary Key',   `uuid` varchar(40) NOT NULL, 
   `name` varchar(255) NOT NULL,   `display_name` varchar(255) default NULL,   
 `description` varchar(255) default NULL,   `vm_id` bigint(20) unsigned NOT 
 NULL,   `account_id` bigint(20) unsigned NOT NULL,   `domain_id` bigint(20) 
 unsigned NOT NULL,   `vm_snapshot_type` varchar(32) default NULL,   `state` 
 varchar(32) NOT NULL,   `parent` bigint unsigned default NULL,   `current` 
 int(1) unsigned default NULL,   `update_count` bigint unsigned NOT NULL 
 DEFAULT 0,   `updated` datetime default NULL,   `created` datetime default 
 NULL,   `removed` datetime default NULL,   PRIMARY KEY  (`id`),   CONSTRAINT 
 UNIQUE KEY `uc_vm_snapshots_uuid` (`uuid`),   INDEX `vm_snapshots_name` 
 (`name`),   INDEX `vm_snapshots_vm_id` (`vm_id`),   INDEX 
 `vm_snapshots_account_id` (`account_id`),   INDEX `vm_snapshots_display_name` 
 (`display_name`),   INDEX `vm_snapshots_removed` (`removed`),   INDEX 
 `vm_snapshots_parent` (`parent`),   CONSTRAINT 
 `fk_vm_snapshots_vm_id__vm_instance_id` FOREIGN KEY 
 `fk_vm_snapshots_vm_id__vm_instance_id` (`vm_id`) REFERENCES `vm_instance` 
 (`id`),   CONSTRAINT `fk_vm_snapshots_account_id__account_id` FOREIGN KEY 
 `fk_vm_snapshots_account_id__account_id` (`account_id`) REFERENCES `account` 
 (`id`),   CONSTRAINT `fk_vm_snapshots_domain_id__domain_id` FOREIGN KEY 
 `fk_vm_snapshots_domain_id__domain_id` (`domain_id`) REFERENCES `domain` 
 (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 2013-11-20 00:12:32,546 ERROR [utils.db.ScriptRunner] (Timer-1:null) 
 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 
 'vm_snapshots' already exists
 2013-11-20 00:12:32,549 ERROR [cloud.upgrade.DatabaseUpgradeChecker] 
 

[jira] [Commented] (CLOUDSTACK-5214) Potential bug with CS 4.1.1 to 4.2.1 db upgrade

2013-11-20 Thread Wei Zhou (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13827489#comment-13827489
 ] 

Wei Zhou commented on CLOUDSTACK-5214:
--

You need to drop cloud database before you restore the dumped sql file, I think.

 Potential bug with CS 4.1.1 to 4.2.1 db upgrade
 ---

 Key: CLOUDSTACK-5214
 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-5214
 Project: CloudStack
  Issue Type: Bug
  Security Level: Public(Anyone can view this level - this is the 
 default.) 
  Components: Management Server, Upgrade
Affects Versions: 4.1.1
 Environment: CloudStack 4.1.1 to 4.2.1, CentOS 6.4 KVM
Reporter: Milamber
Priority: Blocker
 Fix For: Future


 Hello,
 Yesterday, I've upgraded a CloudStack 4.1.1 installation to CloudStack 4.2.1, 
 I've received this error when I started the management service the first time 
 after upgrade (below).
 To fix it, I've changed this line in schema-410to420.sql
 CREATE TABLE `cloud`.`vm_snapshots` (
 to
 CREATE TABLE IF NOT EXISTS `cloud`.`vm_snapshots` (
 And I've restored the cloud db backup from the mysql dump executed just 
 before upgrade, and (re-)start the management service.
 All is good after. 
 =
 2013-11-20 00:12:31,057 INFO  [utils.component.ComponentContext] 
 (Timer-1:null) Running SystemIntegrityChecker managementServerNode
 2013-11-20 00:12:31,057 INFO  [utils.component.ComponentContext] 
 (Timer-1:null) Running SystemIntegrityChecker databaseUpgradeChecker
 2013-11-20 00:12:31,057 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Grabbing lock to check for database upgrade.
 2013-11-20 00:12:31,059 DEBUG [upgrade.dao.VersionDaoImpl] (Timer-1:null) 
 Checking to see if the database is at a version before it was the version 
 table is created
 2013-11-20 00:12:31,063 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) DB version = 4.1.1 Code Version = 4.2.1-SNAPSHOT
 2013-11-20 00:12:31,063 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Database upgrade must be performed from 4.1.1 to 4.2.1-SNAPSHOT
 2013-11-20 00:12:31,064 DEBUG [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Running upgrade Upgrade410to420 to upgrade from 4.1.0-4.1.1 to 
 4.2.0
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) Looking 
 for db/schema-410to420.sql in the classpath
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) System 
 resource: file:/usr/share/cloudstack-management/setup/db/schema-410to420.sql
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) Absolute 
 path =  /usr/share/cloudstack-management/setup/db/schema-410to420.sql
 []
 2013-11-20 00:12:32,546 ERROR [utils.db.ScriptRunner] (Timer-1:null) Error 
 executing: CREATE TABLE `cloud`.`vm_snapshots` (   `id` bigint(20) unsigned 
 NOT NULL auto_increment COMMENT 'Primary Key',   `uuid` varchar(40) NOT NULL, 
   `name` varchar(255) NOT NULL,   `display_name` varchar(255) default NULL,   
 `description` varchar(255) default NULL,   `vm_id` bigint(20) unsigned NOT 
 NULL,   `account_id` bigint(20) unsigned NOT NULL,   `domain_id` bigint(20) 
 unsigned NOT NULL,   `vm_snapshot_type` varchar(32) default NULL,   `state` 
 varchar(32) NOT NULL,   `parent` bigint unsigned default NULL,   `current` 
 int(1) unsigned default NULL,   `update_count` bigint unsigned NOT NULL 
 DEFAULT 0,   `updated` datetime default NULL,   `created` datetime default 
 NULL,   `removed` datetime default NULL,   PRIMARY KEY  (`id`),   CONSTRAINT 
 UNIQUE KEY `uc_vm_snapshots_uuid` (`uuid`),   INDEX `vm_snapshots_name` 
 (`name`),   INDEX `vm_snapshots_vm_id` (`vm_id`),   INDEX 
 `vm_snapshots_account_id` (`account_id`),   INDEX `vm_snapshots_display_name` 
 (`display_name`),   INDEX `vm_snapshots_removed` (`removed`),   INDEX 
 `vm_snapshots_parent` (`parent`),   CONSTRAINT 
 `fk_vm_snapshots_vm_id__vm_instance_id` FOREIGN KEY 
 `fk_vm_snapshots_vm_id__vm_instance_id` (`vm_id`) REFERENCES `vm_instance` 
 (`id`),   CONSTRAINT `fk_vm_snapshots_account_id__account_id` FOREIGN KEY 
 `fk_vm_snapshots_account_id__account_id` (`account_id`) REFERENCES `account` 
 (`id`),   CONSTRAINT `fk_vm_snapshots_domain_id__domain_id` FOREIGN KEY 
 `fk_vm_snapshots_domain_id__domain_id` (`domain_id`) REFERENCES `domain` 
 (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 2013-11-20 00:12:32,546 ERROR [utils.db.ScriptRunner] (Timer-1:null) 
 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 
 'vm_snapshots' already exists
 2013-11-20 00:12:32,549 ERROR [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Unable to execute upgrade script: 
 /usr/share/cloudstack-management/setup/db/schema-410to420.sql
 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 
 'vm_snapshots' 

[jira] [Commented] (CLOUDSTACK-5214) Potential bug with CS 4.1.1 to 4.2.1 db upgrade

2013-11-20 Thread Milamber (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13827529#comment-13827529
 ] 

Milamber commented on CLOUDSTACK-5214:
--


Yes of course, yesterday, I've made a drop/create table before the dump restore.

The issue is the lake of IF NOT EXISTS in sql file.

 Potential bug with CS 4.1.1 to 4.2.1 db upgrade
 ---

 Key: CLOUDSTACK-5214
 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-5214
 Project: CloudStack
  Issue Type: Bug
  Security Level: Public(Anyone can view this level - this is the 
 default.) 
  Components: Management Server, Upgrade
Affects Versions: 4.1.1
 Environment: CloudStack 4.1.1 to 4.2.1, CentOS 6.4 KVM
Reporter: Milamber
Priority: Blocker
 Fix For: Future


 Hello,
 Yesterday, I've upgraded a CloudStack 4.1.1 installation to CloudStack 4.2.1, 
 I've received this error when I started the management service the first time 
 after upgrade (below).
 To fix it, I've changed this line in schema-410to420.sql
 CREATE TABLE `cloud`.`vm_snapshots` (
 to
 CREATE TABLE IF NOT EXISTS `cloud`.`vm_snapshots` (
 And I've restored the cloud db backup from the mysql dump executed just 
 before upgrade, and (re-)start the management service.
 All is good after. 
 =
 2013-11-20 00:12:31,057 INFO  [utils.component.ComponentContext] 
 (Timer-1:null) Running SystemIntegrityChecker managementServerNode
 2013-11-20 00:12:31,057 INFO  [utils.component.ComponentContext] 
 (Timer-1:null) Running SystemIntegrityChecker databaseUpgradeChecker
 2013-11-20 00:12:31,057 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Grabbing lock to check for database upgrade.
 2013-11-20 00:12:31,059 DEBUG [upgrade.dao.VersionDaoImpl] (Timer-1:null) 
 Checking to see if the database is at a version before it was the version 
 table is created
 2013-11-20 00:12:31,063 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) DB version = 4.1.1 Code Version = 4.2.1-SNAPSHOT
 2013-11-20 00:12:31,063 INFO  [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Database upgrade must be performed from 4.1.1 to 4.2.1-SNAPSHOT
 2013-11-20 00:12:31,064 DEBUG [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Running upgrade Upgrade410to420 to upgrade from 4.1.0-4.1.1 to 
 4.2.0
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) Looking 
 for db/schema-410to420.sql in the classpath
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) System 
 resource: file:/usr/share/cloudstack-management/setup/db/schema-410to420.sql
 2013-11-20 00:12:31,069 DEBUG [utils.script.Script] (Timer-1:null) Absolute 
 path =  /usr/share/cloudstack-management/setup/db/schema-410to420.sql
 []
 2013-11-20 00:12:32,546 ERROR [utils.db.ScriptRunner] (Timer-1:null) Error 
 executing: CREATE TABLE `cloud`.`vm_snapshots` (   `id` bigint(20) unsigned 
 NOT NULL auto_increment COMMENT 'Primary Key',   `uuid` varchar(40) NOT NULL, 
   `name` varchar(255) NOT NULL,   `display_name` varchar(255) default NULL,   
 `description` varchar(255) default NULL,   `vm_id` bigint(20) unsigned NOT 
 NULL,   `account_id` bigint(20) unsigned NOT NULL,   `domain_id` bigint(20) 
 unsigned NOT NULL,   `vm_snapshot_type` varchar(32) default NULL,   `state` 
 varchar(32) NOT NULL,   `parent` bigint unsigned default NULL,   `current` 
 int(1) unsigned default NULL,   `update_count` bigint unsigned NOT NULL 
 DEFAULT 0,   `updated` datetime default NULL,   `created` datetime default 
 NULL,   `removed` datetime default NULL,   PRIMARY KEY  (`id`),   CONSTRAINT 
 UNIQUE KEY `uc_vm_snapshots_uuid` (`uuid`),   INDEX `vm_snapshots_name` 
 (`name`),   INDEX `vm_snapshots_vm_id` (`vm_id`),   INDEX 
 `vm_snapshots_account_id` (`account_id`),   INDEX `vm_snapshots_display_name` 
 (`display_name`),   INDEX `vm_snapshots_removed` (`removed`),   INDEX 
 `vm_snapshots_parent` (`parent`),   CONSTRAINT 
 `fk_vm_snapshots_vm_id__vm_instance_id` FOREIGN KEY 
 `fk_vm_snapshots_vm_id__vm_instance_id` (`vm_id`) REFERENCES `vm_instance` 
 (`id`),   CONSTRAINT `fk_vm_snapshots_account_id__account_id` FOREIGN KEY 
 `fk_vm_snapshots_account_id__account_id` (`account_id`) REFERENCES `account` 
 (`id`),   CONSTRAINT `fk_vm_snapshots_domain_id__domain_id` FOREIGN KEY 
 `fk_vm_snapshots_domain_id__domain_id` (`domain_id`) REFERENCES `domain` 
 (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 2013-11-20 00:12:32,546 ERROR [utils.db.ScriptRunner] (Timer-1:null) 
 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 
 'vm_snapshots' already exists
 2013-11-20 00:12:32,549 ERROR [cloud.upgrade.DatabaseUpgradeChecker] 
 (Timer-1:null) Unable to execute upgrade script: 
 /usr/share/cloudstack-management/setup/db/schema-410to420.sql