diff --git a/reader_concurrency_semaphore.cc b/reader_concurrency_semaphore.cc index 9fb18317c4..006139a265 100644 --- a/reader_concurrency_semaphore.cc +++ b/reader_concurrency_semaphore.cc @@ -249,6 +249,10 @@ public: return _base_resources; } + void release_base_resources() noexcept { + _semaphore.signal(std::exchange(_base_resources, {})); + } + sstring description() const { return format("{}.{}:{}", _schema ? _schema->ks_name() : "*", @@ -394,6 +398,10 @@ reader_resources reader_permit::base_resources() const { return _impl->base_resources(); } +void reader_permit::release_base_resources() noexcept { + return _impl->release_base_resources(); +} + sstring reader_permit::description() const { return _impl->description(); } diff --git a/reader_permit.hh b/reader_permit.hh index 8a0c85e659..6cefbda790 100644 --- a/reader_permit.hh +++ b/reader_permit.hh @@ -161,6 +161,8 @@ public: reader_resources base_resources() const; + void release_base_resources() noexcept; + sstring description() const; db::timeout_clock::time_point timeout() const noexcept; diff --git a/repair/row_level.cc b/repair/row_level.cc index 4a4e1af66b..02217ad5dc 100644 --- a/repair/row_level.cc +++ b/repair/row_level.cc @@ -407,6 +407,10 @@ public: {}, mutation_reader::forwarding::no); } else { + // We can't have two permits with count resource for 1 repair. + // So we release the one on _permit so the only one is the one the + // shard reader will obtain. + _permit.release_base_resources(); _reader = make_multishard_streaming_reader(db, _schema, _permit, [this] { auto shard_range = _sharder.next(); if (shard_range) {