Skip to content

Commit eb31d19

Browse files
leveldb Teambradtriebwasser
leveldb Team
authored andcommitted
Allow compaction to finish in TEST_CompactRange
Waits for a current transaction to finish in TEST_CompactRange when the `background_work_finished_signal_` signal may be emitted due to an error. This is a prospective fix for flaky crashes observed in b/351680196#comment5. PiperOrigin-RevId: 663457574
1 parent 068d5ee commit eb31d19

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

db/db_impl.cc

+5
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,11 @@ void DBImpl::TEST_CompactRange(int level, const Slice* begin,
629629
background_work_finished_signal_.Wait();
630630
}
631631
}
632+
// Finish current background compaction in the case where
633+
// `background_work_finished_signal_` was signalled due to an error.
634+
while (background_compaction_scheduled_) {
635+
background_work_finished_signal_.Wait();
636+
}
632637
if (manual_compaction_ == &manual) {
633638
// Cancel my manual compaction since we aborted early for some reason.
634639
manual_compaction_ = nullptr;

0 commit comments

Comments
 (0)