Fix destroydb (#6308)

Summary:
It's observed on Windows DestroyDB failed to remove the log file because the logger is still alive in sst file manager and holding a handle to the log file. This fix makes sure the logger is released before attempt to clear the database directory.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6308

Differential Revision: D19818829

Pulled By: riversand963

fbshipit-source-id: 54c3e6859aadaaba4a49b3e851b73dc35ec7dc6a
This commit is contained in:
Huisheng Liu 2020-02-13 11:19:39 -08:00 committed by Facebook Github Bot
parent df3f33dd05
commit 5138764eb5

View File

@ -3591,6 +3591,11 @@ Status DestroyDB(const std::string& dbname, const Options& options,
env->UnlockFile(lock); // Ignore error since state is already gone
env->DeleteFile(lockname);
// sst_file_manager holds a ref to the logger. Make sure the logger is
// gone before trying to remove the directory.
soptions.sst_file_manager.reset();
env->DeleteDir(dbname); // Ignore error in case dir contains other files
}
return result;