You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "rishabhdaim (via GitHub)" <gi...@apache.org> on 2023/09/04 12:17:13 UTC

[GitHub] [jackrabbit-oak] rishabhdaim commented on a diff in pull request #1090: OAK-8646 : Clean up changes from orphaned branch commits

rishabhdaim commented on code in PR #1090:
URL: https://github.com/apache/jackrabbit-oak/pull/1090#discussion_r1314872222


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java:
##########
@@ -902,6 +905,206 @@ private void collectDeletedProperties(final NodeDocument doc, final GCPhases pha
             }
         }
 
+        private void collectUnmergedBranchCommitDocument(final NodeDocument doc,
+                long toModifiedMillis, final GCPhases phases, final UpdateOp updateOp) {
+            if (!phases.start(GCPhase.DETAILED_GC_COLLECT_UNMERGED_BC)) {
+                // GC was cancelled, stop
+                return;
+            }
+
+            // from
+            // https://jackrabbit.apache.org/oak/docs/nodestore/documentmk.html#previous-documents
+            // "branch commits are not moved to previous documents until the branch is
+            // merged."
+            // i.e. if we're looking for unmerged branch commits, they cannot be in
+            // previous documents, they have to be in the main one - hence we have to use
+            // getLocalBranchCommits here
+            final Set<Revision> localBranchCommits = doc.getLocalBranchCommits();

Review Comment:
   ```suggestion
               final Set<Revision> olderUnmergedBranchCommits = doc.getLocalBranchCommits().stream()
                           .filter(bcRevision -> isRevisionOlderThan(bcRevision, toModifiedMillis))
                           .filter(bcRevision -> !isCommitted(nodeStore.getCommitValue(bcRevision, doc)))
                           .collect(toSet());
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org