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 mr...@apache.org on 2019/06/27 15:06:37 UTC
svn commit: r1862231 - in /jackrabbit/oak/trunk/oak-store-document/src:
main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
test/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryWithBundledNodesTest.java
Author: mreutegg
Date: Thu Jun 27 15:06:37 2019
New Revision: 1862231
URL: http://svn.apache.org/viewvc?rev=1862231&view=rev
Log:
OAK-8364: LastRevRecoveryAgent may log warn message for bundled node
Modified:
jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryWithBundledNodesTest.java
Modified: jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java?rev=1862231&r1=1862230&r2=1862231&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java (original)
+++ jackrabbit/oak/trunk/oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryAgent.java Thu Jun 27 15:06:37 2019
@@ -28,7 +28,9 @@ import static org.apache.jackrabbit.oak.
import static org.apache.jackrabbit.oak.plugins.document.util.Utils.isCommitted;
import static org.apache.jackrabbit.oak.plugins.document.util.Utils.resolveCommitRevision;
+import java.util.ArrayList;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
@@ -41,9 +43,11 @@ import com.google.common.collect.Iterabl
import com.google.common.collect.Sets;
import org.apache.jackrabbit.oak.commons.TimeDurationFormatter;
+import org.apache.jackrabbit.oak.plugins.document.bundlor.DocumentBundlor;
import org.apache.jackrabbit.oak.plugins.document.util.MapFactory;
import org.apache.jackrabbit.oak.plugins.document.util.Utils;
import org.apache.jackrabbit.oak.stats.Clock;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -349,17 +353,23 @@ public class LastRevRecoveryAgent {
Revision calcLastRev = unsavedParents.get(parentPath);
Revision knownLastRev = knownLastRevOrModification.get(parentPath);
if (knownLastRev == null) {
+ List<Path> missingDocuments = new ArrayList<>();
// we don't know when the document was last modified with
// the given clusterId. need to read from store
- String id = Utils.getIdFromPath(parentPath);
- NodeDocument doc = store.find(NODES, id);
+ NodeDocument doc = findNearestAncestorOrSelf(parentPath, missingDocuments);
if (doc != null) {
Revision lastRev = doc.getLastRev().get(clusterId);
Revision lastMod = determineLastModification(doc, clusterId);
knownLastRev = Utils.max(lastRev, lastMod);
- } else {
- log.warn("Unable to find document: {}", id);
- continue;
+
+ if (!missingDocuments.isEmpty()
+ && doc.getLocalMap(DocumentBundlor.META_PROP_PATTERN).isEmpty()) {
+ // there are missing document and the returned document
+ // does not have bundled nodes
+ for (Path p : missingDocuments) {
+ log.warn("Unable to find document: {}", Utils.getIdFromPath(p));
+ }
+ }
}
}
@@ -450,6 +460,24 @@ public class LastRevRecoveryAgent {
//--------------------------< internal >------------------------------------
+ @Nullable
+ private NodeDocument findNearestAncestorOrSelf(@NotNull Path path,
+ @NotNull List<Path> missingDocuments) {
+ NodeDocument ancestor;
+ for (;;) {
+ ancestor = store.find(NODES, Utils.getIdFromPath(path));
+ if (ancestor != null) {
+ break;
+ }
+ missingDocuments.add(path);
+ path = path.getParent();
+ if (path == null) {
+ break;
+ }
+ }
+ return ancestor;
+ }
+
/**
* Retrieves possible candidates which have been modified after the given
* {@code startTime} and recovers the missing updates.
Modified: jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryWithBundledNodesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryWithBundledNodesTest.java?rev=1862231&r1=1862230&r2=1862231&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryWithBundledNodesTest.java (original)
+++ jackrabbit/oak/trunk/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/LastRevRecoveryWithBundledNodesTest.java Thu Jun 27 15:06:37 2019
@@ -26,7 +26,6 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.slf4j.event.Level;
@@ -45,7 +44,6 @@ import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-@Ignore("OAK-8364")
public class LastRevRecoveryWithBundledNodesTest {
@Rule