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

ZHANGLEIJIE updated CLOUDSTACK-10416:
-------------------------------------
    Description: 
before do this I have been do 

alter table vm_template drop column `size`;
alter table vm_template drop column `state`;
ALTER table vm_template DROP COLUMN update_count;
ALTER TABLE vm_template DROP COLUMN updated;
alter table storage_pool DROP COLUMN storage_provider_id;
alter table storage_pool DROP COLUMN scope;
alter table template_spool_ref DROP COLUMN state;
alter table template_spool_ref DROP COLUMN update_count;
alter table volumes DROP COLUMN disk_type;
alter table volumes ADD CONSTRAINT `fk_volumes__account_id` FOREIGN KEY 
(`account_id`) REFERENCES `account` (`id`);
alter table vm_instance DROP column disk_offering_id;
alter table vm_instance DROP column cpu;
alter table vm_instance DROP column ram;
alter table vm_instance DROP column `owner`;
alter table vm_instance DROP column speed;
alter table vm_instance DROP column host_name;
alter table vm_instance DROP column display_name;
alter table vm_instance DROP column `desired_state`;
alter table data_center DROP column `owner`;
alter table data_center DROP column `created`;
alter table data_center DROP column lastUpdated;
alter table data_center DROP column engine_state;
alter table host_pod_ref DROP column `owner`;
alter table host_pod_ref DROP column created;
alter table host_pod_ref DROP column lastUpdated; 
alter table host_pod_ref DROP column engine_state;
alter table `host` DROP column `owner`;
alter table host DROP column lastUpdated;

but also have table column error , I don't know how many , so I give up

I restart cloudstack-management.service every time have this error
service cloudstack-management restart
then management-server.log out put

