From 7dbee387164c9ccdaff5b12106cf805291df3e7b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 29 Nov 2018 11:24:33 -0800 Subject: [PATCH] db/repair: reset Repair::db_lock_ in ctor (#4683) Summary: there is chance that * the caller tries to repair the db when holding the db_lock, in that case the env implementation might not set the `lock` parameter of Repairer::Run(). * the caller somehow never calls Repairer::Run(). either way, the desctructor of Repair will compare the uninitialized db_lock_ with nullptr, and tries to unlock it. there is good chance that the db_lock_ is not nullptr, then boom. Signed-off-by: Kefu Chai Pull Request resolved: https://github.com/facebook/rocksdb/pull/4683 Differential Revision: D13260287 Pulled By: riversand963 fbshipit-source-id: 878a119d2e9f10a0fa17ee62cf3fb24b33d49fa5 --- db/repair.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/repair.cc b/db/repair.cc index 76a1c39fd4..e7d72f917d 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -118,7 +118,8 @@ class Repairer { wc_(db_options_.delayed_write_rate), vset_(dbname_, &immutable_db_options_, env_options_, raw_table_cache_.get(), &wb_, &wc_), - next_file_number_(1) { + next_file_number_(1), + db_lock_(nullptr) { for (const auto& cfd : column_families) { cf_name_to_opts_[cfd.name] = cfd.options; }