Call PurgeObsoleteFiles() only when HaveSomethingToDelete()
Summary: as title Test Plan: fixed the build failure http://ci-builds.fb.com/job/rocksdb_build/987/console Reviewers: haobo Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D16743
This commit is contained in:
parent
9db8c4c556
commit
d5de22dc09
@ -361,9 +361,11 @@ DBImpl::~DBImpl() {
|
||||
FindObsoleteFiles(deletion_state, true);
|
||||
// manifest number starting from 2
|
||||
deletion_state.manifest_file_number = 1;
|
||||
if (deletion_state.HaveSomethingToDelete()) {
|
||||
PurgeObsoleteFiles(deletion_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (super_version_ != nullptr) {
|
||||
bool is_last_reference __attribute__((unused));
|
||||
@ -780,8 +782,10 @@ void DBImpl::DeleteObsoleteFiles() {
|
||||
mutex_.AssertHeld();
|
||||
DeletionState deletion_state;
|
||||
FindObsoleteFiles(deletion_state, true);
|
||||
if (deletion_state.HaveSomethingToDelete()) {
|
||||
PurgeObsoleteFiles(deletion_state);
|
||||
}
|
||||
}
|
||||
|
||||
// 1. Go through all archived files and
|
||||
// a. if ttl is enabled, delete outdated files
|
||||
@ -2782,8 +2786,10 @@ static void CleanupIteratorState(void* arg1, void* arg2) {
|
||||
state->mu->Unlock();
|
||||
|
||||
delete state->super_version;
|
||||
if (deletion_state.HaveSomethingToDelete()) {
|
||||
state->db->PurgeObsoleteFiles(deletion_state);
|
||||
}
|
||||
}
|
||||
|
||||
delete state;
|
||||
}
|
||||
@ -3759,7 +3765,9 @@ Status DBImpl::DeleteFile(std::string name) {
|
||||
} // lock released here
|
||||
LogFlush(options_.info_log);
|
||||
// remove files outside the db-lock
|
||||
if (deletion_state.HaveSomethingToDelete()) {
|
||||
PurgeObsoleteFiles(deletion_state);
|
||||
}
|
||||
{
|
||||
MutexLock l(&mutex_);
|
||||
// schedule flush if file deletion means we freed the space for flushes to
|
||||
|
Loading…
Reference in New Issue
Block a user