Revision a6d418384d58212f57052fe21362e0f748e552ff authored by Peter Dillinger on 09 November 2019, 03:13:41 UTC, committed by Peter Dillinger on 15 November 2019, 20:15:12 UTC
Summary:
Only if there is a crash, power failure, or I/O error in
DeleteBackup, shared or private files from the backup might be left
behind that are not cleaned up by PurgeOldBackups or DeleteBackup-- only
by GarbageCollect. This makes the BackupEngine API "leaky by default."
Even if it means a modest performance hit, I think we should make
Delete and Purge do as they say, with ongoing best effort: i.e. future
calls will attempt to finish any incomplete work from earlier calls.

This change does that by having DeleteBackup and PurgeOldBackups do a
GarbageCollect, unless (to minimize performance hit) this BackupEngine
has already done a GarbageCollect and there have been no
deletion-related I/O errors in that GarbageCollect or since then.

Rejected alternative 1: remove meta file last instead of first. This would in theory turn partially deleted backups into corrupted backups, but code changes would be needed to allow the missing files and consider it acceptably corrupt, rather than failing to open the BackupEngine. This might be a reasonable choice, but I mostly rejected it because it doesn't solve the legacy problem of cleaning up existing lingering files.

Rejected alternative 2: use a deletion marker file. If deletion started with creating a file that marks a backup as flagged for deletion, then we could reliably detect partially deleted backups and efficiently finish removing them. In addition to not solving the legacy problem, this could be precarious if there's a disk full situation, and we try to create a new file in order to delete some files. Ugh.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6015

Test Plan: Updated unit tests

Differential Revision: D18401333

Pulled By: pdillinger

fbshipit-source-id: 12944e372ce6809f3f5a4c416c3b321a8927d925
1 parent cb1dc29
History
File Mode Size
cache_bench.cc -rw-r--r-- 7.4 KB
cache_test.cc -rw-r--r-- 20.3 KB
clock_cache.cc -rw-r--r-- 25.9 KB
clock_cache.h -rw-r--r-- 601 bytes
lru_cache.cc -rw-r--r-- 15.6 KB
lru_cache.h -rw-r--r-- 10.6 KB
lru_cache_test.cc -rw-r--r-- 6.0 KB
sharded_cache.cc -rw-r--r-- 4.9 KB
sharded_cache.h -rw-r--r-- 4.2 KB

back to top