From b1254f602a2f82abd7e79eca803ad5b5406b181f Mon Sep 17 00:00:00 2001 From: kostas Date: Thu, 7 Nov 2024 17:54:35 +0200 Subject: [PATCH] fix notify deadlock --- src/server/common.h | 2 +- src/server/db_slice.cc | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/common.h b/src/server/common.h index 7099897a2b6d..2d935dc19746 100644 --- a/src/server/common.h +++ b/src/server/common.h @@ -416,7 +416,7 @@ class LocalBlockingCounter { DCHECK(mutating_ > 0); --mutating_; if (mutating_ == 0) { - cond_var_.notify_one(); + cond_var_.notify_all(); } } diff --git a/src/server/db_slice.cc b/src/server/db_slice.cc index 2eebf79c27cd..ad8f471a5ce0 100644 --- a/src/server/db_slice.cc +++ b/src/server/db_slice.cc @@ -1132,11 +1132,6 @@ DbSlice::PrimeItAndExp DbSlice::ExpireIfNeeded(const Context& cntx, PrimeIterato << ", prime table size: " << db->prime.size() << util::fb2::GetStacktrace(); } - // Replicate expiry - if (auto journal = owner_->journal(); journal) { - RecordExpiry(cntx.db_index, key); - } - if (expired_keys_events_recording_) db->expired_keys_events_.emplace_back(key); @@ -1148,6 +1143,11 @@ DbSlice::PrimeItAndExp DbSlice::ExpireIfNeeded(const Context& cntx, PrimeIterato const_cast(this)->PerformDeletion(Iterator(it, StringOrView::FromView(key)), ExpIterator(expire_it, StringOrView::FromView(key)), db.get()); + // Replicate expiry + if (auto journal = owner_->journal(); journal) { + RecordExpiry(cntx.db_index, key); + } + ++events_.expired_keys; return {PrimeIterator{}, ExpireIterator{}};