]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: make memory autotune disable itself if no rocksdb 32045/head
authorSage Weil <sage@redhat.com>
Thu, 5 Dec 2019 19:34:19 +0000 (13:34 -0600)
committerSage Weil <sage@redhat.com>
Thu, 5 Dec 2019 19:35:31 +0000 (13:35 -0600)
Currently, we crash (failed assertion). Instead, just disable autotuning.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 68eea44c118f862c752781bb20f75e6f51749329)

src/mon/OSDMonitor.cc

index 799e57f0fd5ad6b4a36498ea3c9831a55a1af302..3f3bfe26b0a3b24b0ab5f6d8be76a2d0d160d434 100644 (file)
@@ -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) {