reader_concurrency_semaphore: update stats w.r.t. recent permit state name changes
It is still using the old terminology for permit state names, bring it up to date with the recent state name changes.
This commit is contained in:
@@ -771,14 +771,14 @@ static void do_dump_reader_permit_diagnostics(std::ostream& os, const reader_con
|
||||
"reads_enqueued_for_memory: {}\n"
|
||||
"reads_admitted_immediately: {}\n"
|
||||
"reads_queued_because_ready_list: {}\n"
|
||||
"reads_queued_because_used_permits: {}\n"
|
||||
"reads_queued_because_need_cpu_permits: {}\n"
|
||||
"reads_queued_because_memory_resources: {}\n"
|
||||
"reads_queued_because_count_resources: {}\n"
|
||||
"reads_queued_with_eviction: {}\n"
|
||||
"total_permits: {}\n"
|
||||
"current_permits: {}\n"
|
||||
"used_permits: {}\n"
|
||||
"blocked_permits: {}\n"
|
||||
"need_cpu_permits: {}\n"
|
||||
"awaits_permits: {}\n"
|
||||
"disk_reads: {}\n"
|
||||
"sstables_read: {}",
|
||||
stats.permit_based_evictions,
|
||||
@@ -793,14 +793,14 @@ static void do_dump_reader_permit_diagnostics(std::ostream& os, const reader_con
|
||||
stats.reads_enqueued_for_memory,
|
||||
stats.reads_admitted_immediately,
|
||||
stats.reads_queued_because_ready_list,
|
||||
stats.reads_queued_because_used_permits,
|
||||
stats.reads_queued_because_need_cpu_permits,
|
||||
stats.reads_queued_because_memory_resources,
|
||||
stats.reads_queued_because_count_resources,
|
||||
stats.reads_queued_with_eviction,
|
||||
stats.total_permits,
|
||||
stats.current_permits,
|
||||
stats.used_permits,
|
||||
stats.blocked_permits,
|
||||
stats.need_cpu_permits,
|
||||
stats.awaits_permits,
|
||||
stats.disk_reads,
|
||||
stats.sstables_read);
|
||||
}
|
||||
@@ -1162,7 +1162,7 @@ bool reader_concurrency_semaphore::has_available_units(const resources& r) const
|
||||
}
|
||||
|
||||
bool reader_concurrency_semaphore::all_used_permits_are_stalled() const {
|
||||
return _stats.used_permits == _stats.blocked_permits;
|
||||
return _stats.need_cpu_permits == _stats.awaits_permits;
|
||||
}
|
||||
|
||||
std::exception_ptr reader_concurrency_semaphore::check_queue_size(std::string_view queue_name) {
|
||||
@@ -1280,7 +1280,7 @@ future<> reader_concurrency_semaphore::do_wait_admission(reader_permit::impl& pe
|
||||
static uint64_t stats::*stats_table[] = {
|
||||
&stats::reads_admitted_immediately,
|
||||
&stats::reads_queued_because_ready_list,
|
||||
&stats::reads_queued_because_used_permits,
|
||||
&stats::reads_queued_because_need_cpu_permits,
|
||||
&stats::reads_queued_because_memory_resources,
|
||||
&stats::reads_queued_because_count_resources
|
||||
};
|
||||
@@ -1288,7 +1288,7 @@ future<> reader_concurrency_semaphore::do_wait_admission(reader_permit::impl& pe
|
||||
static const char* result_as_string[] = {
|
||||
"admitted immediately",
|
||||
"queued because of non-empty ready list",
|
||||
"queued because of used permits",
|
||||
"queued because of need_cpu permits",
|
||||
"queued because of memory resources",
|
||||
"queued because of count resources"
|
||||
};
|
||||
@@ -1414,25 +1414,25 @@ void reader_concurrency_semaphore::on_permit_destroyed(reader_permit::impl& perm
|
||||
}
|
||||
|
||||
void reader_concurrency_semaphore::on_permit_used() noexcept {
|
||||
++_stats.used_permits;
|
||||
++_stats.need_cpu_permits;
|
||||
}
|
||||
|
||||
void reader_concurrency_semaphore::on_permit_unused() noexcept {
|
||||
assert(_stats.used_permits);
|
||||
--_stats.used_permits;
|
||||
assert(_stats.used_permits >= _stats.blocked_permits);
|
||||
assert(_stats.need_cpu_permits);
|
||||
--_stats.need_cpu_permits;
|
||||
assert(_stats.need_cpu_permits >= _stats.awaits_permits);
|
||||
maybe_admit_waiters();
|
||||
}
|
||||
|
||||
void reader_concurrency_semaphore::on_permit_blocked() noexcept {
|
||||
++_stats.blocked_permits;
|
||||
assert(_stats.used_permits >= _stats.blocked_permits);
|
||||
++_stats.awaits_permits;
|
||||
assert(_stats.need_cpu_permits >= _stats.awaits_permits);
|
||||
maybe_admit_waiters();
|
||||
}
|
||||
|
||||
void reader_concurrency_semaphore::on_permit_unblocked() noexcept {
|
||||
assert(_stats.blocked_permits);
|
||||
--_stats.blocked_permits;
|
||||
assert(_stats.awaits_permits);
|
||||
--_stats.awaits_permits;
|
||||
}
|
||||
|
||||
future<reader_permit> reader_concurrency_semaphore::obtain_permit(const schema* const schema, const char* const op_name, size_t memory,
|
||||
|
||||
@@ -100,8 +100,8 @@ public:
|
||||
uint64_t reads_admitted_immediately = 0;
|
||||
// Total number of reads enqueued because ready_list wasn't empty
|
||||
uint64_t reads_queued_because_ready_list = 0;
|
||||
// Total number of reads enqueued because there are used but unblocked permits
|
||||
uint64_t reads_queued_because_used_permits = 0;
|
||||
// Total number of reads enqueued because there are permits who need CPU to make progress
|
||||
uint64_t reads_queued_because_need_cpu_permits = 0;
|
||||
// Total number of reads enqueued because there weren't enough memory resources
|
||||
uint64_t reads_queued_because_memory_resources = 0;
|
||||
// Total number of reads enqueued because there weren't enough count resources
|
||||
@@ -112,10 +112,10 @@ public:
|
||||
uint64_t total_permits = 0;
|
||||
// Current number of permits.
|
||||
uint64_t current_permits = 0;
|
||||
// Current number of used permits.
|
||||
uint64_t used_permits = 0;
|
||||
// Current number of blocked permits.
|
||||
uint64_t blocked_permits = 0;
|
||||
// Current number permits needing CPU to make progress.
|
||||
uint64_t need_cpu_permits = 0;
|
||||
// Current number of permits awaiting I/O or an operation running on a remote shard.
|
||||
uint64_t awaits_permits = 0;
|
||||
// Current number of reads reading from the disk.
|
||||
uint64_t disk_reads = 0;
|
||||
// The number of sstables read currently.
|
||||
|
||||
@@ -863,8 +863,8 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_used_blocked) {
|
||||
auto stop_sem = deferred_stop(semaphore);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 0);
|
||||
|
||||
auto permit = semaphore.obtain_permit(nullptr, get_name(), 1024, db::no_timeout, {}).get0();
|
||||
|
||||
@@ -880,31 +880,31 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_used_blocked) {
|
||||
used.emplace_back(permit);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 0);
|
||||
break;
|
||||
case 1:
|
||||
used.emplace_back(permit);
|
||||
blocked.emplace_back(permit);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 1);
|
||||
break;
|
||||
case 2:
|
||||
blocked.emplace_back(permit);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 0);
|
||||
break;
|
||||
case 3:
|
||||
blocked.emplace_back(permit);
|
||||
used.emplace_back(permit);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 1);
|
||||
break;
|
||||
default:
|
||||
count = tests::random::get_int<unsigned>(3, 100);
|
||||
@@ -924,12 +924,12 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_used_blocked) {
|
||||
if (pop_used) {
|
||||
used.pop_back();
|
||||
if (used.empty()) {
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 0);
|
||||
}
|
||||
} else {
|
||||
blocked.pop_back();
|
||||
if (blocked.empty()) {
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1023,8 +1023,8 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_evict_inactive_reads_
|
||||
auto p3_fut = semaphore.obtain_permit(&s, get_name(), 1024, db::no_timeout, {});
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().waiters, 2); // (waiters includes _ready_list entries)
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().reads_enqueued_for_admission, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 0); // permit looses used status while waiting for execution
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 0); // permit looses used status while waiting for execution
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().inactive_reads, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().permit_based_evictions, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.available_resources().count, 0);
|
||||
@@ -1033,8 +1033,8 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_evict_inactive_reads_
|
||||
// Start the read emptying the ready list, this should not be enough to admit p3
|
||||
rd2.wait_read_started().get();
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().waiters, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().inactive_reads, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().permit_based_evictions, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.available_resources().count, 0);
|
||||
@@ -1043,8 +1043,8 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_evict_inactive_reads_
|
||||
// Marking p2 as blocked should now allow p3 to be admitted by evicting p1
|
||||
rd2.mark_as_blocked();
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().waiters, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().inactive_reads, 0);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().permit_based_evictions, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.available_resources().count, 0);
|
||||
@@ -1502,14 +1502,14 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_request_memory_preser
|
||||
testlog.info("do_check() {}:{}", sl.file_name(), sl.line());
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 2);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, used);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, blocked);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, used);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, blocked);
|
||||
|
||||
auto units1 = permit.request_memory(1024).get();
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 2);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, used);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, blocked);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, used);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, blocked);
|
||||
|
||||
auto sponge_units = sponge_permit.request_memory(8 * 1024).get();
|
||||
|
||||
@@ -1523,8 +1523,8 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_request_memory_preser
|
||||
auto units2 = units2_fut.get();
|
||||
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().current_permits, 2);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().used_permits, used);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().blocked_permits, blocked);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().need_cpu_permits, used);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().awaits_permits, blocked);
|
||||
};
|
||||
|
||||
// unused
|
||||
@@ -1723,7 +1723,7 @@ SEASTAR_THREAD_TEST_CASE(test_reader_concurrency_semaphore_no_unnecessary_evicti
|
||||
|
||||
auto permit4_fut = semaphore.obtain_permit(nullptr, get_name(), 1024, db::no_timeout, {});
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().waiters, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().reads_queued_because_used_permits, 1);
|
||||
BOOST_REQUIRE_EQUAL(semaphore.get_stats().reads_queued_because_need_cpu_permits, 1);
|
||||
|
||||
// First check the register path.
|
||||
auto handle = semaphore.register_inactive_read(make_empty_flat_reader_v2(s, permit3));
|
||||
|
||||
Reference in New Issue
Block a user