-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Allow Parallel Snapshot Restore And Delete #51608
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
Conversation
There is no reason not to allow deletes in parallel to restores if they're dealing with different snapshots. A delete will not remove any files related to the snapshot that is being restored if it is different from the deleted snapshot because those files will still be referenced by the restoring snapshot. Loading RepositoryData concurrently to modifying it is concurrency safe nowadays as well since the repo generation is tracked in the cluster state. Closes elastic#41463
Pinging @elastic/es-distributed (:Distributed/Snapshot/Restore) |
@@ -152,58 +152,4 @@ public void testSnapshottingWithInProgressDeletionNotAllowed() throws Exception | |||
client().admin().cluster().prepareCreateSnapshot(repo, snapshot2).setWaitForCompletion(true).get(); | |||
assertEquals(1, client().admin().cluster().prepareGetSnapshots(repo).setSnapshots("_all").get().getSnapshots(repo).size()); | |||
} | |||
|
|||
public void testRestoreWithInProgressDeletionsNotAllowed() throws Exception { |
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.
Removing this one instead of adjusting it, it's totally redundant to the new resiliency test I added, that proves we don't get a dead-lock in this code either and it's much more useful for debugging.
server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/snapshots/SnapshotResiliencyTests.java
Show resolved
Hide resolved
final StepListener<CreateSnapshotResponse> createSnapshotResponseStepListener = new StepListener<>(); | ||
|
||
continueOrDie(createRepoAndIndex(repoName, index, shards), | ||
createIndexResponse -> client().admin().cluster().prepareCreateSnapshot(repoName, snapshotName) |
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.
Should we also index some docs (mostly to generate more snapshot files) before and in-between snapshots, and then run a query?
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.
Good idea, right now I don't expect it to make a difference but good to have some checks on this :) I pushed e8fe17e
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.
I don't expect it either but I prefer to have some shard files around :) Thanks
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
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
Thanks Tanguy + Yannick! |
There is no reason not to allow deletes in parallel to restores if they're dealing with different snapshots. A delete will not remove any files related to the snapshot that is being restored if it is different from the deleted snapshot because those files will still be referenced by the restoring snapshot. Loading RepositoryData concurrently to modifying it is concurrency safe nowadays as well since the repo generation is tracked in the cluster state. Closes elastic#41463
There is no reason not to allow deletes in parallel to restores if they're dealing with different snapshots. A delete will not remove any files related to the snapshot that is being restored if it is different from the deleted snapshot because those files will still be referenced by the restoring snapshot. Loading RepositoryData concurrently to modifying it is concurrency safe nowadays as well since the repo generation is tracked in the cluster state. Closes #41463
There is no reason not to allow deletes in parallel to restores
if they're dealing with different snapshots.
A delete will not remove any files related to the snapshot that
is being restored if it is different from the deleted snapshot
because those files will still be referenced by the restoring
snapshot.
Also, the snapshot restore is using the
snap-${uuid}.dat
metadata in the shardfolders to determine the files to restore, so concurrently modifying shard metadata
isn't an issue as well.
Loading
RepositoryData
concurrently to modifying it is concurrency-safenowadays as well since the repo generation is tracked in the
cluster state.
Closes #41463
I'd open a follow-up to this one for concurrent snapshot + restore, that will work for the same reasons delete + restore work concurrently.