-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Conversation
Closes ES-10787
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
...c/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
Show resolved
Hide resolved
There was a problem hiding this 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 -> { |
There was a problem hiding this comment.
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);
There was a problem hiding this comment.
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.
...c/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
Show resolved
Hide resolved
...c/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
Show resolved
Hide resolved
...c/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
...c/main/java/org/elasticsearch/action/admin/indices/forcemerge/TransportForceMergeAction.java
Show resolved
Hide resolved
Thanks for the reviews! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late LGTM
Closes ES-10787