Skip to content

[7.16] Fix race condition in Feature Migration Status API (#80572)#80637

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

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

Conversation

@AthenaEryma
Copy link
Copy Markdown
Contributor

Backports the following commits to 7.16:

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 4fbc732 into elastic:7.16 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 v7.16.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants