diff options
author | leveldb Team <no-reply@google.com> | 2024-08-15 21:37:00 +0000 |
---|---|---|
committer | Brad Triebwasser <btriebw@chromium.org> | 2024-08-16 17:30:29 +0000 |
commit | eb31d19999fdf2018df4ae815a0fe130dd407532 (patch) | |
tree | 881a34b556b0b31652e6943090603c064771f552 | |
parent | 068d5ee1a3ac40dabd00d211d5013af44be55bea (diff) | |
download | leveldb-eb31d19999fdf2018df4ae815a0fe130dd407532.tar.gz leveldb-eb31d19999fdf2018df4ae815a0fe130dd407532.zip |
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
-rw-r--r-- | db/db_impl.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/db/db_impl.cc b/db/db_impl.cc index 1ec2afb..f96d245 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -629,6 +629,11 @@ void DBImpl::TEST_CompactRange(int level, const Slice* begin, background_work_finished_signal_.Wait(); } } + // Finish current background compaction in the case where + // `background_work_finished_signal_` was signalled due to an error. + while (background_compaction_scheduled_) { + background_work_finished_signal_.Wait(); + } if (manual_compaction_ == &manual) { // Cancel my manual compaction since we aborted early for some reason. manual_compaction_ = nullptr; |