Hi Rakesh, Was there a prior attempt made to upgrade which didn't go through successfully? It seems like while it failed to upgrade, the DB changes were applied, hence resulting in the failure that is noticed. To address the issue, you will have to restore the DB, if you've taken a backup of it and redo the upgrade. However, to avoid such situations, an enhancement was added with https://github.com/apache/cloudstack/pull/4582 which prevents upgrading the DB in case of missing systemvm template.
Thanks Pearl ________________________________ From: Andrija Panic <andrija.pa...@gmail.com> Sent: Thursday, April 8, 2021 9:09 PM To: dev <d...@cloudstack.apache.org> Cc: users <users@cloudstack.apache.org> Subject: Re: Db schema upgrade fails from 4.14 to 4.16 4.16 doesn't exist yet, and it's the master branch - so failures are expected... On Thu, 8 Apr 2021 at 16:42, Rakesh Venkatesh <www.rakeshv....@gmail.com<http://www.rakeshv....@gmail.com>> wrote: > Hello users > > > Im trying to upgrade cloudstack from 4.14.0 to 4.16.0 and the upgrade is > failing because of the db schema upgrade. Any idea on how to fix this. > > This is the commit which is causing the issue > https://github.com/apache/cloudstack/pull/4128 > > > > 2021-04-08 13:59:26,983 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) > -- Schema upgrade from 4.14.0.0 to 4.15.0.0 > > 2021-04-08 13:59:27,002 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) > Error executing: ALTER TABLE `cloud`.`project_account` ADD COLUMN > `user_id` bigint unsigned COMMENT 'ID of user to be added to the project' > AFTER `account_id`, ADD CONSTRAINT `fk_project_account__user_id` FOREIGN > KEY `fk_project_account__user_id`(`user_id`) REFERENCES `user`(`id`) ON > DELETE CASCADE, ADD COLUMN `project_role_id` bigint unsigned COMMENT > 'Project role id' AFTER `project_account_id`, ADD CONSTRAINT > `fk_project_account__project_role_id` FOREIGN KEY (`project_role_id`) > REFERENCES `project_role` (`id`) ON DELETE SET NULL, DROP FOREIGN KEY > `fk_project_account__account_id`, DROP INDEX `account_id` > 2021-04-08 13:59:27,003 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) > java.sql.SQLSyntaxErrorException: Can't DROP > 'fk_project_account__account_id'; check that column/key exists > 2021-04-08 13:59:27,004 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) > (logid:) Unable to execute upgrade script > java.sql.SQLSyntaxErrorException: Can't DROP > 'fk_project_account__account_id'; check that column/key exists > at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185) > > > Caused by: java.sql.SQLSyntaxErrorException: Can't DROP > 'fk_project_account__account_id'; check that column/key exists > -- > Thanks and regards > Rakesh > -- Andrija Panić pearl.dsi...@shapeblue.com www.shapeblue.com 3 London Bridge Street, 3rd floor, News Building, London SE1 9SGUK @shapeblue