You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Ammad Syed <sy...@gmail.com> on 2020/07/18 18:19:12 UTC

Cloudstack 4.11.3 to 4.13.1 DB Upgrade Error

Hi,

I am trying to upgrade cloudstack from 4.11.3 to 4.13.1. I am having below
db upgrade error while upgrading. I think the upgrade is executing wrong
script i.e from 4.11.2 to 4.12.0. Please advise.

2020-07-13 20:29:37,650 INFO  [o.a.c.s.l.CloudStackExtendedLifeCycle]
(main:null) (logid:) Running system integrity checker
com.cloud.upgrade.DatabaseUpgradeChecker@8dfe921
2020-07-13 20:29:37,651 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) Grabbing lock to check for database upgrade.
2020-07-13 20:29:37,684 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-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) DB version = 4.11.3.0 Code Version = 4.13.1.0
2020-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) Database upgrade must be performed from 4.11.3.0 to 4.13.1.0
2020-07-13 20:29:37,712 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) Running upgrade Upgrade41120to41200 to upgrade from
4.11.2.0-4.12.0.0 to 4.12.0.0
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- Licensed to the Apache Software Foundation (ASF) under one
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- or more contributor license agreements.  See the NOTICE file
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- distributed with this work for additional information
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- regarding copyright ownership.  The ASF licenses this file
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- to you under the Apache License, Version 2.0 (the
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- "License"); you may not use this file except in compliance
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- with the License.  You may obtain a copy of the License at
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
--   http://www.apache.org/licenses/LICENSE-2.0
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- Unless required by applicable law or agreed to in writing,
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- software distributed under the License is distributed on an
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- KIND, either express or implied.  See the License for the
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- specific language governing permissions and limitations
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- under the License.
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
--;
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- Schema upgrade from 4.11.2.0 to 4.12.0.0
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
--;
2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
-- [CLOUDSTACK-10314] Add reason column to ACL rule table
2020-07-13 20:29:37,716 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500)
AFTER `display`
2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
Error executing: ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason`
VARCHAR(2500) AFTER `display`
2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
name 'reason'
2020-07-13 20:29:37,719 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) Unable to execute upgrade script
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
name 'reason'
        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:199)
        at
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
        at
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
        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:189)
        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
2020-07-13 20:29:37,721 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:205)
        at
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
        at
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
        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:189)
        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Duplicate column name 'reason'
        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:199)
        ... 50 more
2020-07-13 20:29:37,722 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
Rolling back the transaction: Time = 10 Name =  Upgrade; called by
-TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:269-DatabaseUpgradeChecker.check:338-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123
2020-07-13 20:29:37,724 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
(main:null) (logid:) Exception encountered during context initialization -
cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Failed to start
bean 'cloudStackLifeCycle'; nested exception is
com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
database
2020-07-13 20:29:37,724 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
Failed startup of context o.e.j.w.WebAppContext@221af3c0
{/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}


-- 
Regards,


Syed Ammad Ali

Re: Cloudstack 4.11.3 to 4.13.1 DB Upgrade Error

Posted by Andrija Panic <an...@gmail.com>.
+1 on what Sergey wrote.

Restore the DB (drop the DB, do NOT simply import from backup over the
existing "cloud" DB), then try the upgrade again - all works fine as long
as there are no DB hacks you've possibly done previously, that would
interfere with the upgrade scripts.

best,

On Sun, 19 Jul 2020 at 16:18, Sergey Levitskiy <se...@hotmail.com> wrote:

> Correcting few typos:
>
>     There are 2 possibilities here
>     1.  Since column reаson was added to table network_acl_item during the
> DB schema upgrade from 4.11.2 to 4.12 this likely means that  your upgrade
> failed on a later step and you've tried to re-execute upgrade script. If so
> this is not a right sequence of recovering from a failed upgrade. You need
> to restore DB to pre-upgrade state and re-execute all according to the
> guide. You need to capture full management_server.log to figure you what
> went wrong
>     2. You might have upgraded to 4.11.3 using RC or pre-released code
> where column insertion happens during 4.11.2->4.11.3 phase that later was
> removed from the ACS master. If that's the case there is way to succeed
> although longer and not as pleasant. You still need to try #1 to capture
> and share full management_server.log
>
>
>     On 7/19/20, 3:56 AM, "Rakesh v" <ww...@gmail.com> wrote:
>
>         From the log, it looks like the column "reason" already exists in
> network_acl_item table. Does this take suppose to have that field in 4.11?
>
>         Sent from my iPhone
>
>         > On 19-Jul-2020, at 9:30 AM, Ammad Syed <sy...@gmail.com>
> wrote:
>         >
>         > Hi,
>         >
>         > I am trying to upgrade cloudstack from 4.11.3 to 4.13.1. I am
> having below
>         > db upgrade error while upgrading. I think the upgrade is
> executing wrong
>         > script i.e from 4.11.2 to 4.12.0. Please advise.
>         >
>         > 2020-07-13 20:29:37,650 INFO
> [o.a.c.s.l.CloudStackExtendedLifeCycle]
>         > (main:null) (logid:) Running system integrity checker
>         > com.cloud.upgrade.DatabaseUpgradeChecker@8dfe921
>         > 2020-07-13 20:29:37,651 INFO  [c.c.u.DatabaseUpgradeChecker]
> (main:null)
>         > (logid:) Grabbing lock to check for database upgrade.
>         > 2020-07-13 20:29:37,684 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-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker]
> (main:null)
>         > (logid:) DB version = 4.11.3.0 Code Version = 4.13.1.0
>         > 2020-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker]
> (main:null)
>         > (logid:) Database upgrade must be performed from 4.11.3.0 to
> 4.13.1.0
>         > 2020-07-13 20:29:37,712 DEBUG [c.c.u.DatabaseUpgradeChecker]
> (main:null)
>         > (logid:) Running upgrade Upgrade41120to41200 to upgrade from
>         > 4.11.2.0-4.12.0.0 to 4.12.0.0
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- Licensed to the Apache Software Foundation (ASF) under one
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- or more contributor license agreements.  See the NOTICE file
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- distributed with this work for additional information
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- regarding copyright ownership.  The ASF licenses this file
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- to you under the Apache License, Version 2.0 (the
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- "License"); you may not use this file except in compliance
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- with the License.  You may obtain a copy of the License at
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:) --
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > --   http://www.apache.org/licenses/LICENSE-2.0
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:) --
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- Unless required by applicable law or agreed to in writing,
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- software distributed under the License is distributed on an
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- KIND, either express or implied.  See the License for the
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- specific language governing permissions and limitations
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- under the License.
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > --;
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- Schema upgrade from 4.11.2.0 to 4.12.0.0
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > --;
>         > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > -- [CLOUDSTACK-10314] Add reason column to ACL rule table
>         > 2020-07-13 20:29:37,716 DEBUG [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason`
> VARCHAR(2500)
>         > AFTER `display`
>         > 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > Error executing: ALTER TABLE `cloud`.`network_acl_item` ADD
> COLUMN `reason`
>         > VARCHAR(2500) AFTER `display`
>         > 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null)
> (logid:)
>         > com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
> Duplicate column
>         > name 'reason'
>         > 2020-07-13 20:29:37,719 ERROR [c.c.u.DatabaseUpgradeChecker]
> (main:null)
>         > (logid:) Unable to execute upgrade script
>         > com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
> Duplicate column
>         > name 'reason'
>         >        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:199)
>         >        at
>         >
> com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
>         >        at
>         >
> com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
>         >        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:189)
>         >        at
> org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
>         > 2020-07-13 20:29:37,721 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:205)
>         >        at
>         >
> com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
>         >        at
>         >
> com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
>         >        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:189)
>         >        at
> org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
>         > Caused by:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
>         > Duplicate column name 'reason'
>         >        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:199)
>         >        ... 50 more
>         > 2020-07-13 20:29:37,722 DEBUG [c.c.u.d.T.Transaction]
> (main:null) (logid:)
>         > Rolling back the transaction: Time = 10 Name =  Upgrade; called
> by
>         >
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:269-DatabaseUpgradeChecker.check:338-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123
>         > 2020-07-13 20:29:37,724 WARN
> [o.a.c.s.m.c.ResourceApplicationContext]
>         > (main:null) (logid:) Exception encountered during context
> initialization -
>         > cancelling refresh attempt:
>         > org.springframework.context.ApplicationContextException: Failed
> to start
>         > bean 'cloudStackLifeCycle'; nested exception is
>         > com.cloud.utils.exception.CloudRuntimeException: Unable to
> upgrade the
>         > database
>         > 2020-07-13 20:29:37,724 WARN  [o.e.j.w.WebAppContext]
> (main:null) (logid:)
>         > Failed startup of context o.e.j.w.WebAppContext@221af3c0
>         >
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
>         >
>         >
>         > --
>         > Regards,
>         >
>         >
>         > Syed Ammad Ali
>
>
>

