rocksdb/utilities
Andrew Kryczka 69c471bd9b Handle concurrent manifest update and backup creation
Summary:
Fixed two related race conditions in backup creation.

(1) CreateNewBackup() uses DB::DisableFileDeletions() to prevent table files
from being deleted while it is copying; however, the MANIFEST file could still
rotate during this time. The fix is to stop deleting the old manifest in the
rotation logic. It will be deleted safely later when PurgeObsoleteFiles() runs
(can only happen when file deletions are enabled).

(2) CreateNewBackup() did not account for the CURRENT file being mutable.
This is significant because the files returned by GetLiveFiles() contain a
particular manifest filename, but the manifest to which CURRENT refers can
change at any time. This causes problems when CURRENT changes between the call
to GetLiveFiles() and when it's copied to the backup directory. To workaround this, I
manually forge a CURRENT file referring to the manifest filename returned in
GetLiveFiles().

(2) also applies to the checkpointing code, so let me know if this approach is
good and I'll make the same change there.

Test Plan:
new test for roll manifest during backup creation.

running the test before this change:

  $ ./backupable_db_test --gtest_filter=BackupableDBTest.ChangeManifestDuringBackupCreation
  ...
  IO error: /tmp/rocksdbtest-9383/backupable_db/MANIFEST-000001: No such file or directory

running the test after this change:

  $ ./backupable_db_test --gtest_filter=BackupableDBTest.ChangeManifestDuringBackupCreation
  ...
  [ RUN      ] BackupableDBTest.ChangeManifestDuringBackupCreation
  [       OK ] BackupableDBTest.ChangeManifestDuringBackupCreation (2836 ms)

Reviewers: IslamAbdelRahman, anthony, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D54711
2016-02-29 12:56:55 -08:00
..
backupable Handle concurrent manifest update and backup creation 2016-02-29 12:56:55 -08:00
checkpoint Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
compaction_filters Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
convenience Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
document Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
flashcache Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
geodb Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
leveldb_options Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
memory Temporarily disable unstable tests in memory_test.cc 2016-02-09 16:28:34 -08:00
merge_operators Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
options Relax the check condition of prefix_extractor in CheckOptionsCompatibility 2016-02-19 14:42:24 -08:00
redis Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
spatialdb Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
table_properties_collectors Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
transactions Fix transaction locking 2016-02-16 17:15:05 -08:00
ttl Skip unsupported tests in ROCKSDB_LITE 2015-07-20 11:24:54 -07:00
write_batch_with_index Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
env_mirror.cc Fix warning in release 2015-12-23 22:38:12 -08:00
env_mirror_test.cc env: add EnvMirror 2015-12-10 21:32:45 -05:00
merge_operators.h Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00