From 4ee991b1e64194dfcfc4ca2ea063a045df814174 Mon Sep 17 00:00:00 2001 From: anand76 Date: Tue, 26 Jan 2021 11:10:16 -0800 Subject: [PATCH] Cleanup multiple DBs after running db_bench in multi-DB mode (#7891) Summary: Currently, db_bench cleanup only deletes the main DB, if there's one. Multiple DBs that are opened when --num_multi_db is specified are not deleted, which can lead to crashes due to running compaction threads on process exit. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7891 Test Plan: Run regression test Reviewed By: jay-zhuang Differential Revision: D26049914 Pulled By: anand1976 fbshipit-source-id: acef2821001ca5e208a96a6a273c724e56353316 --- tools/db_bench_tool.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 852ea3406..42fb13466 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -2784,6 +2784,9 @@ class Benchmark { ~Benchmark() { db_.DeleteDBs(); + for (auto db : multi_dbs_) { + db.DeleteDBs(); + } delete prefix_extractor_; if (cache_.get() != nullptr) { // this will leak, but we're shutting down so nobody cares