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

With UUID_ not being provided when inserting into DLFileVersion, it will fail with unique constraint on IX_C99B2650 sometimes

    Details

    • Branch Version/s:
      6.2.x
    • Backported to Branch:
      Committed
    • Story Points:
      8

      Description

      Reproduction steps
      1. Connect Liferay 6.1 GA2 with Oracle DB.
      2. Post two or more threads with attachment in Message Board Portlet
      3. Copy the document_library folder to 6.2.10 bundle.
      4. Set verify.processes= in portal-ext for 6.2.10 to bypass the verification process
      5. Start the server and upgrade

      Issue
      The issue persists in trunk. We will get the following messages when we use Oracle Database:
      09:05:43,677 WARN [localhost-startStop-1][BaseUpgradeAttachments:174] Unable to add file version 1.0 for file entry IMG_3088.JPG
      java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (LPORTALTEST.IX_C99B2650) violated_ [Sanitized]

      Error and Logs
      The full log is attached.

      Analysis
      Failed Query Report SQL=insert into DLFileVersion (fileVersionId, groupId, companyId, userId, userName, createDate, modifiedDate, repositoryId, folderId, fileEntryId, extension, mimeType, title, description, changeLog, extraSettings, fileEntryTypeId, version, size_, status, statusByUserId, statusByUserName, statusDate) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

      We have defined IX_C99B2650 as unique one:
      create unique index IX_C99B2650 on DLFileVersion (uuid_, groupId);

      With UUID_ not being provided, it will be set to NULL for the first entry for a groupid and fail with a unique constraint for all other insert attempts in this method.

      So we can consider modify com.liferay.portal.kernel.upgrade.v6_2_0.BaseUpgradeAttachments.addDLFileVersion line 138, 140 and 169 as:
      Line 138: sb.append("status, statusByUserId, statusByUserName, statusDate, uuid_) ");
      Line 140: sb.append("?, ?, ?, ?, ?, ?, ?, ?, ?)");
      Line 169: ps.setString(24, PortalUUIDUtil.generate());

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 27 weeks, 2 days ago