]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pgmon: remove the PGMonitor update_full_ratios stuff
authorGreg Farnum <gregory.farnum@dreamhost.com>
Wed, 18 Apr 2012 16:34:30 +0000 (09:34 -0700)
committerGreg Farnum <gregory.farnum@dreamhost.com>
Wed, 18 Apr 2012 18:05:13 +0000 (11:05 -0700)
Making it a config watcher is just a huge mess in terms of consistently
updating it appropriately.
The next commit will add a monitor command for changing it.

Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
src/mon/PGMonitor.cc
src/mon/PGMonitor.h

index 8d8a2190bbfc2a309201b31c8927b99d22f1f616..55c3ecad0f73a18c9788c7ef07394a7246a6a8b8 100644 (file)
@@ -50,40 +50,12 @@ static ostream& _prefix(std::ostream *_dout, const Monitor *mon, const PGMap& pg
                << ").pg v" << pg_map.version << " ";
 }
 
-class RatioMonitor : public md_config_obs_t {
-  PGMonitor *mon;
-public:
-  RatioMonitor(PGMonitor *pgmon) : mon(pgmon) {}
-  virtual ~RatioMonitor() {}
-  virtual const char **get_tracked_conf_keys() const {
-    static const char *KEYS[] = { "mon_osd_full_ratio",
-                                 "mon_osd_nearfull_ratio",
-                                 NULL };
-    return KEYS;
-  }
-  virtual void handle_conf_change(const md_config_t *conf,
-                                 const std::set<std::string>& changed) {
-    mon->update_full_ratios(conf->mon_osd_full_ratio,
-                           conf->mon_osd_nearfull_ratio);
-  }
-};
-
 PGMonitor::PGMonitor(Monitor *mn, Paxos *p)
   : PaxosService(mn, p),
-    ratio_lock("PGMonitor::ratio_lock"),
-    need_full_ratio_update(false),
-    need_nearfull_ratio_update(false),
     need_check_down_pgs(false)
-{
-  ratio_monitor = new RatioMonitor(this);
-  g_conf->add_observer(ratio_monitor);
-}
+{ }
 
-PGMonitor::~PGMonitor()
-{
-  g_conf->remove_observer(ratio_monitor);
-  delete ratio_monitor;
-}
+PGMonitor::~PGMonitor() {}
 
 /*
  Tick function to update the map based on performance every N seconds
@@ -139,26 +111,6 @@ void PGMonitor::update_logger()
   mon->cluster_logger->set(l_cluster_num_bytes, pg_map.pg_sum.stats.sum.num_bytes);
 }
 
-void PGMonitor::update_full_ratios(float full_ratio, float nearfull_ratio)
-{
-  Mutex::Locker l(ratio_lock);
-
-  if (full_ratio > 1.0)
-    full_ratio /= 100.0;
-  if (nearfull_ratio > 1.0)
-    nearfull_ratio /= 100.0;
-
-  dout(10) << "update_full_ratios full " << full_ratio << " nearfull " << nearfull_ratio << dendl;
-  if (full_ratio != 0) {
-    new_full_ratio = full_ratio;
-    need_full_ratio_update = true;
-  }
-  if (nearfull_ratio != 0) {
-    new_nearfull_ratio = nearfull_ratio;
-    need_nearfull_ratio_update = true;
-  }
-}
-
 void PGMonitor::tick() 
 {
   if (!paxos->is_active()) return;
@@ -167,25 +119,7 @@ void PGMonitor::tick()
   handle_osd_timeouts();
 
   if (mon->is_leader()) {
-    ratio_lock.Lock();
     bool propose = false;
-    if (need_full_ratio_update) {
-      dout(10) << "tick need full ratio update " << new_full_ratio << dendl;
-      need_full_ratio_update = false;
-      if (pg_map.full_ratio != new_full_ratio) {
-       pending_inc.full_ratio = new_full_ratio;
-       propose = true;
-      }
-    }
-    if (need_nearfull_ratio_update) {
-      dout(10) << "tick need nearfull ratio update " << new_nearfull_ratio << dendl;
-      need_nearfull_ratio_update = false;
-      if (pg_map.nearfull_ratio != new_nearfull_ratio) {
-       pending_inc.nearfull_ratio = new_nearfull_ratio;
-       propose = true;
-      }
-    }
-    ratio_lock.Unlock();
     
     if (need_check_down_pgs && check_down_pgs())
       propose = true;
index dad27db892bc0243acf27b86a9e90c77a4a5d285..21edb185e72c14189df1837d14abba4c90490480 100644 (file)
@@ -43,10 +43,6 @@ class PGMonitor : public PaxosService {
 public:
   PGMap pg_map;
 
-  Mutex ratio_lock;
-  bool need_full_ratio_update, need_nearfull_ratio_update;
-  float new_full_ratio, new_nearfull_ratio;
-
   bool need_check_down_pgs;
 
 private:
@@ -68,8 +64,6 @@ private:
   bool prepare_pg_stats(MPGStats *stats);
   void _updated_stats(MPGStats *req, MPGStatsAck *ack);
 
-  void update_full_ratios(float full_ratio, float nearfull_ratio);
-
   struct C_Stats : public Context {
     PGMonitor *pgmon;
     MPGStats *req;
@@ -146,9 +140,6 @@ private:
   // no copying allowed
   PGMonitor(const PGMonitor &rhs);
   PGMonitor &operator=(const PGMonitor &rhs);
-
-  RatioMonitor *ratio_monitor;
-  friend class RatioMonitor;
 };
 
 #endif