]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: no delay for single message MSG_ALIVE and MSG_PGTEMP 12107/head
authoryaoning <yaoning@unitedstack.com>
Thu, 24 Nov 2016 06:35:58 +0000 (14:35 +0800)
committeryaoning <yaoning@unitedstack.com>
Thu, 12 Jan 2017 01:04:19 +0000 (09:04 +0800)
delay and batch proposed as before if lots of messages arrive at the same time

if too many messages are MSG_ALIVE and MSG_PGTEMP, wait a long period as before

Signed-off-by: yaoning <yaoning@unitedstack.com>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/mon/Paxos.h

index 082eee77df69341087d722c1ddf11051ba691808..731fb2764ab6365093087b6edfaca3af2e4baaa9 100644 (file)
@@ -80,6 +80,7 @@ OSDMonitor::OSDMonitor(CephContext *cct, Monitor *mn, Paxos *p, const string& se
    cct(cct),
    inc_osd_cache(g_conf->mon_osd_cache_size),
    full_osd_cache(g_conf->mon_osd_cache_size),
+   last_attempted_minwait_time(utime_t()),
    op_tracker(cct, true, 1)
 {}
 
@@ -1364,6 +1365,22 @@ bool OSDMonitor::should_propose(double& delay)
     return true;
   }
 
+  // propose as fast as possible if updating up_thru or pg_temp
+  // want to merge OSDMap changes as much as possible
+  if ((pending_inc.new_primary_temp.size() == 1
+      || pending_inc.new_up_thru.size() == 1)
+      && pending_inc.new_state.size() < 2) {
+    dout(15) << " propose as fast as possible for up_thru/pg_temp" << dendl;
+
+    utime_t now = ceph_clock_now();
+    if (now - last_attempted_minwait_time > g_conf->paxos_propose_interval
+       && now - paxos->get_last_commit_time() > g_conf->paxos_min_wait) {
+      delay = g_conf->paxos_min_wait;
+      last_attempted_minwait_time = now;
+      return true;
+    }
+  }
+
   return PaxosService::should_propose(delay);
 }
 
index 612870ec72cf87c940409ca9f2023d72074a2c07..9fa41729f6f29385868e34f8f23fc9021f076436 100644 (file)
@@ -131,6 +131,9 @@ private:
   bool check_failure(utime_t now, int target_osd, failure_info_t& fi);
   void force_failure(utime_t now, int target_osd);
 
+  // the time of last msg(MSG_ALIVE and MSG_PGTEMP) proposed without delay
+  utime_t last_attempted_minwait_time;
+
   bool _have_pending_crush();
   CrushWrapper &_get_stable_crush();
   void _get_pending_crush(CrushWrapper& newcrush);
index 99caf77c0319193d989721fd8920276f8a2c4025..3c5a15f9c24a2420288b1c7e40f70ddc6bc077b6 100644 (file)
@@ -1212,6 +1212,14 @@ public:
    * @return the first committed version
    */
   version_t get_first_committed() { return first_committed; }
+  /** 
+   * Get the last commit time
+   *
+   * @returns Our last commit time
+  */
+  utime_t get_last_commit_time() const{
+    return last_commit_time;
+  }
   /**
    * Check if a given version is readable.
    *