From b8a9fd4e49e8923b3edffa53ffec3b6e46c50906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chojnowski?= Date: Thu, 19 Sep 2024 16:00:13 +0200 Subject: [PATCH] reader_concurrency_semaphore: in stats, fix swapped count_resources and memory_resources can_admit_read() returns reason::memory_resources when the permit is queued due to lack of count resources, and it returns reason::count_resources when the permit is queued due to lack of memory resources. It's supposed to be the other way around. This bug is causing the two counts to be swapped in the stat dumps printed to the logs when semaphores time out. (cherry picked from commit 6cf3747c5f4e330bb3c0748b97cb998ace9fdf47) Closes scylladb/scylladb#21030 --- reader_concurrency_semaphore.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reader_concurrency_semaphore.cc b/reader_concurrency_semaphore.cc index 9672910611..9b47489861 100644 --- a/reader_concurrency_semaphore.cc +++ b/reader_concurrency_semaphore.cc @@ -1367,7 +1367,7 @@ reader_concurrency_semaphore::can_admit_read(const reader_permit::impl& permit) } if (!has_available_units(permit.base_resources())) { - auto reason = _resources.memory >= permit.base_resources().memory ? reason::memory_resources : reason::count_resources; + auto reason = _resources.memory >= permit.base_resources().memory ? reason::count_resources : reason::memory_resources; if (_inactive_reads.empty()) { return {can_admit::no, reason}; } else {