You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "Abhinandan Prateek (JIRA)" <ji...@apache.org> on 2013/12/09 05:34:09 UTC

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

     [ https://issues.apache.org/jira/browse/CLOUDSTACK-5214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Abhinandan Prateek resolved CLOUDSTACK-5214.
--------------------------------------------

    Resolution: Fixed

> 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' already exists
>     at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:193)
>     at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:204)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:265)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:394)
>     at com.cloud.utils.component.ComponentContext.initComponentsLifeCycle(ComponentContext.java:90)
>     at com.cloud.servlet.CloudStartupServlet$1.run(CloudStartupServlet.java:54)
>     at java.util.TimerThread.mainLoop(Timer.java:534)
>     at java.util.TimerThread.run(Timer.java:484)
> 2013-11-20 00:12:32,552 ERROR [cloud.upgrade.DatabaseUpgradeChecker] (Timer-1:null) Unable to upgrade the database
> com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade script: /usr/share/cloudstack-management/setup/db/schema-410to420.sql
>     at com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:213)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:265)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:394)
>     at com.cloud.utils.component.ComponentContext.initComponentsLifeCycle(ComponentContext.java:90)
>     at com.cloud.servlet.CloudStartupServlet$1.run(CloudStartupServlet.java:54)
>     at java.util.TimerThread.mainLoop(Timer.java:534)
>     at java.util.TimerThread.run(Timer.java:484)
> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'vm_snapshots' already exists
>     at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:193)
>     at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:204)
>     ... 6 more
> 2013-11-20 00:12:32,556 ERROR [utils.component.ComponentContext] (Timer-1:null) System integrity check failed. Refuse to startup
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the database
>     at com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:296)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:394)
>     at com.cloud.utils.component.ComponentContext.initComponentsLifeCycle(ComponentContext.java:90)
>     at com.cloud.servlet.CloudStartupServlet$1.run(CloudStartupServlet.java:54)
>     at java.util.TimerThread.mainLoop(Timer.java:534)
>     at java.util.TimerThread.run(Timer.java:484)
> Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade script: /usr/share/cloudstack-management/setup/db/schema-410to420.sql
>     at com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:213)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:265)
>     ... 5 more
> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'vm_snapshots' already exists
>     at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:193)
>     at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
>     at com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:204)
>     ... 6 more



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)