You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2026/05/28 09:11:39 UTC

(jackrabbit-oak) branch 1.22 updated: OAK-12166: RDBVersionGC MODE 1 (old method) should leverage SD column… (#2816)

This is an automated email from the ASF dual-hosted git repository.

reschke pushed a commit to branch 1.22
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git


The following commit(s) were added to refs/heads/1.22 by this push:
     new 018fd4c1b1 OAK-12166: RDBVersionGC MODE 1 (old method) should leverage SD column… (#2816)
018fd4c1b1 is described below

commit 018fd4c1b12a8899530f6eea75b5b40efd6d6c47
Author: Julian Reschke <re...@apache.org>
AuthorDate: Thu May 28 11:11:33 2026 +0200

    OAK-12166: RDBVersionGC MODE 1 (old method) should leverage SD column… (#2816)
    
    * OAK-12166: RDBVersionGC MODE 1 (old method) should leverage SD columns when available - testing in 1.22 branch
    
    * OAK-12166: RDBVersionGC MODE 1 (old method) should leverage SD columns when available - testing in 1.22 branch (make it compile)
    
    * OAK-12166: RDBVersionGC MODE 1 (old method) should leverage SD columns when available - testing in 1.22 branch (remove unused parameter)
    
    * OAK-12166: RDBVersionGC MODE 1 (old method) should leverage SD columns when available - testing in 1.22 branch (remove unused parameter)
---
 .../plugins/document/rdb/RDBVersionGCSupport.java    | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java
index 783afbab0b..b7d6fdf365 100644
--- a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java
+++ b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBVersionGCSupport.java
@@ -95,17 +95,27 @@ public class RDBVersionGCSupport extends VersionGCSupport {
         }
     }
 
-    private Iterable<NodeDocument> getSplitDocuments() {
-        List<QueryCondition> conditions = Collections.emptyList();
-        // absent support for SDTYPE as indexed property: exclude those
-        // documents from the query which definitively aren't split documents
+    // MODE==1
+    private Iterable<NodeDocument> getSplitDocuments(final Set<SplitDocType> gcTypes, final long oldestRevTimeStamp) {
+        List<QueryCondition> conditions = new ArrayList<>();
+        if (store.getTable(Collection.NODES).hasSplitDocs()) {
+            // we can add constraints on SDTYPE
+            List<Integer> gcTypeCodes = new ArrayList<>();
+            for (SplitDocType type : gcTypes) {
+                gcTypeCodes.add(type.typeCode());
+            }
+            conditions.add(new QueryCondition(NodeDocument.SD_TYPE, "in", gcTypeCodes));
+            conditions.add(new QueryCondition(NodeDocument.SD_MAX_REV_TIME_IN_SECS, "<=", NodeDocument.getModifiedInSecs(oldestRevTimeStamp)));
+            conditions.add(new QueryCondition(RDBDocumentStore.VERSIONPROP, ">=", 2));
+        }
+        // in any case: exclude those documents from the query which definitively aren't split documents
         List<String> excludeKeyPatterns = Arrays.asList("_:/%", "__:/%", "___:/%");
         return getIterator(excludeKeyPatterns, conditions);
     }
 
     private Iterable<NodeDocument> identifyGarbageMode1(final Set<SplitDocType> gcTypes, final RevisionVector sweepRevs,
             final long oldestRevTimeStamp) {
-        return filter(getSplitDocuments(), getGarbageCheckPredicate(gcTypes, sweepRevs, oldestRevTimeStamp));
+        return filter(getSplitDocuments(gcTypes, oldestRevTimeStamp), getGarbageCheckPredicate(gcTypes, sweepRevs, oldestRevTimeStamp));
     }
 
     private Predicate<NodeDocument> getGarbageCheckPredicate(final Set<SplitDocType> gcTypes, final RevisionVector sweepRevs,