Skip to content

Commit f891100

Browse files
committed
fix: align multitarget branch with marker-based catch-up provider contract
Adopt the marker-interface catch-up provider shape in lucene9 editor wiring and remove obsolete tests tied to the old createCatchUpEditor API. Made-with: Cursor
1 parent efe1d8a commit f891100

3 files changed

Lines changed: 9 additions & 202 deletions

File tree

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

Lines changed: 0 additions & 36 deletions
This file was deleted.

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

Lines changed: 0 additions & 132 deletions
This file was deleted.

oak-search-luceneNg/src/main/java/org/apache/jackrabbit/oak/plugins/index/luceneNg/LuceneNgIndexEditorProvider.java

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,15 @@ public Editor getIndexEditor(@NotNull String type,
6464
return null;
6565
}
6666

67-
// Guard: skip this target while a catch-up is in progress for it
68-
if (definition.getChildNode(CatchUpCapable.CATCH_UP_TRACKING_NODE)
69-
.hasProperty(LuceneNgIndexConstants.TYPE_LUCENE9)) {
70-
return null;
67+
// Guard: skip normal indexing if catch-up is in progress for this target
68+
// But allow catch-up itself to run (catch-up passes the targetType as the type parameter)
69+
NodeBuilder trackingNode = definition.getChildNode(CatchUpCapable.CATCH_UP_TRACKING_NODE);
70+
if (trackingNode.exists() && trackingNode.hasProperty(LuceneNgIndexConstants.TYPE_LUCENE9)) {
71+
// If type == "lucene9", this is a catch-up call, allow it
72+
// If type != "lucene9", this is normal indexing, block it
73+
if (!LuceneNgIndexConstants.TYPE_LUCENE9.equals(type)) {
74+
return null; // Block normal indexing while catch-up is in progress
75+
}
7176
}
7277

7378
String indexPath = "/oak:index/unknown";
@@ -101,37 +106,7 @@ public Editor getIndexEditor(@NotNull String type,
101106
}
102107
}
103108

104-
@Override
105-
@Nullable
106-
public Editor createCatchUpEditor(
107-
@NotNull String targetType,
108-
@NotNull String indexName,
109-
@NotNull NodeBuilder definition,
110-
@NotNull NodeBuilder rootBuilder,
111-
@NotNull NodeState root,
112-
@NotNull IndexUpdateCallback callback)
113-
throws CommitFailedException {
114-
115-
if (!LuceneNgIndexConstants.TYPE_LUCENE9.equals(targetType)) {
116-
return null;
117-
}
118-
if (!IndexDefinitionHelper.shouldWrite(definition.getNodeState(), LuceneNgIndexConstants.TYPE_LUCENE9)) {
119-
return null;
120-
}
121-
122-
// NOTE: intentionally does NOT check the tracking node —
123-
// CatchUpRunner owns the tracking state.
124-
String indexPath = "/oak:index/" + indexName;
125-
NodeBuilder storageBuilder = getOrCreateStorageBuilder(rootBuilder, indexName);
126109

127-
LOG.debug("Creating catch-up Lucene9 editor for {}", indexPath);
128-
try {
129-
return new LuceneNgIndexEditor("/", indexPath, storageBuilder, definition, root, false, callback);
130-
} catch (Exception e) {
131-
throw new CommitFailedException("Lucene9", 2,
132-
"Failed to create catch-up LuceneNgIndexEditor for " + indexPath, e);
133-
}
134-
}
135110

136111
/**
137112
* Returns the NodeBuilder for the index storage path, creating intermediate

0 commit comments

Comments
 (0)