This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
rgw/sfs: use sqlite3 backup API to create temp db #208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's not safe for DBConn::check_metadata_is_compatible() to make a copy of the database file while it's already open via SQLite, because the close() that happens after the file is copied cancels all POSIX advisory locks, which can later lead to database corruption. For details, see:
https://www.sqlite.org/howtocorrupt.html#_posix_advisory_locks_canceled_by_a_separate_thread_doing_close_
This change replaces fs::copy() with use of SQLite's Backup API (https://www.sqlite.org/backup.html) which is safe to use with open databases.
Fixes: https://github.com/aquarist-labs/s3gw/issues/702