-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Adding a migration reindex cancel API #118291
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
Adding a migration reindex cancel API #118291
Conversation
Hi @masseyke, I've created a changelog YAML for you. |
Pinging @elastic/es-data-management (Team:Data Management) |
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
builder.startObject(); | ||
builder.field("acknowledged", true); |
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.
Could this action just use AcknowledgeResponse
directly?
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.
Oh yeah, it could! In an early iteration I was returning the latest status information so the response had fields in it. But then I decided that was unnecessary and forgot to remove the response class.
) | ||
); | ||
} else { | ||
runningTask.markAsCompleted(); |
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.
So is this all that's needed to cancel the actual reindex code? Or does there need to be cancel specific logic built into the per-index reindexing code, which will be called here?
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.
It sounds like markAsCompleed
is the wrong way to go. I'm going to change this to use PersistentTasksService::sendRemoveRequest
instead. And we just need to make sure the parent task is set on all of our transport actions to have the cancellation propagate.
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
…eyke/elasticsearch into adding-migration-reindex-cancel-api
* the task manager). The running task is removed from the task manager in ReindexDataStreamTask::onCancelled, which is called as | ||
* as result of this. | ||
*/ | ||
persistentTasksService.sendRemoveRequest(persistentTaskId, TimeValue.MAX_VALUE, new ActionListener<>() { |
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, could do:
listener.delegateResponse((l, e) -> l.onResponse(AcknowledgedResponse.TRUE))
This introduces the migration reindex cancel API, which cancels a migration reindex task for a given data stream name that was started with elastic#118109. For example: ``` POST localhost:9200/_migration/reindex/my-data-stream/_cancel?pretty ``` returns ``` { "acknowledged" : true } ``` This cancels the task, and cancels any ongoing reindexing of backing indices, but does not do any cleanup.
This introduces the migration reindex cancel API, which cancels a migration reindex task for a given data stream name that was started with #118109. For example: ``` POST localhost:9200/_migration/reindex/my-data-stream/_cancel?pretty ``` returns ``` { "acknowledged" : true } ``` This cancels the task, and cancels any ongoing reindexing of backing indices, but does not do any cleanup.
This introduces the migration reindex cancel API, which cancels a migration reindex task for a given data stream name that was started with elastic#118109. For example: ``` POST localhost:9200/_migration/reindex/my-data-stream/_cancel?pretty ``` returns ``` { "acknowledged" : true } ``` This cancels the task, and cancels any ongoing reindexing of backing indices, but does not do any cleanup.
This introduces the migration reindex cancel API, which cancels a migration reindex task for a given data stream name that was started with #118109. For example:
returns
This cancels the task, and cancels any ongoing reindexing of backing indices, but does not do any cleanup.