Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-133825

Upgrade process fails partitioned database with "Unknown column 'companyId"

    Details

      Description

      Steps to reproduce:

      1. Get 7.4 GA1 bundle
      2. Set the following Database Partitioning properties in the portal-ext.properties
        1. Set database.partition.enabled=true
        2. Set database.partition.instance.id=testPartition
      3. Startup the portal
      4. Create 2 new companies
      5. Navigate to each created company and create the following assets:
        1. New user
        2. New role
        3. Web Content Article
        4. Document & Media image upload
      6. Shut down the app server
      7. Multiple database schemas should have been created for Database partitioning. Generate SQL dump for all schemas
      8. Populate data for all the schemas
      9. Set database partitioning properties in the portal-upgrade-ext.properties
        1. Set database.partition.enabled=true
      10. Run upgrade tool to upgrade to the master

      Expected result:

      Partitioned database upgrades without error.

      Actual result:

      The upgrade process is failed.

      JVM arguments: -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Duser.timezone=GMT -Xmx2048m -Dexternal-properties=portal-upgrade.properties -Dserver.detector.server.id=tomcat
      Loading jar:file:/Users/koorgai/dev/project/liferay/bundles/tomcat-9.0.43/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
      Loading jar:file:/Users/koorgai/dev/project/liferay/bundles/tomcat-9.0.43/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
      Loading jar:file:/Users/koorgai/dev/project/liferay/bundles/tools/portal-tools-db-upgrade-client/com.liferay.portal.tools.db.upgrade.client.jar!/portal-upgrade.properties
      Loading file:/Users/koorgai/dev/project/liferay/bundles/tools/portal-tools-db-upgrade-client/portal-upgrade-ext.properties
      Loading file:/Users/koorgai/dev/project/liferay/bundles/tools/portal-tools-db-upgrade-client/portal-upgrade-database.properties
      2021-06-07 17:28:57.032 INFO  [main][DialectDetector:159] Using dialect org.hibernate.dialect.MySQLDialect for MySQL 5.7
      2021-06-07 17:29:07.257 INFO  [main][ModuleFrameworkImpl:1585] Starting initial bundles
      2021-06-07 17:29:08.105 INFO  [main][ModuleFrameworkImpl:1879] Started initial bundles
      2021-06-07 17:29:08.106 INFO  [main][ModuleFrameworkImpl:1932] Starting dynamic bundles
      2021-06-07 17:29:39.420 INFO  [main][ModuleFrameworkImpl:1954] Started dynamic bundles
      2021-06-07 17:29:39.422 INFO  [main][ModuleFrameworkImpl:1961] Starting web bundles
      2021-06-07 17:29:42.686 INFO  [main][ModuleFrameworkImpl:2015] Started web bundles
      2021-06-07 17:29:42.686 INFO  [main][ModuleFrameworkImpl:408] Navigate to Control Panel > System > Gogo Shell and enter "lb" to see all bundles
      2021-06-07 17:29:54.000 INFO  [main][StartupHelperUtil:99] There are no patches installed
      2021-06-07 17:29:54.246 ERROR [main][JDBCExceptionReporter:234] Unknown column 'portalpref0_.companyId' in 'field list'
      2021-06-07 17:29:54.256 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.PortalUpgradeProcess#20101
      2021-06-07 17:29:54.265 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileEntry#20101
      2021-06-07 17:29:54.281 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.UpgradeProcess#alter
      2021-06-07 17:29:54.369 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.UpgradeProcess#alter in 88 ms
      2021-06-07 17:29:54.391 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.UpgradeProcess#alter
      2021-06-07 17:29:54.471 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.UpgradeProcess#alter in 80 ms
      2021-06-07 17:29:54.476 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.UpgradeProcess#alter
      2021-06-07 17:29:54.555 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.UpgradeProcess#alter in 79 ms
      2021-06-07 17:29:54.561 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileEntry#41382
      2021-06-07 17:29:54.580 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileEntry#43632
      2021-06-07 17:29:54.596 INFO  [main][UpgradeProcess:126] Completed upgrade process com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileEntry in 333 ms
      2021-06-07 17:29:54.602 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileVersion#20101
      2021-06-07 17:29:54.608 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.UpgradeProcess#alter
      2021-06-07 17:29:54.665 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.UpgradeProcess#alter in 57 ms
      2021-06-07 17:29:54.670 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.UpgradeProcess#alter
      2021-06-07 17:29:54.734 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.UpgradeProcess#alter in 64 ms
      2021-06-07 17:29:54.734 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileVersion#41382
      2021-06-07 17:29:54.743 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileVersion#43632
      2021-06-07 17:29:54.750 INFO  [main][UpgradeProcess:126] Completed upgrade process com.liferay.portal.upgrade.v7_4_x.UpgradeDLFileVersion in 150 ms
      2021-06-07 17:29:54.756 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeCompanyId#20101
      2021-06-07 17:29:54.762 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater#doCall#PortalPreferences
      2021-06-07 17:29:54.763 INFO  [main][BaseCompanyIdUpgradeProcess:118] Adding column companyId to table PortalPreferences
      2021-06-07 17:29:54.838 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater#doCall#PortalPreferences in 75 ms
      2021-06-07 17:29:54.841 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater#doCall#PortalPreferenceValue
      2021-06-07 17:29:54.842 INFO  [main][BaseCompanyIdUpgradeProcess:118] Adding column companyId to table PortalPreferenceValue
      2021-06-07 17:29:54.893 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater#doCall#PortalPreferenceValue in 52 ms
      2021-06-07 17:29:54.893 INFO  [main][UpgradeProcess:111] Upgrading com.liferay.portal.upgrade.v7_4_x.UpgradeCompanyId#41382
      2021-06-07 17:29:54.898 INFO  [main][LoggingTimer:83] Starting com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater#doCall#PortalPreferences
      2021-06-07 17:29:54.898 INFO  [main][BaseCompanyIdUpgradeProcess:128] Skipping the creation of companyId column for table PortalPreferences
      2021-06-07 17:29:54.904 INFO  [main][LoggingTimer:44] Completed com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater#doCall#PortalPreferences in 6 ms
      2021-06-07 17:29:54.904 INFO  [main][UpgradeProcess:126] Failed upgrade process com.liferay.portal.upgrade.v7_4_x.UpgradeCompanyId in 150 ms
      2021-06-07 17:29:54.904 INFO  [main][UpgradeProcess:126] Failed upgrade process com.liferay.portal.upgrade.PortalUpgradeProcess in 806 ms
      com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLSyntaxErrorException: Unknown column 'companyId' in 'where clause'
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:120)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:173)
      	at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:136)
      	at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:172)
      	at com.liferay.portal.tools.DBUpgrader._upgradePortal(DBUpgrader.java:340)
      	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:157)
      	at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:149)
      	at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:128)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.liferay.portal.tools.db.upgrade.client.DBUpgraderLauncher.main(DBUpgraderLauncher.java:54)
      Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLSyntaxErrorException: Unknown column 'companyId' in 'where clause'
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:120)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:142)
      	at com.liferay.portal.upgrade.PortalUpgradeProcess.doUpgrade(PortalUpgradeProcess.java:137)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.lambda$upgrade$0(UpgradeProcess.java:114)
      	at com.liferay.portal.db.partition.DBPartitionUtil.forEachCompanyId(DBPartitionUtil.java:119)
      	at com.liferay.portal.dao.db.BaseDB.process(BaseDB.java:307)
      	at com.liferay.portal.kernel.dao.db.BaseDBProcess.process(BaseDBProcess.java:228)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:101)
      	... 12 more
      Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'companyId' in 'where clause'
      	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
      	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
      	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
      	at com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1335)
      	at com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2108)
      	at com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1245)
      	at com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:117)
      	at com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java)
      	at com.liferay.portal.dao.db.BaseDB.runSQL(BaseDB.java:348)
      	at com.liferay.portal.dao.db.BaseDB.runSQL(BaseDB.java:314)
      	at com.liferay.portal.kernel.dao.db.BaseDBProcess.runSQL(BaseDBProcess.java:47)
      	at com.liferay.portal.upgrade.v7_4_x.UpgradeCompanyId$PortalPreferencesTableUpdater.update(UpgradeCompanyId.java:83)
      	at com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater.doCall(BaseCompanyIdUpgradeProcess.java:134)
      	at com.liferay.portal.kernel.upgrade.BaseCompanyIdUpgradeProcess$TableUpdater.doCall(BaseCompanyIdUpgradeProcess.java:71)
      	at com.liferay.portal.kernel.upgrade.BaseUpgradeCallable.call(BaseUpgradeCallable.java:34)
      	at com.liferay.portal.upgrade.v7_4_x.UpgradeCompanyId.doUpgrade(UpgradeCompanyId.java:43)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.lambda$upgrade$0(UpgradeProcess.java:114)
      	at com.liferay.portal.db.partition.DBPartitionUtil.forEachCompanyId(DBPartitionUtil.java:119)
      	at com.liferay.portal.dao.db.BaseDB.process(BaseDB.java:307)
      	at com.liferay.portal.kernel.dao.db.BaseDBProcess.process(BaseDBProcess.java:228)
      	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:101)
      	... 19 more 

        Attachments

        1. lpartition_41382.sql
          2.16 MB
        2. lpartition_43632.sql
          2.16 MB
        3. lportal.sql
          2.78 MB

          Issue Links

            Activity

              People

              Assignee:
              koor.gai Koor Gai
              Reporter:
              koor.gai Koor Gai
              Participants of an Issue:
              Recent user:
              Rafaela Nascimento
              Engineering Assignee:
              Alberto Chaparro
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                10 weeks ago

                  Packages

                  Version Package
                  7.3.X
                  7.4.1 CE GA2 DXP 7,4
                  7.4.2 CE GA3 DXP 7,4
                  Master