Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that IndexShard is mutable before force merges #122275

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

fcofdez
Copy link
Contributor

@fcofdez fcofdez commented Feb 11, 2025

Closes ES-10787

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

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

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Feb 11, 2025
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

@@ -92,12 +93,16 @@ protected void shardOperation(
ActionListener<TransportBroadcastByNodeAction.EmptyResult> listener
) {
assert (task instanceof CancellableTask) == false; // TODO: add cancellation handling here once the task supports it
threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.supply(listener, () -> {
SubscribableListener.<IndexShard>newForked(l -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: seems to be neater to initialize indexShard and use SubscribableListener<Void> for indexShard.ensureMutable?

IndexShard indexShard = indicesService.indexServiceSafe(shardRouting.shardId().getIndex()).getShard(shardRouting.shardId().id());
SubscribableListener.<Void>newForked(l -> indexShard.ensureMutable(l))
    .<EmptyResult>andThen(l -> threadPool.executor(ThreadPool.Names.FORCE_MERGE).execute(ActionRunnable.supply(l, () -> {
        indexShard.forceMerge(request);
        return EmptyResult.INSTANCE;
    })))
    .addListener(listener);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to do the error handling when the index doesn't exist in the node anymore, that's why I included it in the listener.

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.

LGTM

@fcofdez fcofdez merged commit a0029cd into elastic:main Feb 12, 2025
18 checks passed
@fcofdez
Copy link
Contributor Author

fcofdez commented Feb 12, 2025

Thanks for the reviews!

Copy link
Member

@tlrx tlrx left a comment

Choose a reason for hiding this comment

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

Late LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >non-issue serverless-linked Added by automation, don't add manually 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