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

daim pushed a commit to branch DetailedGC/OAK-10199
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit 205e64a446f4eec4c89392c80327f6b56cd233ac
Author: Rishabh Kumar <d...@adobe.com>
AuthorDate: Fri Jul 28 17:14:15 2023 +0530

    OAK-10199 : added review comment to make minor adjustment for naming 
conventions and fixes
---
 .../oak/plugins/document/NodeDocument.java         |  7 +-
 .../plugins/document/VersionGCRecommendations.java | 17 ++---
 .../oak/plugins/document/VersionGCSupport.java     | 11 ++-
 .../plugins/document/VersionGarbageCollector.java  | 80 ++++++++++++----------
 .../document/mongo/MongoVersionGCSupport.java      |  7 +-
 .../plugins/document/rdb/RDBVersionGCSupport.java  |  4 +-
 .../document/VersionGarbageCollectorIT.java        | 10 +--
 7 files changed, 73 insertions(+), 63 deletions(-)

diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
index 66a1bc2eae..38673aa7e7 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/NodeDocument.java
@@ -1672,7 +1672,12 @@ public final class NodeDocument extends Document {
 
     /**
      * Returns name of all the properties on this document
-     * @return Set of all property names
+     * <p>
+     *  Note: property names returned are escaped
+     * <p/>
+     * @return Set of all property names (escaped)
+     * @see Utils#unescapePropertyName(String)
+     * @see Utils#escapePropertyName(String)
      */
     @NotNull
     Set<String> getPropertyNames() {
diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCRecommendations.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCRecommendations.java
index 2092844299..05ebaa44a9 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCRecommendations.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCRecommendations.java
@@ -54,7 +54,7 @@ public class VersionGCRecommendations {
     private final GCMonitor gcmon;
 
     final boolean ignoreDueToCheckPoint;
-    final boolean ignoreDetailGCDueToCheckPoint;
+    final boolean ignoreDetailedGCDueToCheckPoint;
     final TimeInterval scope;
     final TimeInterval scopeDetailedGC;
     final long maxCollect;
@@ -94,7 +94,7 @@ public class VersionGCRecommendations {
     public VersionGCRecommendations(long maxRevisionAgeMs, Checkpoints 
checkpoints, Clock clock, VersionGCSupport vgc,
                                     VersionGCOptions options, GCMonitor 
gcMonitor, final boolean detailedGCEnabled) {
         boolean ignoreDueToCheckPoint = false;
-        boolean ignoreDetailGCDueToCheckPoint = false;
+        boolean ignoreDetailedGCDueToCheckPoint = false;
         long deletedOnceCount = 0;
         long suggestedIntervalMs;
         long oldestPossible;
@@ -176,13 +176,13 @@ public class VersionGCRecommendations {
         //Check for any registered checkpoint which prevent the GC from running
         Revision checkpoint = checkpoints.getOldestRevisionToKeep();
 
-        final GCResult gcResult = getResult(options, ignoreDueToCheckPoint, 
scope, checkpoint);
+        final GCResult gcResult = getResult(options, checkpoint, scope);
         scope = gcResult.gcScope;
         ignoreDueToCheckPoint = gcResult.ignoreGC;
 
-        final GCResult detailGCResult = getResult(options, 
ignoreDetailGCDueToCheckPoint, scopeDetailedGC, checkpoint);
+        final GCResult detailGCResult = getResult(options, checkpoint, 
scopeDetailedGC);
         scopeDetailedGC = detailGCResult.gcScope;
-        ignoreDetailGCDueToCheckPoint = detailGCResult.ignoreGC;
+        ignoreDetailedGCDueToCheckPoint = detailGCResult.ignoreGC;
 
         if (scope.getDurationMs() <= options.precisionMs) {
             // If we have narrowed the collect time interval down as much as 
we can, no
@@ -194,7 +194,7 @@ public class VersionGCRecommendations {
         this.precisionMs = options.precisionMs;
         this.ignoreDueToCheckPoint = ignoreDueToCheckPoint;
         this.scope = scope;
-        this.ignoreDetailGCDueToCheckPoint = ignoreDetailGCDueToCheckPoint;
+        this.ignoreDetailedGCDueToCheckPoint = ignoreDetailedGCDueToCheckPoint;
         this.scopeDetailedGC = scopeDetailedGC;
         this.detailedGCId = oldestModifiedDocId;
         this.scopeIsComplete = scope.toMs >= keep.fromMs;
@@ -251,7 +251,7 @@ public class VersionGCRecommendations {
         }
 
         // save data for detailed GC
-        if (detailedGCEnabled && !stats.canceled && 
!stats.ignoredDetailGCDueToCheckPoint) {
+        if (detailedGCEnabled && !stats.canceled && 
!stats.ignoredDetailedGCDueToCheckPoint) {
             // success, we would not expect to encounter revisions older than 
this in the future
             setLongSetting(SETTINGS_COLLECTION_DETAILED_GC_TIMESTAMP_PROP, 
stats.oldestModifiedDocTimeStamp);
             setStringSetting(SETTINGS_COLLECTION_DETAILED_GC_DOCUMENT_ID_PROP, 
stats.oldestModifiedDocId);
@@ -297,7 +297,8 @@ public class VersionGCRecommendations {
     }
 
     @NotNull
-    private static GCResult getResult(VersionGCOptions options, boolean 
ignoreGC, TimeInterval gcScope, Revision checkpoint) {
+    private static GCResult getResult(final VersionGCOptions options, final 
Revision checkpoint, TimeInterval gcScope) {
+        boolean ignoreGC = false;
         if (checkpoint != null && 
gcScope.endsAfter(checkpoint.getTimestamp())) {
             TimeInterval minimalScope = 
gcScope.startAndDuration(options.precisionMs);
             if (minimalScope.endsAfter(checkpoint.getTimestamp())) {
diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
index 1e19eb6af7..ab7789f920 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGCSupport.java
@@ -209,20 +209,19 @@ public class VersionGCSupport {
      * @return the oldest modified document.
      */
     public Optional<NodeDocument> getOldestModifiedDoc(final Clock clock) {
-        long ts = 0;
         long now = clock.getTime();
         Iterable<NodeDocument> docs = null;
-
-        LOG.info("find oldest modified document");
         try {
-            docs = getModifiedDocs(ts, now, 1, MIN_ID_VALUE);
+            docs = getModifiedDocs(0, now, 1, MIN_ID_VALUE);
             if (docs.iterator().hasNext()) {
-                return ofNullable(docs.iterator().next());
+                final NodeDocument oldestModifiedDoc = docs.iterator().next();
+                LOG.info("Oldest modified document is {}", oldestModifiedDoc);
+                return ofNullable(oldestModifiedDoc);
             }
         } finally {
             Utils.closeIfCloseable(docs);
         }
-        LOG.info("find oldest modified document to be {}", 
Utils.timestampToString(ts));
+        LOG.info("No Modified Doc has been found, retuning empty");
         return empty();
     }
 
diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
index 766c8e4cc5..f2a334b75b 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollector.java
@@ -66,6 +66,7 @@ import static java.util.concurrent.TimeUnit.SECONDS;
 import static java.util.stream.Collectors.joining;
 import static java.util.stream.Collectors.toSet;
 import static 
org.apache.jackrabbit.guava.common.base.StandardSystemProperty.LINE_SEPARATOR;
+import static 
org.apache.jackrabbit.guava.common.base.Stopwatch.createUnstarted;
 import static org.apache.jackrabbit.guava.common.collect.Iterables.all;
 import static org.apache.jackrabbit.guava.common.collect.Iterators.partition;
 import static 
org.apache.jackrabbit.guava.common.util.concurrent.Atomics.newReference;
@@ -85,6 +86,7 @@ public class VersionGarbageCollector {
     private static final int DELETE_BATCH_SIZE = 450;
     private static final int UPDATE_BATCH_SIZE = 450;
     private static final int PROGRESS_BATCH_SIZE = 10000;
+    private static final int DETAILED_GC_BATCH_SIZE = 1000;
     private static final String STATUS_IDLE = "IDLE";
     private static final String STATUS_INITIALIZING = "INITIALIZING";
     private static final Logger log = 
LoggerFactory.getLogger(VersionGarbageCollector.class);
@@ -270,7 +272,7 @@ public class VersionGarbageCollector {
 
     public static class VersionGCStats {
         boolean ignoredGCDueToCheckPoint;
-        boolean ignoredDetailGCDueToCheckPoint;
+        boolean ignoredDetailedGCDueToCheckPoint;
         boolean canceled;
         boolean success = true;
         boolean limitExceeded;
@@ -348,7 +350,7 @@ public class VersionGarbageCollector {
 
             return "VersionGCStats{" +
                     "ignoredGCDueToCheckPoint=" + ignoredGCDueToCheckPoint +
-                    "ignoredDetailGCDueToCheckPoint=" + 
ignoredDetailGCDueToCheckPoint +
+                    "ignoredDetailedGCDueToCheckPoint=" + 
ignoredDetailedGCDueToCheckPoint +
                     ", canceled=" + canceled +
                     ", deletedDocGCCount=" + deletedDocGCCount + " (of which 
leaf: " + deletedLeafDocGCCount + ")" +
                     ", updateResurrectedGCCount=" + updateResurrectedGCCount +
@@ -366,7 +368,7 @@ public class VersionGarbageCollector {
         void addRun(VersionGCStats run) {
             ++iterationCount;
             this.ignoredGCDueToCheckPoint = run.ignoredGCDueToCheckPoint;
-            this.ignoredDetailGCDueToCheckPoint = 
run.ignoredDetailGCDueToCheckPoint;
+            this.ignoredDetailedGCDueToCheckPoint = 
run.ignoredDetailedGCDueToCheckPoint;
             this.canceled = run.canceled;
             this.success = run.success;
             this.limitExceeded = run.limitExceeded;
@@ -422,9 +424,9 @@ public class VersionGarbageCollector {
         SORTING,
         SPLITS_CLEANUP,
         DETAILED_GC,
-        COLLECT_PROPS,
-        COLLECT_OLD_REVS,
-        COLLECT_UNMERGED_BC,
+        DETAILED_GC_COLLECT_PROPS,
+        DETAILED_GC_COLLECT_OLD_REVS,
+        DETAILED_GC_COLLECT_UNMERGED_BC,
         DETAILED_GC_CLEANUP,
         UPDATING
     }
@@ -455,9 +457,9 @@ public class VersionGarbageCollector {
             this.watches.put(GCPhase.SPLITS_CLEANUP, 
stats.collectAndDeleteSplitDocs);
             this.watches.put(GCPhase.UPDATING, 
stats.updateResurrectedDocuments);
             this.watches.put(GCPhase.DETAILED_GC, stats.detailedGCDocs);
-            this.watches.put(GCPhase.COLLECT_PROPS, stats.collectDeletedProps);
-            this.watches.put(GCPhase.COLLECT_OLD_REVS, 
stats.collectDeletedOldRevs);
-            this.watches.put(GCPhase.COLLECT_UNMERGED_BC, 
stats.collectUnmergedBC);
+            this.watches.put(GCPhase.DETAILED_GC_COLLECT_PROPS, 
stats.collectDeletedProps);
+            this.watches.put(GCPhase.DETAILED_GC_COLLECT_OLD_REVS, 
stats.collectDeletedOldRevs);
+            this.watches.put(GCPhase.DETAILED_GC_COLLECT_UNMERGED_BC, 
stats.collectUnmergedBC);
             this.watches.put(GCPhase.DETAILED_GC_CLEANUP, 
stats.deleteDetailedGCDocs);
             this.canceled = canceled;
         }
@@ -584,8 +586,8 @@ public class VersionGarbageCollector {
 
                 // now run detailed GC if enabled
                 if (detailedGCEnabled) {
-                    if (rec.ignoreDetailGCDueToCheckPoint) {
-                        phases.stats.ignoredDetailGCDueToCheckPoint = true;
+                    if (rec.ignoreDetailedGCDueToCheckPoint) {
+                        phases.stats.ignoredDetailedGCDueToCheckPoint = true;
                         monitor.skipped("Checkpoint prevented detailed 
revision garbage collection");
                     } else {
                         final RevisionVector headRevision = 
nodeStore.getHeadRevision();
@@ -594,9 +596,7 @@ public class VersionGarbageCollector {
                     }
                 }
 
-                if (detailedGCEnabled && rec.ignoreDueToCheckPoint && 
rec.ignoreDetailGCDueToCheckPoint) {
-                    cancel.set(true);
-                } else if (!detailedGCEnabled && rec.ignoreDueToCheckPoint) {
+                if ((detailedGCEnabled && rec.ignoreDetailedGCDueToCheckPoint) 
|| rec.ignoreDueToCheckPoint) {
                     cancel.set(true);
                 }
 
@@ -615,14 +615,14 @@ public class VersionGarbageCollector {
         }
 
         /**
-         * "Detail garbage" refers to additional garbage identified as part of 
OAK-10199
+         * "Detailed garbage" refers to additional garbage identified as part 
of OAK-10199
          * et al: essentially garbage that in earlier versions of Oak were 
ignored. This
          * includes: deleted properties, revision information within 
documents, branch
          * commit related garbage.
          * <p/>
          * TODO: limit this to run only on a singleton instance, eg the 
cluster leader
          * <p/>
-         * The "detail garbage" collector can be instructed to do a full 
repository scan
+         * The "detailed garbage" collector can be instructed to do a full 
repository scan
          * - or incrementally based on where it last left off. When doing a 
full
          * repository scan (but not limited to that), it executes in (small) 
batches
          * followed by voluntary paused (aka throttling) to avoid excessive 
load on the
@@ -635,22 +635,25 @@ public class VersionGarbageCollector {
          */
         private void collectDetailedGarbage(final GCPhases phases, final 
RevisionVector headRevision, final VersionGCRecommendations rec)
                 throws IOException {
+
+            final long oldestModifiedMs = rec.scopeDetailedGC.fromMs;
+            final long toModifiedMs = rec.scopeDetailedGC.toMs;
+            final String oldestModifiedDocId = rec.detailedGCId;
+
             int docsTraversed = 0;
             boolean foundDoc = true;
-            final long oldestModifiedMs = rec.scopeDetailedGC.fromMs;
-            final long toModified = rec.scopeDetailedGC.toMs;
             long oldModifiedMs = oldestModifiedMs;
-            final String oldestModifiedDocId = rec.detailedGCId;
+
             try (DetailedGC gc = new DetailedGC(headRevision, monitor, 
cancel)) {
                 long fromModified = oldestModifiedMs;
                 String fromId = 
ofNullable(oldestModifiedDocId).orElse(MIN_ID_VALUE);
                 NodeDocument lastDoc;
                 if (phases.start(GCPhase.DETAILED_GC)) {
-                    while (foundDoc && fromModified < toModified && 
docsTraversed < PROGRESS_BATCH_SIZE) {
+                    while (foundDoc && fromModified < toModifiedMs && 
docsTraversed < PROGRESS_BATCH_SIZE) {
                         // set foundDoc to false to allow exiting the while 
loop
                         foundDoc = false;
                         lastDoc = null;
-                        Iterable<NodeDocument> itr = 
versionStore.getModifiedDocs(fromModified, toModified, 1000, fromId);
+                        Iterable<NodeDocument> itr = 
versionStore.getModifiedDocs(fromModified, toModifiedMs, 
DETAILED_GC_BATCH_SIZE, fromId);
                         try {
                             for (NodeDocument doc : itr) {
                                 foundDoc = true;
@@ -662,7 +665,7 @@ public class VersionGarbageCollector {
                                 }
                                 docsTraversed++;
                                 if (docsTraversed % 100 == 0) {
-                                    monitor.info("Iterated through {} 
documents so far. {} had detail garbage",
+                                    monitor.info("Iterated through {} 
documents so far. {} had detailed garbage",
                                             docsTraversed, 
gc.getGarbageDocsCount());
                                 }
 
@@ -675,12 +678,12 @@ public class VersionGarbageCollector {
 
                                 final Long modified = lastDoc.getModified();
                                 if (modified == null) {
-                                    monitor.warn("collectDetailGarbage : 
document has no _modified property : {}",
+                                    monitor.warn("collectDetailedGarbage : 
document has no _modified property : {}",
                                             doc.getId());
-                                } else if (SECONDS.toMillis(modified) < 
oldestModifiedMs) {
+                                } else if (SECONDS.toMillis(modified) < 
fromModified) {
                                     monitor.warn(
-                                            "collectDetailGarbage : document 
has older _modified than query boundary : {} (from: {}, to: {})",
-                                            modified, fromModified, 
toModified);
+                                            "collectDetailedGarbage : document 
has older _modified than query boundary : {} (from: {}, to: {})",
+                                            modified, fromModified, 
toModifiedMs);
                                 }
                             }
                             // now remove the garbage in one go, if any
@@ -721,7 +724,7 @@ public class VersionGarbageCollector {
                 if (docsTraversed < PROGRESS_BATCH_SIZE) {
                     // we have traversed all the docs within given time range 
and nothing is left
                     // lets set oldModifiedDocTimeStamp to upper limit of this 
cycle
-                    phases.stats.oldestModifiedDocTimeStamp = toModified;
+                    phases.stats.oldestModifiedDocTimeStamp = toModifiedMs;
                     phases.stats.oldestModifiedDocId = MIN_ID_VALUE;
                 }
             }
@@ -826,6 +829,7 @@ public class VersionGarbageCollector {
 
         private final Map<String, Integer> deletedPropsCountMap;
         private int garbageDocsCount;
+        private int totalGarbageDocsCount;
 
         public DetailedGC(@NotNull RevisionVector headRevision, @NotNull 
GCMonitor monitor, @NotNull AtomicBoolean cancel) {
             this.headRevision = requireNonNull(headRevision);
@@ -833,7 +837,7 @@ public class VersionGarbageCollector {
             this.cancel = cancel;
             this.updateOpList = new ArrayList<>();
             this.deletedPropsCountMap = new HashMap<>();
-            this.timer = Stopwatch.createUnstarted();
+            this.timer = createUnstarted();
         }
 
         public void collectGarbage(final NodeDocument doc, final GCPhases 
phases) {
@@ -849,6 +853,7 @@ public class VersionGarbageCollector {
             // only add if there are changes for this doc
             if (op.hasChanges()) {
                 garbageDocsCount++;
+                totalGarbageDocsCount++;
                 monitor.info("Collected [{}] garbage for doc [{}]", 
op.getChanges().size(), doc.getId());
                 updateOpList.add(op);
             }
@@ -859,9 +864,9 @@ public class VersionGarbageCollector {
         }
 
         private void collectUnmergedBranchCommitDocument(final NodeDocument 
doc, final GCPhases phases, final UpdateOp updateOp) {
-            if (phases.start(GCPhase.COLLECT_UNMERGED_BC)){
+            if (phases.start(GCPhase.DETAILED_GC_COLLECT_UNMERGED_BC)){
                 // TODO add umerged BC collection logic
-                phases.stop(GCPhase.COLLECT_UNMERGED_BC);
+                phases.stop(GCPhase.DETAILED_GC_COLLECT_UNMERGED_BC);
             }
 
         }
@@ -869,7 +874,7 @@ public class VersionGarbageCollector {
         private void collectDeletedProperties(final NodeDocument doc, final 
GCPhases phases, final UpdateOp updateOp) {
 
             // get Map of all properties along with their values
-            if (phases.start(GCPhase.COLLECT_PROPS)) {
+            if (phases.start(GCPhase.DETAILED_GC_COLLECT_PROPS)) {
                 final Set<String> properties = doc.getPropertyNames();
 
                 // find all the properties which can be removed from document.
@@ -893,26 +898,26 @@ public class VersionGarbageCollector {
                 if (log.isDebugEnabled()) {
                     log.debug("Collected {} deleted properties for document 
{}", deletedPropsGCCount, doc.getId());
                 }
-                phases.stop(GCPhase.COLLECT_PROPS);
+                phases.stop(GCPhase.DETAILED_GC_COLLECT_PROPS);
             }
         }
 
         private void collectOldRevisions(NodeDocument doc, GCPhases phases, 
UpdateOp updateOp) {
 
-            if (phases.start(GCPhase.COLLECT_OLD_REVS)){
+            if (phases.start(GCPhase.DETAILED_GC_COLLECT_OLD_REVS)){
                 // TODO add old rev collection logic
-                phases.stop(GCPhase.COLLECT_OLD_REVS);
+                phases.stop(GCPhase.DETAILED_GC_COLLECT_OLD_REVS);
             }
 
         }
 
         int getGarbageDocsCount() {
-            return garbageDocsCount;
+            return totalGarbageDocsCount;
         }
 
         @Override
-        public void close() throws IOException {
-
+        public void close() {
+            totalGarbageDocsCount = 0;
         }
 
         public void removeGarbage(final VersionGCStats stats) {
@@ -948,6 +953,7 @@ public class VersionGarbageCollector {
                 log.info("Updated [{}] documents, deleted [{}] properties", 
updatedDocs, deletedProps);
                 // now reset delete metadata
                 updateOpList.clear();
+                deletedPropsCountMap.clear();
                 garbageDocsCount = 0;
             } finally {
                 delayOnModifications(timer.stop().elapsed(MILLISECONDS), 
cancel);
diff --git 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
index 6637afa4aa..1f6d4bf5f5 100644
--- 
a/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
+++ 
b/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoVersionGCSupport.java
@@ -141,8 +141,8 @@ public class MongoVersionGCSupport extends VersionGCSupport 
{
      * then perform the comparison.
      * <p/>
      *
-     * @param fromModified the lower bound modified timestamp (inclusive)
-     * @param toModified   the upper bound modified timestamp (exclusive)
+     * @param fromModified the lower bound modified timestamp in millis 
(inclusive)
+     * @param toModified   the upper bound modified timestamp in millis 
(exclusive)
      * @param limit        the limit of documents to return
      * @param fromId       the lower bound {@link NodeDocument#ID}
      * @return matching documents.
@@ -246,8 +246,6 @@ public class MongoVersionGCSupport extends VersionGCSupport 
{
      */
     @Override
     public Optional<NodeDocument> getOldestModifiedDoc(final Clock clock) {
-        LOG.info("getOldestModifiedDoc() <- start");
-
         final Bson sort = and(eq(MODIFIED_IN_SECS, 1), eq(ID, 1));
 
         // we need to add query condition to ignore `previous` documents which 
doesn't have this field
@@ -260,6 +258,7 @@ public class MongoVersionGCSupport extends VersionGCSupport 
{
         } catch (Exception ex) {
             LOG.error("getOldestModifiedDoc() <- error while fetching data 
from Mongo", ex);
         }
+        LOG.info("No Modified Doc has been found, retuning empty");
         return empty();
     }
 
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 5e66bd974d..5082422109 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
@@ -330,16 +330,16 @@ public class RDBVersionGCSupport extends VersionGCSupport 
{
     @Override
     public Optional<NodeDocument> getOldestModifiedDoc(Clock clock) {
 
-        LOG.info("getOldestModifiedDoc() <- start");
         Iterable<NodeDocument> modifiedDocs = null;
         try {
             modifiedDocs = getModifiedDocs(0L, clock.getTime(), 1, 
MIN_ID_VALUE);
             return modifiedDocs.iterator().hasNext() ? 
ofNullable(modifiedDocs.iterator().next()) : empty();
         } catch (DocumentStoreException ex) {
-            LOG.error("getOldestModifiedDoc()", ex);
+            LOG.error("getOldestModifiedDoc() <- Error ", ex);
         } finally {
             closeIfCloseable(modifiedDocs);
         }
+        LOG.info("No Modified Doc has been found, retuning empty");
         return empty();
     }
 
diff --git 
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
 
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
index df785878b3..4e5360e2c3 100644
--- 
a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
+++ 
b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/VersionGarbageCollectorIT.java
@@ -172,14 +172,14 @@ public class VersionGarbageCollectorIT {
         clock.waitUntil(cp.getTimestamp() + expiryTime - maxAge);
         VersionGCStats stats = gc.gc(maxAge, TimeUnit.MILLISECONDS);
         assertTrue(stats.ignoredGCDueToCheckPoint);
-        assertFalse(stats.ignoredDetailGCDueToCheckPoint);
+        assertFalse(stats.ignoredDetailedGCDueToCheckPoint);
         assertTrue(stats.canceled);
 
         //Fast forward time to future such that checkpoint get expired
         clock.waitUntil(clock.getTime() + expiryTime + 1);
         stats = gc.gc(maxAge, TimeUnit.MILLISECONDS);
         assertFalse("GC should be performed", stats.ignoredGCDueToCheckPoint);
-        assertFalse("Detailed GC shouldn't be performed", 
stats.ignoredDetailGCDueToCheckPoint);
+        assertFalse("Detailed GC shouldn't be performed", 
stats.ignoredDetailedGCDueToCheckPoint);
         assertFalse(stats.canceled);
     }
 
@@ -258,13 +258,13 @@ public class VersionGarbageCollectorIT {
         //Fast forward time to future but before expiry of checkpoint
         clock.waitUntil(cp.getTimestamp() + expiryTime - maxAge);
         VersionGCStats stats = gc.gc(maxAge, TimeUnit.MILLISECONDS);
-        assertTrue(stats.ignoredDetailGCDueToCheckPoint);
+        assertTrue(stats.ignoredDetailedGCDueToCheckPoint);
         assertTrue(stats.canceled);
 
         //Fast forward time to future such that checkpoint get expired
         clock.waitUntil(clock.getTime() + expiryTime + 1);
         stats = gc.gc(maxAge, TimeUnit.MILLISECONDS);
-        assertFalse("Detailed GC should be performed", 
stats.ignoredDetailGCDueToCheckPoint);
+        assertFalse("Detailed GC should be performed", 
stats.ignoredDetailedGCDueToCheckPoint);
         assertFalse(stats.canceled);
     }
 
@@ -315,7 +315,7 @@ public class VersionGarbageCollectorIT {
         assertEquals(1, stats.deletedPropsGCCount);
         assertEquals(1, stats.updatedDetailedGCDocsCount);
         assertTrue(stats.ignoredGCDueToCheckPoint);
-        assertFalse(stats.ignoredDetailGCDueToCheckPoint);
+        assertFalse(stats.ignoredDetailedGCDueToCheckPoint);
         assertFalse(stats.canceled);
     }
 

Reply via email to