Mihai Bercea created OAK-12496:
----------------------------------
Summary: Failed out-of-band index import can leave new definitions
on temporary lanes and orphan Elasticsearch resources
Key: OAK-12496
URL: https://issues.apache.org/jira/browse/OAK-12496
Project: Jackrabbit Oak
Issue Type: Bug
Components: indexing
Reporter: Mihai Bercea
h3. Problem
An out-of-band index import can fail after installing a new index definition on
a temporary async lane but before catch-up completes. For example, if the
checkpoint referenced by the target async lane is no longer available, catch-up
fails and can leave the new definition on the temporary lane. For an
Elasticsearch
index, the generated backing index and its alias can also remain after the
failed
import.
h3. Reproduction
1. Generate out-of-band index data for a new asynchronous index using a valid
checkpoint.
2. Before importing, make the checkpoint referenced by the target async lane
unavailable, while keeping the generation checkpoint valid.
3. Import the generated index data.
4. Catch-up fails after the new definition has been installed; inspect the
definition's temporary lane and the generated backend resources.
h3. Expected behavior
The importer should report the original failure and safely recover incomplete
new imports. Recovery must preserve existing definitions, successfully completed
imports, concurrently changed definitions, and backend resources whose ownership
cannot be established.
h3. Proposed approach
- Track import progress and definition ownership in the shared importer.
- Remove incomplete new definitions only when they still match the import-owned
state.
- Delegate backend-specific cleanup to the corresponding importer provider.
- For Elasticsearch, delete only the exact generated backing index after
repository-reference and alias-ownership checks.
- For repository-contained index data, use repository operations rather than
deleting shared blobs directly.
- Keep cleanup errors visible without replacing the original import failure.
This is focused on recovery within the failing process. Crash/restart recovery
and complete rollback of existing-index replacements are outside this scope.
h3. Validation of the proposed patch
- 55 focused tests pass across shared importer, recovery, Elasticsearch
cleanup, and runner connection wiring.
- An isolated integration test reproduced the missing-checkpoint failure and
verified automatic removal of the new definition, exact backing index, and
exclusive alias before manual test cleanup.
- The original failure remained observable with a nonzero process exit; other
top-level index identities and lane assignments matched the pre-test baseline.
Dependency integration and complete job-lifecycle validation remain separate
work.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)