Skip to content

Conversation

@tlrx
Copy link
Member

@tlrx tlrx commented Feb 11, 2025

Current code closes the previous engine instance, creates the new engine and then updates the currentEngineReference:

    IOUtils.close(currentEngine);
    var newEngine = createEngine(engineConfig);
    currentEngineReference.set(newEngine);

This leaves more room for callers of getEngineOrNull() to pick a closed instance. Instead we can create the new engine first and atomically update the reference to the new instance.

@tlrx tlrx added >non-issue :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. v9.1.0 labels Feb 11, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Indexing Meta label for Distributed Indexing team label Feb 11, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing)

@tlrx tlrx requested review from arteam, fcofdez and kingherc February 11, 2025 14:26
Copy link
Contributor

@fcofdez fcofdez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for fixing this

Copy link
Contributor

@kingherc kingherc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one. Just one comment before approving.

@tlrx tlrx requested a review from kingherc February 11, 2025 15:16
Copy link
Contributor

@arteam arteam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tlrx tlrx added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Feb 12, 2025
@tlrx tlrx merged commit f3b3297 into elastic:main Feb 12, 2025
16 of 17 checks passed
@tlrx tlrx deleted the 2025/02/11/atomically-reset-engine branch February 12, 2025 10:09
@tlrx
Copy link
Member Author

tlrx commented Feb 12, 2025

Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >non-issue Team:Distributed Indexing Meta label for Distributed Indexing team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants