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

Problem during upgrade when the counter is bigger then int primitive type can handle

    Details

      Description

      Steps to reproduce:
      1) Start 6.2
      2) Go to Control Panel -> Server Admin -> Scripts -> Groovy and run the following groovy script that set the counter to 2200000000 or just update the Counter's table to this value where name='com.liferay.counter.model.Counter'

      import com.liferay.counter.service.CounterLocalServiceUtil;
      
      for(long i=0; i< 22000000; i++)
      CounterLocalServiceUtil.increment("com.liferay.counter.model.Counter");
      

      The script needs time, I just created it to show you that the counter can be set through API. But for your tests, it's faster if you manually modify the database.

      3) Add a blog entry then check that there is an entry here: SELECT * FROM socialactivity;
      4) Shut down the portal and upgrade it to 7.0
      Result: The upgrade fails:

      2018-06-19 15:11:07.102 INFO  [main][UpgradeProcess:103] Failed upgrade process com.liferay.portal.upgrade.UpgradeProcess_7_0_0 in 59445ms
      com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: com.mysql.jdbc.exceptions.jdbc4.MySQLDataException: '1.0000000000755E15' in column '1' is outside valid range for the datatype INTEGER.
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:97)
              at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil._upgradeProcess(UpgradeProcessUtil.java:175)
              at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:143)
              at com.liferay.portal.kernel.upgrade.util.UpgradeProcessUtil.upgradeProcess(UpgradeProcessUtil.java:125)
              at com.liferay.portal.events.StartupHelper.upgradeProcess(StartupHelper.java:171)
              at com.liferay.portal.events.StartupHelperUtil.upgradeProcess(StartupHelperUtil.java:81)
              at com.liferay.portal.tools.DBUpgrader.upgrade(DBUpgrader.java:155)
              at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:101)
              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:55)
      Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: com.mysql.jdbc.exceptions.jdbc4.MySQLDataException: '1.0000000000755E15' in column '1' is outside valid range for the datatype INTEGER.
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:97)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:122)
              at com.liferay.portal.upgrade.UpgradeProcess_7_0_0.doUpgrade(UpgradeProcess_7_0_0.java:103)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:92)
              ... 12 more
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLDataException: '1.0000000000755E15' in column '1' is outside valid range for the datatype INTEGER.
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
              at com.mysql.jdbc.Util.getInstance(Util.java:386)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1026)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
              at com.mysql.jdbc.ResultSetImpl.throwRangeException(ResultSetImpl.java:7871)
              at com.mysql.jdbc.ResultSetImpl.parseIntAsDouble(ResultSetImpl.java:7041)
              at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2740)
              at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2851)
              at com.zaxxer.hikari.pool.HikariProxyResultSet.getInt(HikariProxyResultSet.java)
              at com.liferay.portal.upgrade.v7_0_0.UpgradeSocial.getCounterIncrement(UpgradeSocial.java:72)
              at com.liferay.portal.upgrade.v7_0_0.UpgradeSocial.doUpgrade(UpgradeSocial.java:59)
              at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:92)
              ... 15 more
      

      The problem that the counter is int and we use the getInt method as well:
      https://github.com/liferay/liferay-portal-ee/blob/7.0.x/portal-impl/src/com/liferay/portal/upgrade/v7_0_0/UpgradeSocial.java#L68-L72

        Attachments

          Activity

            People

            • Assignee:
              yvonne.han Yvonne Han
              Reporter:
              norbert.kocsis Norbert Kocsis
              Participants of an Issue:
              Recent user:
              Clarissa Velazquez
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 6 weeks, 3 days ago

                Packages

                Version Package
                7.0.0 DXP FP73
                7.0.10.11 DXP SP11
                7.0.X
                7.1.10 DXP FP7
                7.1.10.2 SP2
                7.1.3 CE GA4
                7.1.X
                Master