2020-03-25 21:01:20,926 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Grabbing lock to check for database upgrade.
2020-03-25 21:01:20,974 DEBUG [c.c.u.d.VersionDaoImpl] (main:null) (logid:) 
Checking to see if the database is at a version before it was the version table 
is created
2020-03-25 21:01:20,996 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) DB version = 4.0.0 Code Version = 4.11.3.0
2020-03-25 21:01:20,997 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Database upgrade must be performed from 4.0.0 to 4.11.3.0
2020-03-25 21:01:20,997 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Running upgrade Upgrade40to41 to upgrade from 4.0.0-4.1.0 to 4.1.0
2020-03-25 21:01:21,003 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
Licensed to the Apache Software Foundation (ASF) under one
2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- or 
more contributor license agreements.  See the NOTICE file
2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
distributed with this work for additional information
2020-03-25 21:01:21,007 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
regarding copyright ownership.  The ASF licenses this file
2020-03-25 21:01:21,008 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- to 
you under the Apache License, Version 2.0 (the
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
"License"); you may not use this file except in compliance
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
with the License.  You may obtain a copy of the License at
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --   
http://www.apache.org/licenses/LICENSE-2.0
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
Unless required by applicable law or agreed to in writing,
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
software distributed under the License is distributed on an
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
KIND, either express or implied.  See the License for the
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
specific language governing permissions and limitations
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
under the License.
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
Schema upgrade from 4.0.0 to 4.1.0;
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
2020-03-25 21:01:21,013 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) use 
cloud 
2020-03-25 21:01:21,016 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) SET 
foreign_key_checks = 0 
2020-03-25 21:01:21,017 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_template add size bigint unsigned 
2020-03-25 21:01:21,079 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_template add state varchar(255) 
2020-03-25 21:01:21,138 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_template add update_count bigint unsigned 
2020-03-25 21:01:21,182 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_template add updated  datetime 
2020-03-25 21:01:21,380 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table storage_pool add storage_provider_id bigint unsigned 
2020-03-25 21:01:21,476 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table storage_pool add scope varchar(255) 
2020-03-25 21:01:21,888 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table storage_pool modify id bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL 
2020-03-25 21:01:21,942 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table template_spool_ref add state varchar(255) 
2020-03-25 21:01:21,964 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table template_spool_ref add update_count bigint unsigned 
2020-03-25 21:01:22,001 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table volumes add disk_type varchar(255) 
2020-03-25 21:01:22,073 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table volumes drop foreign key `fk_volumes__account_id` 
2020-03-25 21:01:22,086 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column disk_offering_id bigint unsigned 
2020-03-25 21:01:22,151 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column cpu int(10) unsigned 
2020-03-25 21:01:22,332 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column ram bigint unsigned 
2020-03-25 21:01:22,531 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column owner varchar(255) 
2020-03-25 21:01:22,717 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column speed int(10) unsigned 
2020-03-25 21:01:22,839 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column host_name varchar(255) 
2020-03-25 21:01:22,928 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column display_name varchar(255) 
2020-03-25 21:01:23,040 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table vm_instance add column `desired_state` varchar(32) NULL 
2020-03-25 21:01:23,094 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table data_center add column owner varchar(255) 
2020-03-25 21:01:23,145 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table data_center add column created datetime COMMENT 'date created' 
2020-03-25 21:01:23,351 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table data_center add column lastUpdated datetime COMMENT 'last updated' 
2020-03-25 21:01:23,400 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table data_center add column engine_state varchar(32) NOT NULL DEFAULT 
'Disabled' COMMENT 'the engine state of the zone' 
2020-03-25 21:01:23,489 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table host_pod_ref add column owner varchar(255) 
2020-03-25 21:01:23,530 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table host_pod_ref add column created datetime COMMENT 'date created' 
2020-03-25 21:01:23,632 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table host_pod_ref add column lastUpdated datetime COMMENT 'last updated' 
2020-03-25 21:01:23,724 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table host_pod_ref add column engine_state varchar(32) NOT NULL DEFAULT 
'Disabled' COMMENT 'the engine state of the zone' 
2020-03-25 21:01:23,760 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table host add column owner varchar(255) 
2020-03-25 21:01:23,883 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table host add column lastUpdated datetime COMMENT 'last updated' 
2020-03-25 21:01:24,057 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) alter 
table host add column engine_state varchar(32) NOT NULL DEFAULT 'Disabled' 
COMMENT 'the engine state of the zone' 
2020-03-25 21:01:24,080 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) Error 
executing: alter table host add column engine_state varchar(32) NOT NULL 
DEFAULT 'Disabled' COMMENT 'the engine state of the zone' 
2020-03-25 21:01:24,081 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) 
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
2020-03-25 21:01:24,082 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Unable to execute upgrade script
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
        at 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
        at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
        at 
org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:58)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:62)
        at 
org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:52)
        at 
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
        at 
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
        at 
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515)
        at 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
        at 
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:273)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:115)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at org.eclipse.jetty.server.Server.start(Server.java:418)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at org.eclipse.jetty.server.Server.doStart(Server.java:385)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.apache.cloudstack.ServerDaemon.start(ServerDaemon.java:200)
        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:101)
2020-03-25 21:01:24,084 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Unable to upgrade the database
com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade 
script
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:490)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
        at 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
        at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
        at 
org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:58)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:62)
        at 
org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:52)
        at 
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
        at 
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
        at 
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515)
        at 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
        at 
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:273)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:115)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at org.eclipse.jetty.server.Server.start(Server.java:418)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at org.eclipse.jetty.server.Server.doStart(Server.java:385)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.apache.cloudstack.ServerDaemon.start(ServerDaemon.java:200)
        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:101)
Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 
'engine_state'
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
        ... 50 more
2020-03-25 21:01:24,086 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:) 
Rolling back the transaction: Time = 3089 Name =  Upgrade; called by 
-TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:597-DatabaseUpgradeChecker.check:666-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123

  was:
before do this I have been do 

