From 01671e19be3ed88e8adf6e94e37e199ad0b79934 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 5 Dec 2019 13:34:19 -0600 Subject: [PATCH] mon/OSDMonitor: make memory autotune disable itself if no rocksdb Currently, we crash (failed assertion). Instead, just disable autotuning. Signed-off-by: Sage Weil (cherry picked from commit 68eea44c118f862c752781bb20f75e6f51749329) --- src/mon/OSDMonitor.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 799e57f0fd5ad..3f3bfe26b0a3b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -430,20 +430,22 @@ void OSDMonitor::handle_conf_change(const ConfigProxy& conf, void OSDMonitor::_set_cache_autotuning() { - mon_memory_autotune = g_conf()->mon_memory_autotune; - if (!mon_memory_autotune && pcm != nullptr) { + if (!g_conf()->mon_memory_autotune && pcm != nullptr) { // Disable cache autotuning std::lock_guard l(balancer_lock); pcm = nullptr; } - if (mon_memory_autotune && pcm == nullptr) { + if (g_conf()->mon_memory_autotune && pcm == nullptr) { int r = register_cache_with_pcm(); if (r < 0) { dout(10) << __func__ << " Error while registering osdmon caches with pcm." << " Cache auto tuning not enabled." << dendl; + mon_memory_autotune = false; + } else { + mon_memory_autotune = true; } } } @@ -879,7 +881,10 @@ int OSDMonitor::register_cache_with_pcm() } rocksdb_binned_kv_cache = mon->store->get_priority_cache(); - ceph_assert(rocksdb_binned_kv_cache); + if (!rocksdb_binned_kv_cache) { + derr << __func__ << " not using rocksdb" << dendl; + return -EINVAL; + } int r = _set_cache_ratios(); if (r < 0) { -- 2.39.5