rocksdb/utilities
Igor Canadi 50eab9cf30 Fix BackupEngine
Summary:
In D28521 we removed GarbageCollect() from BackupEngine's constructor. The reason was that opening BackupEngine on HDFS was very slow and in most cases we didn't have any garbage. We allowed the user to call GarbageCollect() when it detects some garbage files in his backup directory.

Unfortunately, this left us vulnerable to an interesting issue. Let's say we started a backup and copied files {1, 3} but the backup failed. On another host, we restore DB from backup and generate {1, 3, 5}. Since {1, 3} is already there, we will not overwrite. However, these files might be from a different database so their contents might be different. See internal task t6781803 for more info.

Now, when we're copying files and we discover a file already there, we check:
1. if the file is not referenced from any backups, we overwrite the file.
2. if the file is referenced from other backups AND the checksums don't match, we fail the backup. This will only happen if user is using a single backup directory for backing up two different databases.
3. if the file is referenced from other backups AND the checksums match, it's all good. We skip the copy and go copy the next file.

Test Plan: Added new test to backupable_db_test. The test fails before this patch.

Reviewers: sdong, rven, yhchiang

Reviewed By: yhchiang

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D37599
2015-05-07 17:39:19 -07:00
..
backupable Fix BackupEngine 2015-05-07 17:39:19 -07:00
checkpoint rocksdb: Add missing override 2015-02-26 11:28:41 -08:00
compacted_db Fix crash caused by opening an empty DB in readonly mode 2015-04-01 16:55:08 -07:00
convenience fix crashes in stats and compaction filter for db_ttl_impl 2015-05-05 16:54:47 -07:00
document rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
flashcache Fix the compilation error in flashcache.cc on Mac 2015-04-07 15:27:23 -07:00
geodb Build for CYGWIN 2015-04-23 21:33:44 -07:00
leveldb_options Added CompatibleOptions for compatibility with LevelDB Options 2014-11-20 19:24:39 -08:00
merge_operators rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
redis rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
spatialdb rocksdb: switch to gtest 2015-03-17 14:08:00 -07:00
ttl fix crashes in stats and compaction filter for db_ttl_impl 2015-05-05 16:54:47 -07:00
write_batch_with_index Create an abstract interface for write batches 2015-03-17 19:23:08 -07:00
merge_operators.h Add appropriate LICENSE and Copyright message. 2013-10-16 17:48:41 -07:00