OAK-9358: DocumentNodeStore may accumulate split candidates

Add ignored tests that reproduce the issue

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1886595 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
index aa1b662..32a04fb 100644
--- a/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
+++ b/oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentSplitTest.java
@@ -45,6 +45,7 @@
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.stats.Clock;
 import org.jetbrains.annotations.NotNull;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.google.common.collect.Iterables;
@@ -63,6 +64,7 @@
 import static org.apache.jackrabbit.oak.plugins.document.UpdateOp.Operation.Type.SET_MAP_ENTRY;
 import static org.apache.jackrabbit.oak.plugins.document.util.Utils.isCommitted;
 import static org.apache.jackrabbit.oak.plugins.memory.BinaryPropertyState.binaryProperty;
+import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.either;
 import static org.hamcrest.Matchers.empty;
 import static org.hamcrest.Matchers.hasSize;
@@ -72,7 +74,6 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -1074,6 +1075,32 @@
         }
     }
 
+    @Ignore("OAK-9358")
+    @Test
+    public void splitCandidatesCleanAfterBackgroundUpdate() throws Exception {
+        DocumentNodeStore ns = mk.getNodeStore();
+        NodeBuilder builder = ns.getRoot().builder();
+        builder.child("foo");
+        merge(ns, builder);
+        // sneak in split candidate
+        ns.addSplitCandidate(Utils.getIdFromPath("/foo"));
+        ns.runBackgroundOperations();
+        assertThat(ns.getSplitCandidates(), empty());
+    }
+
+    @Ignore("OAK-9358")
+    @Test
+    public void splitCandidatesCleanAfterBackgroundUpdateWithUnknownId() throws Exception {
+        DocumentNodeStore ns = mk.getNodeStore();
+        NodeBuilder builder = ns.getRoot().builder();
+        builder.child("foo");
+        merge(ns, builder);
+        // sneak in unknown split candidate
+        ns.addSplitCandidate(Utils.getIdFromPath("/bar"));
+        ns.runBackgroundOperations();
+        assertThat(ns.getSplitCandidates(), empty());
+    }
+
     private static class TestRevisionContext implements RevisionContext {
 
         private final RevisionContext rc;