-- 

Andrija Panić

Re: Cloudstack 4.11.3 to 4.13.1 DB Upgrade Error

Posted by Sergey Levitskiy <se...@hotmail.com>.
Correcting few typos:

    There are 2 possibilities here 
    1.  Since column reаson was added to table network_acl_item during the DB schema upgrade from 4.11.2 to 4.12 this likely means that  your upgrade failed on a later step and you've tried to re-execute upgrade script. If so this is not a right sequence of recovering from a failed upgrade. You need to restore DB to pre-upgrade state and re-execute all according to the guide. You need to capture full management_server.log to figure you what went wrong
    2. You might have upgraded to 4.11.3 using RC or pre-released code where column insertion happens during 4.11.2->4.11.3 phase that later was removed from the ACS master. If that's the case there is way to succeed although longer and not as pleasant. You still need to try #1 to capture and share full management_server.log


    On 7/19/20, 3:56 AM, "Rakesh v" <ww...@gmail.com> wrote:

        From the log, it looks like the column "reason" already exists in network_acl_item table. Does this take suppose to have that field in 4.11?

        Sent from my iPhone

        > On 19-Jul-2020, at 9:30 AM, Ammad Syed <sy...@gmail.com> wrote:
        > 
        > Hi,
        > 
        > I am trying to upgrade cloudstack from 4.11.3 to 4.13.1. I am having below
        > db upgrade error while upgrading. I think the upgrade is executing wrong
        > script i.e from 4.11.2 to 4.12.0. Please advise.
        > 
        > 2020-07-13 20:29:37,650 INFO  [o.a.c.s.l.CloudStackExtendedLifeCycle]
        > (main:null) (logid:) Running system integrity checker
        > com.cloud.upgrade.DatabaseUpgradeChecker@8dfe921
        > 2020-07-13 20:29:37,651 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
        > (logid:) Grabbing lock to check for database upgrade.
        > 2020-07-13 20:29:37,684 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-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
        > (logid:) DB version = 4.11.3.0 Code Version = 4.13.1.0
        > 2020-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
        > (logid:) Database upgrade must be performed from 4.11.3.0 to 4.13.1.0
        > 2020-07-13 20:29:37,712 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null)
        > (logid:) Running upgrade Upgrade41120to41200 to upgrade from
        > 4.11.2.0-4.12.0.0 to 4.12.0.0
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- Licensed to the Apache Software Foundation (ASF) under one
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- or more contributor license agreements.  See the NOTICE file
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- distributed with this work for additional information
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- regarding copyright ownership.  The ASF licenses this file
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- to you under the Apache License, Version 2.0 (the
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- "License"); you may not use this file except in compliance
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- with the License.  You may obtain a copy of the License at
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > --   http://www.apache.org/licenses/LICENSE-2.0
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- Unless required by applicable law or agreed to in writing,
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- software distributed under the License is distributed on an
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- KIND, either express or implied.  See the License for the
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- specific language governing permissions and limitations
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- under the License.
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > --;
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- Schema upgrade from 4.11.2.0 to 4.12.0.0
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > --;
        > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > -- [CLOUDSTACK-10314] Add reason column to ACL rule table
        > 2020-07-13 20:29:37,716 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500)
        > AFTER `display`
        > 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > Error executing: ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason`
        > VARCHAR(2500) AFTER `display`
        > 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
        > com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
        > name 'reason'
        > 2020-07-13 20:29:37,719 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
        > (logid:) Unable to execute upgrade script
        > com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
        > name 'reason'
        >        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:199)
        >        at
        > com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
        >        at
        > com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
        >        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:189)
        >        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
        > 2020-07-13 20:29:37,721 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:205)
        >        at
        > com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
        >        at
        > com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
        >        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:189)
        >        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
        > Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
        > Duplicate column name 'reason'
        >        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:199)
        >        ... 50 more
        > 2020-07-13 20:29:37,722 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
        > Rolling back the transaction: Time = 10 Name =  Upgrade; called by
        > -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:269-DatabaseUpgradeChecker.check:338-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123
        > 2020-07-13 20:29:37,724 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
        > (main:null) (logid:) Exception encountered during context initialization -
        > cancelling refresh attempt:
        > org.springframework.context.ApplicationContextException: Failed to start
        > bean 'cloudStackLifeCycle'; nested exception is
        > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
        > database
        > 2020-07-13 20:29:37,724 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
        > Failed startup of context o.e.j.w.WebAppContext@221af3c0
        > {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
        > 
        > 
        > -- 
        > Regards,
        > 
        > 
        > Syed Ammad Ali



Re: Cloudstack 4.11.3 to 4.13.1 DB Upgrade Error

Posted by Sergey Levitskiy <se...@hotmail.com>.
There are 2 possibilities here 
1.  Since column reаson was added to table network_acl_item during the DB schema upgrade from 4.11.12 to 4.12 this likely means that  your upgrade failed on a later step and you've tried to re-execute upgrade script. If so this is not a right sequence of recovering from a failed upgrade. You need to restore DB to pre-upgrade state and re-execute all according to the guide. You need to capture full management_server.log to figure you what went wrong
2. You might have upgraded to 4.11.3 using RC or pre-released code where column insertion happens during 4.11.12->4.11.13 phase that later was removed from the ACS master. If that's the case there is way to succeed although longer and not as pleasant. You still need to try #1 to capture and share full management_server.log


On 7/19/20, 3:56 AM, "Rakesh v" <ww...@gmail.com> wrote:

    From the log, it looks like the column "reason" already exists in network_acl_item table. Does this take suppose to have that field in 4.11?

    Sent from my iPhone

    > On 19-Jul-2020, at 9:30 AM, Ammad Syed <sy...@gmail.com> wrote:
    > 
    > Hi,
    > 
    > I am trying to upgrade cloudstack from 4.11.3 to 4.13.1. I am having below
    > db upgrade error while upgrading. I think the upgrade is executing wrong
    > script i.e from 4.11.2 to 4.12.0. Please advise.
    > 
    > 2020-07-13 20:29:37,650 INFO  [o.a.c.s.l.CloudStackExtendedLifeCycle]
    > (main:null) (logid:) Running system integrity checker
    > com.cloud.upgrade.DatabaseUpgradeChecker@8dfe921
    > 2020-07-13 20:29:37,651 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
    > (logid:) Grabbing lock to check for database upgrade.
    > 2020-07-13 20:29:37,684 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-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
    > (logid:) DB version = 4.11.3.0 Code Version = 4.13.1.0
    > 2020-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
    > (logid:) Database upgrade must be performed from 4.11.3.0 to 4.13.1.0
    > 2020-07-13 20:29:37,712 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null)
    > (logid:) Running upgrade Upgrade41120to41200 to upgrade from
    > 4.11.2.0-4.12.0.0 to 4.12.0.0
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- Licensed to the Apache Software Foundation (ASF) under one
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- or more contributor license agreements.  See the NOTICE file
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- distributed with this work for additional information
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- regarding copyright ownership.  The ASF licenses this file
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- to you under the Apache License, Version 2.0 (the
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- "License"); you may not use this file except in compliance
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- with the License.  You may obtain a copy of the License at
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > --   http://www.apache.org/licenses/LICENSE-2.0
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- Unless required by applicable law or agreed to in writing,
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- software distributed under the License is distributed on an
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- KIND, either express or implied.  See the License for the
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- specific language governing permissions and limitations
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- under the License.
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > --;
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- Schema upgrade from 4.11.2.0 to 4.12.0.0
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > --;
    > 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > -- [CLOUDSTACK-10314] Add reason column to ACL rule table
    > 2020-07-13 20:29:37,716 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500)
    > AFTER `display`
    > 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > Error executing: ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason`
    > VARCHAR(2500) AFTER `display`
    > 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
    > com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
    > name 'reason'
    > 2020-07-13 20:29:37,719 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
    > (logid:) Unable to execute upgrade script
    > com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
    > name 'reason'
    >        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:199)
    >        at
    > com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
    >        at
    > com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
    >        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:189)
    >        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
    > 2020-07-13 20:29:37,721 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:205)
    >        at
    > com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
    >        at
    > com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
    >        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:189)
    >        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
    > Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
    > Duplicate column name 'reason'
    >        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:199)
    >        ... 50 more
    > 2020-07-13 20:29:37,722 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
    > Rolling back the transaction: Time = 10 Name =  Upgrade; called by
    > -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:269-DatabaseUpgradeChecker.check:338-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123
    > 2020-07-13 20:29:37,724 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
    > (main:null) (logid:) Exception encountered during context initialization -
    > cancelling refresh attempt:
    > org.springframework.context.ApplicationContextException: Failed to start
    > bean 'cloudStackLifeCycle'; nested exception is
    > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
    > database
    > 2020-07-13 20:29:37,724 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
    > Failed startup of context o.e.j.w.WebAppContext@221af3c0
    > {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
    > 
    > 
    > -- 
    > Regards,
    > 
    > 
    > Syed Ammad Ali


Re: Cloudstack 4.11.3 to 4.13.1 DB Upgrade Error

Posted by Rakesh v <ww...@gmail.com>.
From the log, it looks like the column "reason" already exists in network_acl_item table. Does this take suppose to have that field in 4.11?

Sent from my iPhone

> On 19-Jul-2020, at 9:30 AM, Ammad Syed <sy...@gmail.com> wrote:
> 
> Hi,
> 
> I am trying to upgrade cloudstack from 4.11.3 to 4.13.1. I am having below
> db upgrade error while upgrading. I think the upgrade is executing wrong
> script i.e from 4.11.2 to 4.12.0. Please advise.
> 
> 2020-07-13 20:29:37,650 INFO  [o.a.c.s.l.CloudStackExtendedLifeCycle]
> (main:null) (logid:) Running system integrity checker
> com.cloud.upgrade.DatabaseUpgradeChecker@8dfe921
> 2020-07-13 20:29:37,651 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) Grabbing lock to check for database upgrade.
> 2020-07-13 20:29:37,684 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-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) DB version = 4.11.3.0 Code Version = 4.13.1.0
> 2020-07-13 20:29:37,701 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) Database upgrade must be performed from 4.11.3.0 to 4.13.1.0
> 2020-07-13 20:29:37,712 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) Running upgrade Upgrade41120to41200 to upgrade from
> 4.11.2.0-4.12.0.0 to 4.12.0.0
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- Licensed to the Apache Software Foundation (ASF) under one
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- or more contributor license agreements.  See the NOTICE file
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- distributed with this work for additional information
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- regarding copyright ownership.  The ASF licenses this file
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- to you under the Apache License, Version 2.0 (the
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- "License"); you may not use this file except in compliance
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- with the License.  You may obtain a copy of the License at
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> --   http://www.apache.org/licenses/LICENSE-2.0
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- Unless required by applicable law or agreed to in writing,
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- software distributed under the License is distributed on an
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- KIND, either express or implied.  See the License for the
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- specific language governing permissions and limitations
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- under the License.
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> --;
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- Schema upgrade from 4.11.2.0 to 4.12.0.0
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> --;
> 2020-07-13 20:29:37,715 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> -- [CLOUDSTACK-10314] Add reason column to ACL rule table
> 2020-07-13 20:29:37,716 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
> ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500)
> AFTER `display`
> 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
> Error executing: ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason`
> VARCHAR(2500) AFTER `display`
> 2020-07-13 20:29:37,718 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
> name 'reason'
> 2020-07-13 20:29:37,719 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) Unable to execute upgrade script
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column
> name 'reason'
>        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:199)
>        at
> com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
>        at
> com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
>        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:189)
>        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
> 2020-07-13 20:29:37,721 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:205)
>        at
> com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:254)
>        at
> com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:338)
>        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:189)
>        at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:105)
> Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
> Duplicate column name 'reason'
>        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:199)
>        ... 50 more
> 2020-07-13 20:29:37,722 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
> Rolling back the transaction: Time = 10 Name =  Upgrade; called by
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:269-DatabaseUpgradeChecker.check:338-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:183-DefaultLifecycleProcessor.access$200:52-DefaultLifecycleProcessor$LifecycleGroup.start:358-DefaultLifecycleProcessor.startBeans:159-DefaultLifecycleProcessor.onRefresh:123
> 2020-07-13 20:29:37,724 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> (main:null) (logid:) Exception encountered during context initialization -
> cancelling refresh attempt:
> org.springframework.context.ApplicationContextException: Failed to start
> bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
> 2020-07-13 20:29:37,724 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
> Failed startup of context o.e.j.w.WebAppContext@221af3c0
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
> 
> 
> -- 
> Regards,
> 
> 
> Syed Ammad Ali