diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java index 61cffe0..1dfa907 100644 --- a/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java +++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/IndexUpdate.java @@ -163,13 +163,17 @@ public class IndexUpdate implements Editor { log.info("Reindexing will be performed for following indexes: {}", reindex.keySet()); rootState.reindexedIndexes.addAll(reindex.keySet()); - } - - // no-op when reindex is empty - CommitFailedException exception = process( - wrap(wrapProgress(compose(reindex.values()), "Reindexing")), MISSING_NODE, after); - if (exception != null) { - throw exception; + Editor reindexer = wrap(wrapProgress(compose(reindex.values()), "Reindexing")); + // if before == MISSING_NODE there's no need for the out-of-band + // reindexing, we can do it in the current run + if (before == MISSING_NODE) { + editors.add(reindexer); + } else { + CommitFailedException exception = process(reindexer, MISSING_NODE, after); + if (exception != null) { + throw exception; + } + } } for (Editor editor : editors) {