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

Fix removal of 'aceinfo' directory entries when a document is deleted

    XMLWordPrintable

    Details

    • Release Notes Summary:
      Collect orphan aceinfo entries after document deletion
    • Release Notes Description:
      Hide

      A garbage collector cleans the aceinfo directory when a document is deleted.

      This is done in transaction, asynchronously.
      To do so, an index has been added to the aceinfo schema, on the property `docId` on MongoDB for new instances.

      On existing nuxeo instances, an index referencing the docId in the aceinfo collection/table needs to be added to identify garbage aceinfo and remove them.

      Show
      A garbage collector cleans the aceinfo directory when a document is deleted. This is done in transaction, asynchronously. To do so, an index has been added to the aceinfo schema, on the property `docId` on MongoDB for new instances. On existing nuxeo instances, an index referencing the docId in the aceinfo collection/table needs to be added to identify garbage aceinfo and remove them.
    • Backlog priority:
      750
    • Upgrade notes:
      Hide

      For existing instances on MongoDB, in order to improve performance on ace info removal the following index needs to be created manually:

      db.aceinfo.createIndex({"aceinfo:docId": 1})  

      Then enable ace info garbage collection by adding the following line to your nuxeo.conf:

      nuxeo.aceinfo.gc.enabled=true 

      VCS users will need to make their own index.

      Show
      For existing instances on MongoDB, in order to improve performance on ace info removal the following index needs to be created manually: db.aceinfo.createIndex({ "aceinfo:docId" : 1})   Then enable ace info garbage collection by adding the following line to your nuxeo.conf: nuxeo.aceinfo.gc.enabled= true VCS users will need to make their own index.
    • Sprint:
      nxplatform #77, nxplatform #78, nxplatform #85, nxplatform #86
    • Story Points:
      5

      Description

      When a document is permanently deleted, the corresponding entries in directory aceinfo are not deleted.

      How to reproduce:

      • create a document
      • create a local permission on the document (see an entry is created in directory aceinfo)
      • permanenty delete the document

      Expected result: the corresponding entry in directory aceinfo is deleted
      Actual result: the corresponding entry in directory aceinfo is NOT deleted

      Here is the diff of a unit test showing this behavior:

      issions/src/test/java/org/nuxeo/ecm/permissions/TestPermissionListener.java
      index c751bf20e73..70a826fa18e 100644
      --- a/nuxeo-services/nuxeo-permissions/src/test/java/org/nuxeo/ecm/permissions/TestPermissionListener.java
      +++ b/nuxeo-services/nuxeo-permissions/src/test/java/org/nuxeo/ecm/permissions/TestPermissionListener.java
      @@ -193,6 +193,39 @@ public class TestPermissionListener {
               }
           }
       
      +    @Test
      +    public void shouldUpdateDirectoryOnDocumentDelete() {
      +        DocumentModel doc = createTestDocument();
      +
      +        ACP acp = doc.getACP();
      +        ACL acl = acp.getOrCreateACL();
      +        ACE fryACE = new ACE("fry", WRITE, true);
      +        fryACE.putContextData(NOTIFY_KEY, true);
      +        fryACE.putContextData(COMMENT_KEY, "fry comment");
      +        ACE leelaACE = new ACE("leela", READ, true);
      +        acl.add(fryACE);
      +        acl.add(leelaACE);
      +        acp.addACL(acl);
      +        doc.setACP(acp, true);
      +
      +        try (Session session = directoryService.open(ACE_INFO_DIRECTORY)) {
      +            Map<String, Serializable> filter = new HashMap<>();
      +            filter.put("docId", doc.getId());
      +            DocumentModelList entries = session.query(filter);
      +            assertEquals(2, entries.size());
      +
      +        }
      +        String docId = doc.getId();
      +        session.removeDocument(doc.getRef());
      +        try (Session session = directoryService.open(ACE_INFO_DIRECTORY)) {
      +            Map<String, Serializable> filter = new HashMap<>();
      +            filter.put("docId", docId);
      +            DocumentModelList entries = session.query(filter);
      +            assertEquals(0, entries.size());
      +
      +        }
      +    }
      +
           @Test
           public void shouldStoreNotifyAndComment() {
               DocumentModel doc = createTestDocument();
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: