Fix issue #921
Summary: See a bug report here: https://github.com/facebook/rocksdb/issues/921 The fix is to not check the shared/ directory if share_table_files is false. We could also check FileExists() before GetChildren(), but that will add extra latency when Env is Hdfs :( Test Plan: added a unit test Reviewers: rven, sdong, IslamAbdelRahman, yhchiang, anthony Reviewed By: anthony Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D52593
This commit is contained in:
parent
51adc5457a
commit
e541dcc8fa
@ -1344,6 +1344,7 @@ Status BackupEngineImpl::GarbageCollect() {
|
||||
assert(!read_only_);
|
||||
Log(options_.info_log, "Starting garbage collection");
|
||||
|
||||
if (options_.share_table_files) {
|
||||
// delete obsolete shared files
|
||||
std::vector<std::string> shared_children;
|
||||
{
|
||||
@ -1367,6 +1368,7 @@ Status BackupEngineImpl::GarbageCollect() {
|
||||
backuped_file_infos_.erase(rel_fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete obsolete private files
|
||||
std::vector<std::string> private_children;
|
||||
|
@ -1313,6 +1313,16 @@ TEST_F(BackupableDBTest, EnvFailures) {
|
||||
delete backup_engine;
|
||||
}
|
||||
}
|
||||
|
||||
// see https://github.com/facebook/rocksdb/issues/921
|
||||
TEST_F(BackupableDBTest, Issue921Test) {
|
||||
BackupEngine* backup_engine;
|
||||
backupable_options_->share_table_files = false;
|
||||
backupable_options_->backup_dir += "/new_dir";
|
||||
|
||||
ASSERT_OK(BackupEngine::Open(env_, *backupable_options_, &backup_engine));
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
} // namespace rocksdb
|
||||
|
Loading…
Reference in New Issue
Block a user