alter table vm_template drop column `size`;
alter table vm_template drop column `state`;
ALTER table vm_template DROP COLUMN update_count;
ALTER TABLE vm_template DROP COLUMN updated;
alter table storage_pool DROP COLUMN storage_provider_id;
alter table storage_pool DROP COLUMN scope;
alter table template_spool_ref DROP COLUMN state;
alter table template_spool_ref DROP COLUMN update_count;
alter table volumes DROP COLUMN disk_type;
alter table volumes ADD CONSTRAINT `fk_volumes__account_id` FOREIGN KEY 
(`account_id`) REFERENCES `account` (`id`);
alter table vm_instance DROP column disk_offering_id;
alter table vm_instance DROP column cpu;
alter table vm_instance DROP column ram;
alter table vm_instance DROP column `owner`;
alter table vm_instance DROP column speed;
alter table vm_instance DROP column host_name;
alter table vm_instance DROP column display_name;
alter table vm_instance DROP column `desired_state`;
alter table data_center DROP column `owner`;
alter table data_center DROP column `created`;
alter table data_center DROP column lastUpdated;
alter table data_center DROP column engine_state;
alter table host_pod_ref DROP column `owner`;
alter table host_pod_ref DROP column created;
alter table host_pod_ref DROP column lastUpdated; 
alter table host_pod_ref DROP column engine_state;
alter table `host` DROP column `owner`;
alter table host DROP column lastUpdated;

but also have table column error , I don't know how many , so I give up

 Error executing: alter table host add column engine_state varchar(32) NOT NULL 
DEFAULT 'Disabled' COMMENT 'the engine state of the zone' 
2020-03-25 21:01:24,081 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) 
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
2020-03-25 21:01:24,082 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Unable to execute upgrade script
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
        at 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
        at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
        at 
org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:58)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:62)
        at 
org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:52)
        at 
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
        at 
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
        at 
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515)
        at 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
        at 
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:273)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:115)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at org.eclipse.jetty.server.Server.start(Server.java:418)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at org.eclipse.jetty.server.Server.doStart(Server.java:385)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.apache.cloudstack.ServerDaemon.start(ServerDaemon.java:200)
        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:101)
2020-03-25 21:01:24,084 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Unable to upgrade the database
com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade 
script
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:490)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
        at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
        at 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
        at 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
        at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
        at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
        at 
org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:58)
        at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:62)
        at 
org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:52)
        at 
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
        at 
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
        at 
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515)
        at 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477)
        at 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
        at 
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
        at 
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:273)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:115)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
        at org.eclipse.jetty.server.Server.start(Server.java:418)
        at 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
        at 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
        at org.eclipse.jetty.server.Server.doStart(Server.java:385)
        at 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.apache.cloudstack.ServerDaemon.start(ServerDaemon.java:200)
        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:101)
Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 
'engine_state'
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
        at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
        at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
        ... 50 more
2020-03-25 21:01:24,086 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:) 
Rolling back the transaction: Time = 3089 Name =  Upgrade; called by 
-TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:597-DatabaseUpgradeChecker.check:666-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123


