From: Sage Weil Date: Thu, 5 Dec 2019 19:34:19 +0000 (-0600) Subject: mon/OSDMonitor: make memory autotune disable itself if no rocksdb X-Git-Tag: v15.1.0~619^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F32044%2Fhead;p=ceph.git mon/OSDMonitor: make memory autotune disable itself if no rocksdb Currently, we crash (failed assertion). Instead, just disable autotuning. Signed-off-by: Sage Weil --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index e4b3b2c0fe2e3..d0d5131ee15db 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -464,20 +464,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; } } } @@ -913,7 +915,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) {