You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2021/08/05 12:47:29 UTC

[GitHub] [jackrabbit-oak] thomasmueller commented on a change in pull request #338: OAK-9524: Retry failed data download (resuming from the point it stop…

thomasmueller commented on a change in pull request #338:
URL: https://github.com/apache/jackrabbit-oak/pull/338#discussion_r683408441



##########
File path: oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/CompositeException.java
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.jackrabbit.oak.index.indexer.document;
+
+import org.slf4j.Logger;
+
+public class CompositeException extends Exception {

Review comment:
       What would happen if we also implement "Throwable[] getSuppressed​()" to return the (array of) collectedThrowables? That way it would be more generally useful (I think). I'm not saying this class should be moved to oak-commons right now... also I would still implement the logAllExceptions method, as it looks useful.

##########
File path: oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/DocumentStoreIndexerBase.java
##########
@@ -133,6 +135,52 @@ public NodeStateEntryTraverser create(LastModifiedRange lastModifiedRange) {
         }
     }
 
+    private FlatFileStore buildFlatFileStore(NodeState checkpointedState, CompositeIndexer indexer) throws IOException {
+
+        Stopwatch flatFileStoreWatch = Stopwatch.createStarted();
+        int executionCount = 1;
+        CompositeException lastException = null;
+        List<File> previousDownloadDirs = new ArrayList<>();
+        FlatFileStore flatFileStore = null;
+        //TODO How to ensure we can safely read from secondary
+        DocumentNodeState rootDocumentState = (DocumentNodeState) checkpointedState;
+        DocumentNodeStore nodeStore = (DocumentNodeStore) indexHelper.getNodeStore();
+
+        DocumentStoreSplitter splitter = new DocumentStoreSplitter(getMongoDocumentStore());
+        List<Long> lastModifiedBreakPoints = splitter.split(Collection.NODES, 0L ,10);
+        FlatFileNodeStoreBuilder builder = null;
+
+        while (flatFileStore == null && executionCount <= MAX_DOWNLOAD_RETRIES) {
+            try {
+                //TODO Use flatFileStore only if we have relative nodes to be indexed

Review comment:
       Not quite sure why this TODO was+is there... I would remove it

##########
File path: oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/MultithreadedTraverseWithSortStrategy.java
##########
@@ -254,7 +258,9 @@ private void resumeFromPreviousState(List<LastModifiedRange> previousState,
             LastModifiedRange currentRange = previousState.get(i);
             LastModifiedRange nextRange = i < previousState.size() - 1 ? previousState.get(i+1) : null;
             if (nextRange != null && currentRange.checkOverlap(nextRange)) {
-                throw new IllegalStateException("Range overlap between " + currentRange + " and " + nextRange);
+                LastModifiedRange merged = currentRange.mergeWith(nextRange);
+                log.info("Range overlap between " + currentRange + " and " + nextRange + ". Using merged range " + merged);
+                currentRange = merged;

Review comment:
       Not sure if I understand the logic... If you merge the ranges, wouldn't you want to remove nextRange as well? Is that anyway done and so not necessary?




-- 
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