> Schema upgrade from 4.0.0 to 4.1.0 error 
> -----------------------------------------
>
>                 Key: CLOUDSTACK-10416
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10416
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>          Components: cloudstack-agent
>    Affects Versions: 4.1.1
>            Reporter: ZHANGLEIJIE
>            Priority: Major
>
> before do this I have been do 
> alter table vm_template drop column `size`;
> alter table vm_template drop column `state`;
> ALTER table vm_template DROP COLUMN update_count;
> ALTER TABLE vm_template DROP COLUMN updated;
> alter table storage_pool DROP COLUMN storage_provider_id;
> alter table storage_pool DROP COLUMN scope;
> alter table template_spool_ref DROP COLUMN state;
> alter table template_spool_ref DROP COLUMN update_count;
> alter table volumes DROP COLUMN disk_type;
> alter table volumes ADD CONSTRAINT `fk_volumes__account_id` FOREIGN KEY 
> (`account_id`) REFERENCES `account` (`id`);
> alter table vm_instance DROP column disk_offering_id;
> alter table vm_instance DROP column cpu;
> alter table vm_instance DROP column ram;
> alter table vm_instance DROP column `owner`;
> alter table vm_instance DROP column speed;
> alter table vm_instance DROP column host_name;
> alter table vm_instance DROP column display_name;
> alter table vm_instance DROP column `desired_state`;
> alter table data_center DROP column `owner`;
> alter table data_center DROP column `created`;
> alter table data_center DROP column lastUpdated;
> alter table data_center DROP column engine_state;
> alter table host_pod_ref DROP column `owner`;
> alter table host_pod_ref DROP column created;
> alter table host_pod_ref DROP column lastUpdated; 
> alter table host_pod_ref DROP column engine_state;
> alter table `host` DROP column `owner`;
> alter table host DROP column lastUpdated;
> but also have table column error , I don't know how many , so I give up
> I restart cloudstack-management.service every time have this error
> service cloudstack-management restart
> then management-server.log out put
> 2020-03-25 21:01:20,926 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Grabbing lock to check for database upgrade.
> 2020-03-25 21:01:20,974 DEBUG [c.c.u.d.VersionDaoImpl] (main:null) (logid:) 
> Checking to see if the database is at a version before it was the version 
> table is created
> 2020-03-25 21:01:20,996 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) DB version = 4.0.0 Code Version = 4.11.3.0
> 2020-03-25 21:01:20,997 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Database upgrade must be performed from 4.0.0 to 4.11.3.0
> 2020-03-25 21:01:20,997 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Running upgrade Upgrade40to41 to upgrade from 4.0.0-4.1.0 to 4.1.0
> 2020-03-25 21:01:21,003 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> Licensed to the Apache Software Foundation (ASF) under one
> 2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> or more contributor license agreements.  See the NOTICE file
> 2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> distributed with this work for additional information
> 2020-03-25 21:01:21,007 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> regarding copyright ownership.  The ASF licenses this file
> 2020-03-25 21:01:21,008 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> to you under the Apache License, Version 2.0 (the
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> "License"); you may not use this file except in compliance
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> with the License.  You may obtain a copy of the License at
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --  
>  http://www.apache.org/licenses/LICENSE-2.0
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> Unless required by applicable law or agreed to in writing,
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> software distributed under the License is distributed on an
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> KIND, either express or implied.  See the License for the
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> specific language governing permissions and limitations
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> under the License.
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> Schema upgrade from 4.0.0 to 4.1.0;
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
> 2020-03-25 21:01:21,013 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) use 
> cloud 
> 2020-03-25 21:01:21,016 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) SET 
> foreign_key_checks = 0 
> 2020-03-25 21:01:21,017 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_template add size bigint unsigned 
> 2020-03-25 21:01:21,079 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_template add state varchar(255) 
> 2020-03-25 21:01:21,138 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_template add update_count bigint unsigned 
> 2020-03-25 21:01:21,182 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_template add updated  datetime 
> 2020-03-25 21:01:21,380 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table storage_pool add storage_provider_id bigint unsigned 
> 2020-03-25 21:01:21,476 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table storage_pool add scope varchar(255) 
> 2020-03-25 21:01:21,888 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table storage_pool modify id bigint unsigned AUTO_INCREMENT UNIQUE NOT 
> NULL 
> 2020-03-25 21:01:21,942 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table template_spool_ref add state varchar(255) 
> 2020-03-25 21:01:21,964 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table template_spool_ref add update_count bigint unsigned 
> 2020-03-25 21:01:22,001 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table volumes add disk_type varchar(255) 
> 2020-03-25 21:01:22,073 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table volumes drop foreign key `fk_volumes__account_id` 
> 2020-03-25 21:01:22,086 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column disk_offering_id bigint unsigned 
> 2020-03-25 21:01:22,151 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column cpu int(10) unsigned 
> 2020-03-25 21:01:22,332 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column ram bigint unsigned 
> 2020-03-25 21:01:22,531 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column owner varchar(255) 
> 2020-03-25 21:01:22,717 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column speed int(10) unsigned 
> 2020-03-25 21:01:22,839 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column host_name varchar(255) 
> 2020-03-25 21:01:22,928 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column display_name varchar(255) 
> 2020-03-25 21:01:23,040 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table vm_instance add column `desired_state` varchar(32) NULL 
> 2020-03-25 21:01:23,094 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table data_center add column owner varchar(255) 
> 2020-03-25 21:01:23,145 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table data_center add column created datetime COMMENT 'date created' 
> 2020-03-25 21:01:23,351 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table data_center add column lastUpdated datetime COMMENT 'last 
> updated' 
> 2020-03-25 21:01:23,400 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table data_center add column engine_state varchar(32) NOT NULL DEFAULT 
> 'Disabled' COMMENT 'the engine state of the zone' 
> 2020-03-25 21:01:23,489 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table host_pod_ref add column owner varchar(255) 
> 2020-03-25 21:01:23,530 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table host_pod_ref add column created datetime COMMENT 'date created' 
> 2020-03-25 21:01:23,632 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table host_pod_ref add column lastUpdated datetime COMMENT 'last 
> updated' 
> 2020-03-25 21:01:23,724 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table host_pod_ref add column engine_state varchar(32) NOT NULL DEFAULT 
> 'Disabled' COMMENT 'the engine state of the zone' 
> 2020-03-25 21:01:23,760 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table host add column owner varchar(255) 
> 2020-03-25 21:01:23,883 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table host add column lastUpdated datetime COMMENT 'last updated' 
> 2020-03-25 21:01:24,057 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> alter table host add column engine_state varchar(32) NOT NULL DEFAULT 
> 'Disabled' COMMENT 'the engine state of the zone' 
> 2020-03-25 21:01:24,080 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> Error executing: alter table host add column engine_state varchar(32) NOT 
> NULL DEFAULT 'Disabled' COMMENT 'the engine state of the zone' 
> 2020-03-25 21:01:24,081 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) 
> java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
> 2020-03-25 21:01:24,082 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Unable to execute upgrade script
> java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
>         at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
>         at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
>         at 
> com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
>         at 
> com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
>         at 
> com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
>         at 
> org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
>         at 
> org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
>         at 
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
>         at 
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
>         at 
> org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
>         at 
> org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
>         at 
> org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:58)
>         at 
> org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:62)
>         at 
> org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:52)
>         at 
> org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
>         at 
> org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
>         at 
> org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
>         at 
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
>         at 
> org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515)
>         at 
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477)
>         at 
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
>         at 
> org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
>         at 
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
>         at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>         at 
> org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:273)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:115)
>         at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
>         at org.eclipse.jetty.server.Server.start(Server.java:418)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
>         at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>         at org.eclipse.jetty.server.Server.doStart(Server.java:385)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at org.apache.cloudstack.ServerDaemon.start(ServerDaemon.java:200)
>         at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:101)
> 2020-03-25 21:01:24,084 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Unable to upgrade the database
> com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade 
> script
>         at 
> com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:490)
>         at 
> com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
>         at 
> com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
>         at 
> org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
>         at 
> org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
>         at 
> org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
>         at 
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
>         at 
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
>         at 
> org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
>         at 
> org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
>         at 
> org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
>         at 
> org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:58)
>         at 
> org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:62)
>         at 
> org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:52)
>         at 
> org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
>         at 
> org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
>         at 
> org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
>         at 
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
>         at 
> org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515)
>         at 
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477)
>         at 
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
>         at 
> org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
>         at 
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
>         at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>         at 
> org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:273)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:115)
>         at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:133)
>         at org.eclipse.jetty.server.Server.start(Server.java:418)
>         at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:107)
>         at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
>         at org.eclipse.jetty.server.Server.doStart(Server.java:385)
>         at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
>         at org.apache.cloudstack.ServerDaemon.start(ServerDaemon.java:200)
>         at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:101)
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 
> 'engine_state'
>         at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
>         at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
>         at 
> com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
>         ... 50 more
> 2020-03-25 21:01:24,086 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:) 
> Rolling back the transaction: Time = 3089 Name =  Upgrade; called by 
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:597-DatabaseUpgradeChecker.check:666-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to