]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: warn when cache pools do not have hit_sets configured 2179/head
authorSage Weil <sage@redhat.com>
Thu, 31 Jul 2014 18:02:55 +0000 (11:02 -0700)
committerSage Weil <sage@redhat.com>
Thu, 31 Jul 2014 18:03:19 +0000 (11:03 -0700)
Give users a clue when cache pools are enabled but the hit_set is not
configured.  Note that technically this will work, but not well, so for
now let's just steer them away.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/mon/OSDMonitor.cc
src/osd/osd_types.h

index fa11c21ad5a59ea371f6c96003bf74db3d262bb4..b07b6a7ed24652af7ac4497af16893e3956c002d 100644 (file)
@@ -178,6 +178,7 @@ OPTION(mon_force_standby_active, OPT_BOOL, true) // should mons force standby-re
 OPTION(mon_warn_on_old_mons, OPT_BOOL, true) // should mons set health to WARN if part of quorum is old?
 OPTION(mon_warn_on_legacy_crush_tunables, OPT_BOOL, true) // warn if crush tunables are not optimal
 OPTION(mon_warn_on_osd_down_out_interval_zero, OPT_BOOL, true) // warn if 'mon_osd_down_out_interval == 0'
+OPTION(mon_warn_on_cache_pools_without_hit_sets, OPT_BOOL, true)
 OPTION(mon_min_osdmap_epochs, OPT_INT, 500)
 OPTION(mon_max_pgmap_epochs, OPT_INT, 500)
 OPTION(mon_max_log_epochs, OPT_INT, 500)
index a8c2c64c6b45b1cf8f3fdde2c2bfc6e20fd70639..415ae19c473fa3d8201f52d6e7088a16ffd2d808 100644 (file)
@@ -2078,6 +2078,32 @@ void OSDMonitor::get_health(list<pair<health_status_t,string> >& summary,
       }
     }
 
+    // hit_set-less cache_mode?
+    if (g_conf->mon_warn_on_cache_pools_without_hit_sets) {
+      int problem_cache_pools = 0;
+      for (map<int64_t, pg_pool_t>::const_iterator p = osdmap.pools.begin();
+          p != osdmap.pools.end();
+          ++p) {
+       const pg_pool_t& info = p->second;
+       if (info.cache_mode_requires_hit_set() &&
+           info.hit_set_params.get_type() == HitSet::TYPE_NONE) {
+         ++problem_cache_pools;
+         if (detail) {
+           ostringstream ss;
+           ss << "pool '" << osdmap.get_pool_name(p->first)
+              << "' with cache_mode " << info.get_cache_mode_name()
+              << " needs hit_set_type to be set but it is not";
+           detail->push_back(make_pair(HEALTH_WARN, ss.str()));
+         }
+       }
+      }
+      if (problem_cache_pools) {
+       ostringstream ss;
+       ss << problem_cache_pools << " cache pools are missing hit_sets";
+       summary.push_back(make_pair(HEALTH_WARN, ss.str()));
+      }
+    }
+
     // Warn if 'mon_osd_down_out_interval' is set to zero.
     // Having this option set to zero on the leader acts much like the
     // 'noout' flag.  It's hard to figure out what's going wrong with clusters
index a311e6518856202a1fd4a8e3f6557459c0be6651..abbfe2c26754d724a436ec91404c7f40b7778292 100644 (file)
@@ -876,6 +876,19 @@ struct pg_pool_t {
   const char *get_cache_mode_name() const {
     return get_cache_mode_name(cache_mode);
   }
+  bool cache_mode_requires_hit_set() const {
+    switch (cache_mode) {
+    case CACHEMODE_NONE:
+    case CACHEMODE_FORWARD:
+    case CACHEMODE_READONLY:
+      return false;
+    case CACHEMODE_WRITEBACK:
+    case CACHEMODE_READFORWARD:
+      return true;
+    default:
+      assert(0 == "implement me");
+    }
+  }
 
   uint64_t flags;           ///< FLAG_*
   __u8 type;                ///< TYPE_*