From 05fc753866cd526de19eca2775b059a9e8ea0802 Mon Sep 17 00:00:00 2001 From: Udi Date: Sun, 25 Dec 2022 14:35:52 +0200 Subject: [PATCH] Print WBM's cache info to log (#312) --- cache/cache_reservation_manager.h | 2 ++ memtable/write_buffer_manager.cc | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/cache/cache_reservation_manager.h b/cache/cache_reservation_manager.h index 08bf59b006..a4762dea4b 100644 --- a/cache/cache_reservation_manager.h +++ b/cache/cache_reservation_manager.h @@ -202,6 +202,8 @@ class CacheReservationManagerImpl // test are from the same translation units static const Cache::CacheItemHelper *TEST_GetCacheItemHelperForRole(); + const Cache *TEST_GetCache() const { return cache_.get(); } + private: static constexpr std::size_t kSizeDummyEntry = 256 * 1024; diff --git a/memtable/write_buffer_manager.cc b/memtable/write_buffer_manager.cc index 88cb6a04af..09e95f1257 100644 --- a/memtable/write_buffer_manager.cc +++ b/memtable/write_buffer_manager.cc @@ -270,6 +270,16 @@ std::string WriteBufferManager::GetPrintableOptions() const { "wbm.size", buffer_size()); ret.append(buffer); + const Cache* cache = nullptr; + if (cache_res_mgr_ != nullptr) { + cache = + static_cast*>( + cache_res_mgr_.get()) + ->TEST_GetCache(); + } + snprintf(buffer, kBufferSize, "%*s: %p\n", field_width, "wbm.cache", cache); + ret.append(buffer); + snprintf(buffer, kBufferSize, "%*s: %d\n", field_width, "wbm.allow_stalls", allow_stall_); ret.append(buffer);