]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: make memory autotune disable itself if no rocksdb 32044/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:34:39 +0000 (13:34 -0600)
Currently, we crash (failed assertion). Instead, just disable autotuning.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index e4b3b2c0fe2e3df7f2bfadab945696d41aae3a11..d0d5131ee15db31253731916a00f070169dca131 100644 (file)
@@ -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) {