Skip to content

Commit d43466f

Browse files
authored
OAK-11729: If the indexing lane is behind, we should allow catch up of a non-failing lane (#2397)
* OAK-11729: If the indexing lane is behind, we should allow catch up of a non-failing lane * OAK-11729: If the indexing lane is behind, we should allow catch up of a non-failing lane
1 parent e82b774 commit d43466f

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdate.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,12 +1249,6 @@ public String forceIndexLaneCatchup(String confirmMessage) throws CommitFailedEx
12491249
return msg;
12501250
}
12511251

1252-
if (!this.isFailing()) {
1253-
String msg = "The lane is not failing. This operation should only be performed if the lane is failing, it should first be allowed to catch up on its own.";
1254-
log.warn(msg);
1255-
return msg;
1256-
}
1257-
12581252
try {
12591253
log.info("Running a forced catch-up for indexing lane [{}]. ", name);
12601254
// First we need to abort and pause the running indexing task

oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/AsyncIndexUpdateTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,8 @@ public void testForceUpdateAsyncLane() throws CommitFailedException {
620620
PropertyIndexLookup lookup = new PropertyIndexLookup(root);
621621
assertEquals(Set.of("testRoot", "testRoot1"), find(lookup, "foo", "abc"));
622622

623-
// Run force index catchup with correct confirm message
624-
// But the async lane is NOT failing
625-
// Due to this the force update should be skipped and the
626-
// new node testRoot2 will be indexed.
623+
// Index catchup should work even if the async lane is not failing. Refer: https://issues.apache.org/jira/browse/OAK-11729
624+
// So force catchup will skip indexing this node.
627625
builder.child("testRoot2").setProperty("foo", "abc");
628626
store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
629627
async.getIndexStats().forceIndexLaneCatchup("CONFIRM");
@@ -635,7 +633,7 @@ public void testForceUpdateAsyncLane() throws CommitFailedException {
635633
assertFalse(root.getChildNode(INDEX_DEFINITIONS_NAME).hasChildNode(
636634
":conflict"));
637635
lookup = new PropertyIndexLookup(root);
638-
assertEquals(Set.of("testRoot", "testRoot1", "testRoot2"), find(lookup, "foo", "abc"));
636+
assertEquals(Set.of("testRoot", "testRoot1"), find(lookup, "foo", "abc"));
639637

640638

641639
// Now run force index update on a failing lane with correct confirm message
@@ -655,9 +653,10 @@ public void testForceUpdateAsyncLane() throws CommitFailedException {
655653
assertFalse(root.getChildNode(INDEX_DEFINITIONS_NAME).hasChildNode(
656654
":conflict"));
657655
lookup = new PropertyIndexLookup(root);
658-
// testRoot3 will not be indexed, because it was created after the last successfully run index update and before the forceUpdate was called.
656+
// both testRoot2 and testRoot3 will not be indexed, because these were created after the last successfully run
657+
// index update and before the force catchup.
659658
// So it lands in the missing content diff that needs to be reindexed.
660-
assertEquals(Set.of("testRoot", "testRoot1", "testRoot2", "testRoot4"), find(lookup, "foo", "abc"));
659+
assertEquals(Set.of("testRoot", "testRoot1", "testRoot4"), find(lookup, "foo", "abc"));
661660
// Check if failing index update is fixed
662661
assertFalse(async.isFailing());
663662
}

0 commit comments

Comments
 (0)