]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: Don't update mon cache settings if rocksdb is not used 32520/head
authorSridhar Seshasayee <sseshasa@redhat.com>
Fri, 3 Jan 2020 09:26:13 +0000 (14:56 +0530)
committerSridhar Seshasayee <sseshasa@redhat.com>
Tue, 7 Jan 2020 10:25:02 +0000 (15:55 +0530)
Currently any update to mon cache config settings like 'mon_memory_target'
or 'rocksdb_cache_size' will cause a crash in case rocksdb and priority
cache manager is not being used.

If rocksdb (and therefore priority cache manager) is not being used, then
the update to the mon caches is ignored. Also, reduce the log levels of
some important log messages to help in debugging.

Fixes: https://tracker.ceph.com/issues/43454
Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
(cherry picked from commit b9e7a7af98ca284f4febc37fede58345ecb8a1d1)

src/mon/OSDMonitor.cc

index 3f3bfe26b0a3b24b0ab5f6d8be76a2d0d160d434..f7ee5b1209abf6f6af9512ca1334c39c1082b999 100644 (file)
@@ -422,7 +422,7 @@ void OSDMonitor::handle_conf_change(const ConfigProxy& conf,
            << g_conf()->mon_memory_target
            << " rocksdb_cache_size:"
            << g_conf()->rocksdb_cache_size
-           << ". Invalid size provided."
+           << ". Unable to update cache size."
            << dendl;
     }
   }
@@ -458,6 +458,11 @@ int OSDMonitor::_update_mon_cache_settings()
     return -EINVAL;
   }
 
+  if (pcm == nullptr && rocksdb_binned_kv_cache == nullptr) {
+    derr << __func__ << " not using pcm and rocksdb" << dendl;
+    return -EINVAL;
+  }
+
   uint64_t old_mon_memory_target = mon_memory_target;
   uint64_t old_rocksdb_cache_size = rocksdb_cache_size;
 
@@ -496,7 +501,7 @@ int OSDMonitor::_update_mon_cache_settings()
     pcm->tune_memory();
     pcm->balance();
     _set_new_cache_sizes();
-    dout(10) << __func__ << " Updated mon cache setting."
+    dout(1) << __func__ << " Updated mon cache setting."
              << " target: " << target
              << " min: " << min
              << " max: " << max
@@ -899,7 +904,7 @@ int OSDMonitor::register_cache_with_pcm()
   pcm->insert("kv", rocksdb_binned_kv_cache, true);
   pcm->insert("inc", inc_cache, true);
   pcm->insert("full", full_cache, true);
-  dout(10) << __func__ << " pcm target: " << target
+  dout(1) << __func__ << " pcm target: " << target
            << " pcm max: " << max
            << " pcm min: " << min
            << " inc_osd_cache size: " << inc_osd_cache.get_size()
@@ -925,7 +930,7 @@ int OSDMonitor::_set_cache_ratios()
   inc_cache->set_cache_ratio(cache_inc_ratio);
   full_cache->set_cache_ratio(cache_full_ratio);
 
-  dout(10) << __func__ << " kv ratio " << cache_kv_ratio
+  dout(1) << __func__ << " kv ratio " << cache_kv_ratio
            << " inc ratio " << cache_inc_ratio
            << " full ratio " << cache_full_ratio
            << dendl;
@@ -4836,7 +4841,7 @@ void OSDMonitor::_set_new_cache_sizes()
   inc_osd_cache.set_bytes(inc_alloc);
   full_osd_cache.set_bytes(full_alloc);
 
-  dout(10) << __func__ << " cache_size:" << cache_size
+  dout(1) << __func__ << " cache_size:" << cache_size
            << " inc_alloc: " << inc_alloc
            << " full_alloc: " << full_alloc
            << " kv_alloc: " << kv_alloc