Skip to content

Conversation

@abeyad
Copy link

@abeyad abeyad commented Jun 21, 2016

Before, a repository would maintain an index file (named 'index') per
repository, that contained the current snapshots in the repository.
This file was not atomically written, so repositories had to depend on
listing the blobs in the repository to determine what the current
snapshots are, and only rely on the index file if the repository does
not support the listBlobs operation. This could cause an incorrect view
of the current snapshots in the repository if any prior snapshot delete
operations failed to delete snapshot metadata files.

This commit introduces the atomic writing of the index file, and because
atomic writes are not guaranteed if the file already exists, we write to
a generational index file (index-N, where N is the current generation).
We also maintain an index-latest file that contains the current
generation, for those repositories that cannot list blobs.

Relates #18156

@abeyad abeyad force-pushed the snapshot-index-generational-files branch from fbc09ae to d0b767b Compare June 21, 2016 15:29
@abeyad
Copy link
Author

abeyad commented Jun 21, 2016

@imotov FYI

Follow up question: In this PR, we are removing listing the snap-* files to determine the snapshots in favor of the index generational files. Do you think we need to keep the snap-* way of listing snapshots as a last resort in case we have an old repository with only the "index" file and that index file happens to be corrupted or missing? Or is this unnecessary?

@imotov
Copy link
Contributor

imotov commented Jul 1, 2016

@abeyad it's probably unnecessary.

LGTM.

Before, a repository would maintain an index file (named 'index') per
repository, that contained the current snapshots in the repository.
This file was not atomically written, so repositories had to depend on
listing the blobs in the repository to determine what the current
snapshots are, and only rely on the index file if the repository does
not support the listBlobs operation.  This could cause an incorrect view
of the current snapshots in the repository if any prior snapshot delete
operations failed to delete snapshot metadata files.

This commit introduces the atomic writing of the index file, and because
atomic writes are not guaranteed if the file already exists, we write to
a generational index file (index-N, where N is the current generation).
We also maintain an index-latest file that contains the current
generation, for those repositories that cannot list blobs.

Closes elastic#19002
Relates elastic#18156
@abeyad abeyad force-pushed the snapshot-index-generational-files branch from d0b767b to 85d9871 Compare July 1, 2016 21:49
@abeyad abeyad closed this in 0599822 Jul 1, 2016
@abeyad abeyad mentioned this pull request Jul 1, 2016
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement v5.0.0-alpha5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants