Skip to content

Commit 880f85a

Browse files
archang19facebook-github-bot
authored andcommitted
Call delete on secondary_db_ wherever it is done on db_ (#13337)
Summary: #13281 added support to the crash tests for secondary DB verification. I looked at our recurring crash tests to see what impact #13281 had. The actual secondary verification looks okay to me (no `assert` failures), but I noticed memory leaks were detected. The problematic areas were tracked down to the call to `DB::OpenAsSecondary` from `rocksdb::StressTest::Open`. Pull Request resolved: #13337 Test Plan: Monitor recurring crash tests. It is likely hard to reproduce the ASAN failures locally if they are rare enough. ``` make -j100 db_stress COMPILE_WITH_ASAN=1 python3 tools/db_crashtest.py --simple blackbox --test_secondary=1 ``` Reviewed By: cbi42 Differential Revision: D68721624 Pulled By: archang19 fbshipit-source-id: 9c3044884c505c43c1819a3e98ce99b2d171f3ca
1 parent 591f5b1 commit 880f85a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

db_stress_tool/db_stress_test_base.cc

+7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void StressTest::CleanUp() {
119119
}
120120
secondary_cfhs_.clear();
121121
delete secondary_db_;
122+
secondary_db_ = nullptr;
122123
}
123124

124125
std::shared_ptr<Cache> StressTest::NewCache(size_t capacity,
@@ -742,6 +743,8 @@ void StressTest::PreloadDbAndReopenAsReadOnly(int64_t number_of_keys,
742743
db_ = nullptr;
743744
txn_db_ = nullptr;
744745
optimistic_txn_db_ = nullptr;
746+
delete secondary_db_;
747+
secondary_db_ = nullptr;
745748

746749
db_preload_finished_.store(true);
747750
auto now = clock_->NowMicros();
@@ -3584,6 +3587,8 @@ void StressTest::Open(SharedState* shared, bool reopen) {
35843587
column_families_.clear();
35853588
delete db_;
35863589
db_ = nullptr;
3590+
delete secondary_db_;
3591+
secondary_db_ = nullptr;
35873592
}
35883593
}
35893594
if (!s.ok()) {
@@ -3790,6 +3795,8 @@ void StressTest::Reopen(ThreadState* thread) {
37903795
db_ = nullptr;
37913796
txn_db_ = nullptr;
37923797
optimistic_txn_db_ = nullptr;
3798+
delete secondary_db_;
3799+
secondary_db_ = nullptr;
37933800

37943801
num_times_reopened_++;
37953802
auto now = clock_->NowMicros();

0 commit comments

Comments
 (0)