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

During upgrade, inconsistent elinstanceid values are assigned to JournalArticleImage

    Details

      Description

      Due old bug LPS-44206, JournalArticleImage entries were created without elInstanceId

      So customers in 6.2 before LPS-44206 has entries without that value. During upgrade to 7.0, that empty entries are filled with new generated ids (that code was added in LPS-63727)
      About this upgrade process:

      • If a JournalArticleImage is translated in two or more languages, the same elinstanceid must be generated for each translation in a specific version.
      • But after LPS-72074 all JournalArticleImage entries are generated with random elInstanceId values

      This upgrade process has following problems:

      • If you use MySQL, upgrade works fine but this inconsistent data causes malfunction of translated copies of webcontent
      • If you use Postgresql, upgrade fails (perhaps other databases are also affected)

      Steps to reproduce using MySQL:

      1. Install a Liferay 6.2 SP4 and configure it using MySQL (it is important to use that version or older ones)
      2. Create a structure with a repeatable image field
      3. Create a template related to created structure
      4. Create a webcontent using created structure, adding 3 images in English (en_US)
      5. Translate the created webcontent to Spanish (es_ES) and add 3 images
      6. Upgrade installation to 7.0 or master
      7. Check JournalArticleImage table, execute following query:
        select groupId,articleId,version,elInstanceId,elName,count(*) from JournalArticleImage group by groupId,articleId,version,elInstanceId,elName
        • Expected behavior: count in rows of last journalArticle version is 2 (en_US and es_ES) because they share the elInstanceId
        • Wrong behavior: count in all rows is 1

      Steps to reproduce using Postgresql:

      1. Install a Liferay 6.2 SP4 and configure it using Postgresql (it is important to use that version or older ones)
      2. Create a structure with a repeatable image field
      3. Create a template related to created structure
      4. Create a webcontent using created structure, adding 3 images in English (en_US)
      5. Translate the created webcontent to Spanish (es_ES) and add 3 images
      6. Upgrade installation to 7.0 or master
        • Expected behavior: upgrade works fine
        • Wrong behavior: upgrade fails
          INFO - Starting com.liferay.journal.internal.upgrade.v1_0_0.UpgradeJournalArticleImage#updateJournalArticleImagesInstanceId
          09:07:23,026 INFO  [main][LoggingTimer:38] Completed com.liferay.journal.internal.upgrade.v1_0_0.UpgradeJournalArticleImage#updateJournalArticleImagesInstanceId in 4 ms
          INFO - Completed com.liferay.journal.internal.upgrade.v1_0_0.UpgradeJournalArticleImage#updateJournalArticleImagesInstanceId in 4 ms
          09:07:23,027 INFO  [main][UpgradeProcess:99] Completed upgrade process com.liferay.journal.internal.upgrade.v1_0_0.UpgradeJournalArticleImage in 6ms
          INFO - Completed upgrade process com.liferay.journal.internal.upgrade.v1_0_0.UpgradeJournalArticleImage in 6ms
          09:07:23,030 ERROR [main][com_liferay_portal_upgrade:97] Invocation to listener threw exception 
          java.lang.RuntimeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.BatchUpdateException: Batch entry 0 update JournalArticleImage set elInstanceId = '1MY7' where articleImageId = '10566' was aborted: ERROR: el operador no existe: bigint = character varying_  Hint: Ningún operador coincide con el nombre y el tipo de los argumentos. Puede ser necesario agregar conversiones explícitas de tipos._  Position: 71  Call getNextException to see other errors in the batch. [Sanitized]
          	at com.liferay.portal.upgrade.internal.release.osgi.commands.ReleaseManagerOSGiCommands$UpgradeInfosRunnable.run(ReleaseManagerOSGiCommands.java:535)
          	at com.liferay.portal.output.stream.container.OutputStreamContainerFactoryTracker.runWithSwappedLog(OutputStreamContainerFactoryTracker.java:100)
          [...]
          	at com.liferay.registry.internal.RegistryImpl.registerService(RegistryImpl.java:355)
          	at com.liferay.portal.tools.DBUpgrader._registerModuleServiceLifecycle(DBUpgrader.java:410)
          	at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:106)
          Caused by: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.BatchUpdateException: Batch entry 0 update JournalArticleImage set elInstanceId = '1MY7' where articleImageId = '10566' was aborted: ERROR: el operador no existe: bigint = character varying_  Hint: Ningún operador coincide con el nombre y el tipo de los argumentos. Puede ser necesario agregar conversiones explícitas de tipos._  Position: 71  Call getNextException to see other errors in the batch. [Sanitized]
          	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:93)
          	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:124)
          	at com.liferay.portal.upgrade.internal.release.osgi.commands.ReleaseManagerOSGiCommands$UpgradeInfosRunnable.run(ReleaseManagerOSGiCommands.java:503)
          	... 78 more
          Caused by: java.sql.BatchUpdateException: Batch entry 0 update JournalArticleImage set elInstanceId = '1MY7' where articleImageId = '10566' was aborted: ERROR: el operador no existe: bigint = character varying_  Hint: Ningún operador coincide con el nombre y el tipo de los argumentos. Puede ser necesario agregar conversiones explícitas de tipos._  Position: 71  Call getNextException to see other errors in the batch. [Sanitized]
          	at org.postgresql.jdbc.BatchResultHandler.handleCompletion(BatchResultHandler.java:166)
          	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:480)
          	at org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:791)
          	at org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1547)
          	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
          	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
          	at com.liferay.portal.kernel.dao.jdbc.AutoBatchPreparedStatementUtil$BatchInvocationHandler.invoke(AutoBatchPreparedStatementUtil.java:112)
          	at com.sun.proxy.$Proxy275.executeBatch(Unknown Source)
          	at com.liferay.journal.internal.upgrade.v1_0_0.UpgradeJournalArticleImage.updateJournalArticleImagesInstanceId(UpgradeJournalArticleImage.java:60)
          	at com.liferay.journal.internal.upgrade.v1_0_0.UpgradeJournalArticleImage.doUpgrade(UpgradeJournalArticleImage.java:33)
          	at com.liferay.portal.kernel.upgrade.UpgradeProcess.upgrade(UpgradeProcess.java:90)
          	... 80 more
          Caused by: org.postgresql.util.PSQLException: ERROR: el operador no existe: bigint = character varying_  Hint: Ningún operador coincide con el nombre y el tipo de los argumentos. Puede ser necesario agregar conversiones explícitas de tipos._  Position: 71 [Sanitized]
          	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2412)
          	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2125)
          	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:469)
          	... 89 more
          

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              raven.song Raven Song
              Reporter:
              jorge.diaz Jorge Diaz
              Participants of an Issue:
              Recent user:
              Marta Elicegui
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 6 weeks, 1 day ago

                  Packages

                  Version Package
                  7.0.0 DXP FP33
                  7.0.0 DXP SP7
                  7.0.5 CE GA6
                  7.0.X
                  7.1.X
                  Master