Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-26825

Handle soft-delete enablement with child name unique constraint

    XMLWordPrintable

    Details

      Description

      When soft-delete is enabled, it can cause an error at startup when document route definitions are imported:

      ERROR [localhost-startStop-1] [org.nuxeo.osgi.OSGiAdapter] Error during Framework Listener execution: class org.nuxeo.runtime.osgi.OSGiRuntimeService org.nuxeo.ecm.core.api.ConcurrentUpdateException: Failed to save session, java.sql.BatchUpdateException: Batch entry 0 INSERT INTO "hierarchy" ("id", "parented", "pos", "name", "isproperty", "primarytype", "mixintypes", "ischeckedin", baseversionid", "majorversion", "minorversion", "isversion", "isretentionactive", systemchangetoken", "changetoken", "isdeleted", "deletedtime") VALUES ('4b6c2ec2-26e6-4ba4-a033-ebb58c50e650', '2e0bb739-c0a4-4468-bc1f-9e5a3150fa3c', NULL, 'ParallelDocumentreview', 'FALSE', 'DocumentRoute', '{"facet-var_ParallelDocumentReview"}', NULL, NULL, 0, 0, NULL, NULL, 0, 0, NULL, NULL) was aborted: ERROR: duplicate key value violates unique constraint "hierarchy_unique_child"
        Detail: Key (parented, name)=(2e0bb739-c0a4-4468-bc1f-9e5a3150fa3c, ParallelDocumentReview) already exists. Call getNextException to see other errors in the batch.
          at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCConnection.checkConcurrentUpdate(JDBCConnection.java:184)
          at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCRowMapper.insertSimpleRows(JDBCRowMapper.java:561)
      ...
          at org.nuxeo.ecm.platform.routing.core.persistence.RouteModelsZipImporter.create(RouteModelsZipImporter.java:97)
      ...
          at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitialtionHandler.java:93) 

      One solution could be not to import document route definitions if they have not changed since the last startup.
      Otherwise a uniqueness constraint could be updated to test the column "isdeleted"

      This applies only to PostgreSQL, which is the only VCS backend having constraints to ensure unique child names.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h