multishard_mutation_query: read_context::stop: properly close unregistered inactive_reads

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2021-02-10 19:21:07 +02:00
parent 93d6dcdbcf
commit cd0991f28d

View File

@@ -358,7 +358,8 @@ future<> read_context::stop() {
return parallel_for_each(smp::all_cpus(), [this] (unsigned shard) {
if (_readers[shard].handle && *_readers[shard].handle) {
return _db.invoke_on(shard, [rm = std::move(_readers[shard])] (database& db) mutable {
rm.rparts->permit.semaphore().unregister_inactive_read(std::move(*rm.handle));
auto reader_opt = rm.rparts->permit.semaphore().unregister_inactive_read(std::move(*rm.handle));
return reader_opt ? reader_opt->close() : make_ready_future<>();
});
}
return make_ready_future<>();