Skip to content

Improve Snapshot Abort Behavior (#54256)#54410

Merged
original-brownbear merged 1 commit intoelastic:7.xfrom
original-brownbear:54256-7.x
Mar 30, 2020
Merged

Improve Snapshot Abort Behavior (#54256)#54410
original-brownbear merged 1 commit intoelastic:7.xfrom
original-brownbear:54256-7.x

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

This commit improves the behavior of aborting snapshots and by that fixes
some extremely rare test failures.

Improvements:

  1. When aborting a snapshot while it is in the INIT stage we do not need
    to ever delete anything from the repository because nothing is written to the
    repo during INIT any more (in the past running deletes for these snapshots made
    sense because we were writing snap- and meta- blobs during the INIT step).
  2. Do not try to finalize snapshots that never moved past INIT. Same reason as
    with the first step. If we never moved past INIT no data was written to the repo
    so no need to now write a useless entry for the aborted snapshot to index-N.
    This is especially true, since the reason the snapshot was aborted during INIT was
    a delete call so the useless empty snapshot just added to index-N would be removed
    by the subsequent delete that is still waiting anyway.
  3. if after aborting a snapshot we wait for it to finish we should not try deleting it
    if it failed. If the snapshot failed it means it did not become part of the most recent
    RepositoryData so a delete for it will needlessly fail with a confusing message about
    that snapshot being missing or concurrent repository modification. I moved to throw the snapshot missing exception here because that seems the most user friendly. This allows the user to simply ignore 404 returns from the delete API when using it to make sure a snapshot is aborted+deleted.

Marking this as a non-issue since it doesn't have any negative repercussions other than confusing exceptions on some snapshot aborts.

Closes #52843

backport of #54256

This commit improves the behavior of aborting snapshots and by that fixes
some extremely rare test failures.

Improvements:
1. When aborting a snapshot while it is in the `INIT` stage we do not need
to ever delete anything from the repository because nothing is written to the
repo during INIT any more (in the past running deletes for these snapshots made
sense because we were writing `snap-` and `meta-` blobs during the `INIT` step).
2. Do not try to finalize snapshots that never moved past `INIT`. Same reason as
with the first step. If we never moved past `INIT` no data was written to the repo
so no need to now write a useless entry for the aborted snapshot to `index-N`.
This is especially true, since the reason the snapshot was aborted during `INIT` was
a delete call so the useless empty snapshot just added to `index-N` would be removed
by the subsequent delete that is still waiting anyway.
3. if after aborting a snapshot we wait for it to finish we should not try deleting it
if it failed. If the snapshot failed it means it did not become part of the most recent
`RepositoryData` so a delete for it will needlessly fail with a confusing message about
that snapshot being missing or concurrent repository modification. I moved to throw the snapshot missing exception here because that seems the most user friendly. This allows the user to simply ignore `404` returns from the delete API when using it to make sure a snapshot is aborted+deleted.

Marking this as a non-issue since it doesn't have any negative repercussions other than confusing exceptions on some snapshot aborts.

Closes #52843
@original-brownbear original-brownbear added :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs backport labels Mar 30, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (:Distributed/Snapshot/Restore)

@original-brownbear original-brownbear merged commit 9392fca into elastic:7.x Mar 30, 2020
@original-brownbear original-brownbear deleted the 54256-7.x branch March 30, 2020 13:08
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Mar 31, 2020
The explain API expects a data frame analytics config
as its request.

Backport of elastic#54410
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Mar 31, 2020
The explain API expects a data frame analytics config
as its request.

Backport of elastic#54410
dimitris-athanasiou added a commit that referenced this pull request Mar 31, 2020
The explain API expects a data frame analytics config
as its request.

Backport of #54410
dimitris-athanasiou added a commit that referenced this pull request Mar 31, 2020
The explain API expects a data frame analytics config
as its request.

Backport of #54410
dimitris-athanasiou added a commit that referenced this pull request Mar 31, 2020
The explain API expects a data frame analytics config
as its request.

Backport of #54410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants