Skip to content
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

do not overwrite unchanged objects or re-delete #30

Merged
merged 2 commits into from
Apr 20, 2023

Conversation

okummer
Copy link
Contributor

@okummer okummer commented Apr 12, 2023

When a bucket is restored to an earlier state of itself, only a few objects might actually have changed. Changed objects can be identified by comparing the etag of the desired version with the etag of the most recent version. If the etags agree, the object can be skipped. Because the most recent version of any object is always listed first in the response from list_object_versions, its etag is definitely known when handling the version to be restored.

Also, do not delete objects that are already deleted in their current state.

Added a test that checks that no new version is created when the object was not changed and that no second delete marker is written.

Also running the existing test in a configuration that uses the same source and destination bucket without requiring another call of "s3-pit-restore --test". Because this is a frequent use case, it should be tested without special effort.

This PR solves a similar, but not the same problem as PR #24. PR #24 can also detect objects that need not be updated when source and target bucket differ, but it needs a separate head_object call for each object. This PR addresses the case of restoring a single bucket to a previous state, only, but without a performance penalty.

okummer added 2 commits April 11, 2023 15:03
When a bucket is restored to an earlier state of itself, only a few objects
might actually have changed. Changed objects can be identified by comparing
the etag of the desired version with the etag of the most recent version.
If the etags agree, the object can be skipped. Because the most recent version
of any object is always listed first in the response from list_object_versions,
its etag is definitely known when handling the version to be restored.

Added a test that checks that no new version is created when the object was
not changed.

Also running the existing test in a configuration that uses the same source
and destination bucket without requiring another call of
"s3-pit-restore --test". Because this is a frequent use case, it should be
tested without special effort.
When a bucket is restored to an earlier state of itself, do not delete objects
that are already deleted in their current state.

Added a test that checks that no new delete marker is created when the object
was not changed.
@angeloc angeloc merged commit a7ef7f0 into angeloc:master Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants