Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-8212

database upgrade failed for fresh install of 4.5.0-SNAPSHOT

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.5.0
    • Fix Version/s: None
    • Component/s: Management Server
    • Security Level: Public (Anyone can view this level - this is the default.)
    • Labels:
      None
    • Environment:
      RedHat 7, external MariaDB on custom port.

      Description

      During installation of a new system, when first starting the MS, it logs that the db needs upgrading from 4.0.0, but fails to do so (see attached logs).

      The culprit would seem to be due to these error messages (my guess from screening the logs...):

      ERROR [c.c.u.d.ScriptRunner] (localhost-startStop-1:null) Error executing: UPDATE `cloud`.`configuration` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `cloud`.`configuration` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain"
      ERROR [c.c.u.d.ScriptRunner] (localhost-startStop-1:null) java.sql.SQLException: You can't specify target table 'configuration' for update in FROM clause
      ERROR [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Unable to execute upgrade script: /usr/share/cloudstack-management/setup/db/schema-421to430.sql

        Activity

        Hide
        woodtomx Tom Wood added a comment -

        I was able to reproduce this problem using CentOS 7 and CloudStack 4.5.1 using the following databases all on one VM:
        MariaDB 5.5.44 (pulled from MariaDB repo)
        MariaDB 10.0.20 (pulled from MariaDB repo)
        I was able to resolve this problem using the recommendation above. Or at least everything seemed to work. Not sure if commenting out those two lines is a "fix".

        Also when I used the default CentOS repo for the database "MariaDB 5.5.41" would installed instead of the latest from MariaDB which worked fine with no problems. This may be why some people are running into the problem and some people are not.

        Show
        woodtomx Tom Wood added a comment - I was able to reproduce this problem using CentOS 7 and CloudStack 4.5.1 using the following databases all on one VM: MariaDB 5.5.44 (pulled from MariaDB repo) MariaDB 10.0.20 (pulled from MariaDB repo) I was able to resolve this problem using the recommendation above. Or at least everything seemed to work. Not sure if commenting out those two lines is a "fix". Also when I used the default CentOS repo for the database "MariaDB 5.5.41" would installed instead of the latest from MariaDB which worked fine with no problems. This may be why some people are running into the problem and some people are not.
        Hide
        fifthecho Jeff Moody added a comment - - edited

        I have consistently reproduced this as an issue with /usr/share/cloudstack-management/setup/db/schema-421to430.sql on Centos 6 using MariaDB-server-10.0.20-1.el6.x86_64 and cloudstack-management-4.4.4-shapeblue0.el6.x86_64 or cloudstack-management-4.5.1-shapeblue0.el6.x86_64

        This is resolved by commenting out:
        UPDATE `cloud`.`configuration` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `cloud`.`configuration` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain";
        UPDATE `cloud`.`configuration` SET `value` = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `cloud`.`configuration` WHERE `name`="secstorage.ssl.cert.domain") AS `temptable` WHERE `temptable`.`name`="secstorage.ssl.cert.domain")) WHERE `name`="secstorage.ssl.cert.domain";

        Show
        fifthecho Jeff Moody added a comment - - edited I have consistently reproduced this as an issue with /usr/share/cloudstack-management/setup/db/schema-421to430.sql on Centos 6 using MariaDB-server-10.0.20-1.el6.x86_64 and cloudstack-management-4.4.4-shapeblue0.el6.x86_64 or cloudstack-management-4.5.1-shapeblue0.el6.x86_64 This is resolved by commenting out: UPDATE `cloud`.`configuration` SET value = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `cloud`.`configuration` WHERE `name`="consoleproxy.url.domain") AS `temptable` WHERE `temptable`.`name`="consoleproxy.url.domain")) WHERE `name`="consoleproxy.url.domain"; UPDATE `cloud`.`configuration` SET `value` = CONCAT("*.",(SELECT `temptable`.`value` FROM (SELECT * FROM `cloud`.`configuration` WHERE `name`="secstorage.ssl.cert.domain") AS `temptable` WHERE `temptable`.`name`="secstorage.ssl.cert.domain")) WHERE `name`="secstorage.ssl.cert.domain";
        Hide
        kaos Andreas Stenius added a comment -

        MariaDB 5.5.36 on a RedHat 6 machine.

        If you can't reproduce it, feel free to close it as a one off inconsistency unless you get others with this issue. I can try it again, but I'm a little pressed for time right now; and since I got past this step with a manual patch, that's good enough for me right now.

        Show
        kaos Andreas Stenius added a comment - MariaDB 5.5.36 on a RedHat 6 machine. If you can't reproduce it, feel free to close it as a one off inconsistency unless you get others with this issue. I can try it again, but I'm a little pressed for time right now; and since I got past this step with a manual patch, that's good enough for me right now.
        Hide
        bhaisaab Rohit Yadav added a comment -

        Which MySQL/MariaDB version are you using?

        Show
        bhaisaab Rohit Yadav added a comment - Which MySQL/MariaDB version are you using?
        Hide
        bhaisaab Rohit Yadav added a comment -

        Cannot reproduce using latest 4.5 and doing a fresh install, can you try again?

        Show
        bhaisaab Rohit Yadav added a comment - Cannot reproduce using latest 4.5 and doing a fresh install, can you try again?
        Hide
        kaos Andreas Stenius added a comment -

        I commented the offending UPDATE's to the cloud.configuration table, and the upgrade seems to have passed fine. (I checked, and there were no *.domain config entries, so it should have no effect anyway).

        ```
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) DB version = 4.0.0 Code Version = 4.5.0-SNAPSHOT
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Database upgrade must be performed from 4.0.0 to 4.5.0-SNAPSHOT
        WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 KVM SystemVm template not found. KVM hypervisor is not used, so not failing upgrade
        WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 XenServer SystemVm template not found. XenServer hypervisor is not used, so not failing upgrade
        WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 Hyperv SystemVm template not found. Hyperv hypervisor is not used, so not failing upgrade
        WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 LXC SystemVm template not found. LXC hypervisor is not used, so not failing upgrade
        WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 VMware SystemVm template not found. VMware hypervisor is not used, so not failing upgrade
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleaning upgrades because all management server are now at the same version
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade40to41 to upgrade from 4.0.0-4.1.0 to 4.1.0
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade410to420 to upgrade from 4.1.0-4.2.0 to 4.2.0
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade420to421 to upgrade from 4.2.0-4.2.1 to 4.2.1
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade421to430 to upgrade from 4.2.1-4.3.0 to 4.3.0
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade430to440 to upgrade from 4.3.0-4.4.0 to 4.4.0
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade440to441 to upgrade from 4.4.0-4.4.1 to 4.4.1
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade441to442 to upgrade from 4.4.1-4.4.2 to 4.4.2
        INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade442to450 to upgrade from 4.4.2-4.5.0 to 4.5.0
        INFO [o.a.c.s.l.CloudStackExtendedLifeCycle] (localhost-startStop-1:null) Configuring CloudStack Components
        INFO [o.a.c.s.l.CloudStackExtendedLifeCycle] (localhost-startStop-1:null) Done Configuring CloudStack Components
        INFO [o.a.c.s.m.m.i.DefaultModuleDefinitionSet] (localhost-startStop-1:null) Loaded module context [system] in 29862 ms
        ```

        Show
        kaos Andreas Stenius added a comment - I commented the offending UPDATE's to the cloud.configuration table, and the upgrade seems to have passed fine. (I checked, and there were no *.domain config entries, so it should have no effect anyway). ``` INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) DB version = 4.0.0 Code Version = 4.5.0-SNAPSHOT INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Database upgrade must be performed from 4.0.0 to 4.5.0-SNAPSHOT WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 KVM SystemVm template not found. KVM hypervisor is not used, so not failing upgrade WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 XenServer SystemVm template not found. XenServer hypervisor is not used, so not failing upgrade WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 Hyperv SystemVm template not found. Hyperv hypervisor is not used, so not failing upgrade WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 LXC SystemVm template not found. LXC hypervisor is not used, so not failing upgrade WARN [c.c.u.d.Upgrade442to450] (localhost-startStop-1:null) 4.5.0 VMware SystemVm template not found. VMware hypervisor is not used, so not failing upgrade INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleaning upgrades because all management server are now at the same version INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade40to41 to upgrade from 4.0.0-4.1.0 to 4.1.0 INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade410to420 to upgrade from 4.1.0-4.2.0 to 4.2.0 INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade420to421 to upgrade from 4.2.0-4.2.1 to 4.2.1 INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade421to430 to upgrade from 4.2.1-4.3.0 to 4.3.0 INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade430to440 to upgrade from 4.3.0-4.4.0 to 4.4.0 INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade440to441 to upgrade from 4.4.0-4.4.1 to 4.4.1 INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade441to442 to upgrade from 4.4.1-4.4.2 to 4.4.2 INFO [c.c.u.DatabaseUpgradeChecker] (localhost-startStop-1:null) Cleanup upgrade Upgrade442to450 to upgrade from 4.4.2-4.5.0 to 4.5.0 INFO [o.a.c.s.l.CloudStackExtendedLifeCycle] (localhost-startStop-1:null) Configuring CloudStack Components INFO [o.a.c.s.l.CloudStackExtendedLifeCycle] (localhost-startStop-1:null) Done Configuring CloudStack Components INFO [o.a.c.s.m.m.i.DefaultModuleDefinitionSet] (localhost-startStop-1:null) Loaded module context [system] in 29862 ms ```
        Hide
        kaos Andreas Stenius added a comment -

        a few log files from from /var/log/cloudstack/management/

        Show
        kaos Andreas Stenius added a comment - a few log files from from /var/log/cloudstack/management/

          People

          • Assignee:
            Unassigned
            Reporter:
            kaos Andreas Stenius
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:

              Development