This is an automated email from the ASF dual-hosted git repository. joscorbe pushed a commit to branch wip-fullgc-query-speedup in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
commit 36f9eec4d5c5f32fd4ea053997a4d7f393320188 Author: Jose Cordero <[email protected]> AuthorDate: Wed Feb 12 15:51:08 2025 +0100 WIP: Reduce number of traversed documents on first iterations of FullGC. --- .../oak/plugins/document/mongo/MongoVersionGCSupport.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 1d6e535d78..0d7fdba92a 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 @@ -251,8 +251,16 @@ public class MongoVersionGCSupport extends VersionGCSupport { public Iterable<NodeDocument> getModifiedDocs(final long fromModified, final long toModified, final int limit, @NotNull final String fromId, @NotNull Set<String> includedPathPrefixes, @NotNull Set<String> excludedPathPrefixes) { + long toModifiedRestricted = toModified; + // Query a maximum of 24h of data to speed up the query on Mongo side + if (toModified - fromModified > TimeUnit.DAYS.toMillis(1)) { + LOG.debug("getModifiedDocs() <- fromModified: {}, toModified: {} - too large range, limiting to 24h", + fromModified, toModified); + toModifiedRestricted = fromModified + TimeUnit.DAYS.toMillis(1); + } + LOG.info("getModifiedDocs fromModified: {}, toModified: {}, limit: {}, fromId: {}, includedPathPrefixes: {}, excludedPathPrefixes: {}", - fromModified, toModified, limit, fromId, includedPathPrefixes, excludedPathPrefixes); + fromModified, toModifiedRestricted, limit, fromId, includedPathPrefixes, excludedPathPrefixes); final long fromModifiedQuery; if (MIN_ID_VALUE.equals(fromId)) { @@ -268,7 +276,7 @@ public class MongoVersionGCSupport extends VersionGCSupport { withIncludeExcludes(includedPathPrefixes, excludedPathPrefixes, and(eq(MODIFIED_IN_SECS, fromModifiedQuery), gt(ID, fromId))), withIncludeExcludes(includedPathPrefixes, excludedPathPrefixes, - and(gt(MODIFIED_IN_SECS, fromModifiedQuery), lt(MODIFIED_IN_SECS, getModifiedInSecs(toModified))))); + and(gt(MODIFIED_IN_SECS, fromModifiedQuery), lt(MODIFIED_IN_SECS, getModifiedInSecs(toModifiedRestricted))))); // first sort by _modified and then by _id final Bson sort = ascending(MODIFIED_IN_SECS, ID);
