Skip to content

[8.0] Fix race condition in Feature Migration Status API (#80572)#80638

Merged
elasticsearchmachine merged 1 commit intoelastic:8.0from
AthenaEryma:backport/8.0/pr-80572
Nov 10, 2021
Merged

[8.0] Fix race condition in Feature Migration Status API (#80572)#80638
elasticsearchmachine merged 1 commit intoelastic:8.0from
AthenaEryma:backport/8.0/pr-80572

Conversation

@AthenaEryma
Copy link
Copy Markdown
Contributor

Backports the following commits to 8.0:

Prior to this commit, there is a race condition in the Feature Migration
Status API where the returned status can be `MIGRATION_NEEDED`, even if
a migration is already in progress (and therefore the returned value
should have been `IN_PROGRESS`). This commit adds a test for this case
which reliably fails without the fix, and fixes the bug.

The fix is straightforward: While we already examine the persistent task
metadata to determine progress, the part of that metadata that we
examined did was not updated until the task's been running for a bit.
However, if we check for the *existence* of the task metadata, that is
guaranteed to be in the cluster state by the time the request to start the
migration completes (and is removed immediately after the task finishes
- that's why we have separate metadata for the migration results instead
of just using the task state).
@AthenaEryma AthenaEryma added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport labels Nov 10, 2021
@elasticsearchmachine elasticsearchmachine merged commit 3861803 into elastic:8.0 Nov 10, 2021
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!) backport v8.0.0-rc1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants