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
main
Huisheng Liu 5 years ago committed by Facebook Github Bot
parent df3f33dd05
commit 5138764eb5
  1. 5
      db/db_impl/db_impl.cc

@ -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;

Loading…
Cancel
Save