averma21 commented on a change in pull request #450:
URL: https://github.com/apache/jackrabbit-oak/pull/450#discussion_r783913338



##########
File path: 
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentTraverser.java
##########
@@ -33,18 +35,73 @@
 import org.apache.jackrabbit.oak.plugins.document.util.CloseableIterable;
 import org.bson.BsonDocument;
 import org.bson.BsonInt64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static com.google.common.base.Preconditions.checkState;
 
 public class MongoDocumentTraverser {
+    private static final Logger LOG = 
LoggerFactory.getLogger(MongoDocumentTraverser.class);
     private final MongoDocumentStore mongoStore;
     private boolean disableReadOnlyCheck;
 
+    public static class TraversingRange {
+
+        private final LastModifiedRange lastModifiedRange;
+        /**
+         * could be null to indicate start from first document in the 
lastModifiedRange
+         */
+        private final String startAfterDocumentID;
+
+        public TraversingRange(LastModifiedRange lastModifiedRange, String 
startAfterDocumentID) {
+            this.lastModifiedRange = lastModifiedRange;
+            this.startAfterDocumentID = startAfterDocumentID;
+        }
+
+        public boolean coversAllDocuments() {
+            return lastModifiedRange.coversAllDocuments() && 
startAfterDocumentID == null;
+        }
+
+        public LastModifiedRange getLastModifiedRange() {
+            return lastModifiedRange;
+        }
+
+        private BsonDocument getFindQuery() {
+            String lastModifiedRangeQueryPart = "{$gte:" + 
lastModifiedRange.getLastModifiedFrom() + ",";
+            lastModifiedRangeQueryPart += "$lt:" + 
lastModifiedRange.getLastModifiedTo() + "}";
+            String idRangeQueryPart = "";
+            if (startAfterDocumentID != null) {
+                String condition = "{$gt:\"" + startAfterDocumentID + "\"}";

Review comment:
       And, to overcome the problem we create two tasks as mentioned in 
documentation of MultithreadedTraverseWithSortStrategy :)




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to