]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: adjust or decay laggy probabilities on osd boot
authorSage Weil <sage@inktank.com>
Tue, 28 Aug 2012 03:02:12 +0000 (20:02 -0700)
committerSage Weil <sage@inktank.com>
Tue, 18 Sep 2012 21:38:59 +0000 (14:38 -0700)
On each osd boot, determine whether the osd was laggy (wrongly marked down)
or newly booted.  Either update the laggy probability and interval or
decay the values, as appropriate.

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

index 21e4e6588f4ef8b55f0932aee18262a37e001a35..d44873a5d0eb6d381167a5b4d0bab481e460617b 100644 (file)
@@ -886,6 +886,21 @@ bool OSDMonitor::prepare_boot(MOSDBoot *m)
       pending_inc.new_last_clean_interval[from] = pair<epoch_t,epoch_t>(begin, end);
     }
 
+    osd_xinfo_t xi = osdmap.get_xinfo(from);
+    if (m->boot_epoch == 0) {
+      xi.laggy_probability = xi.laggy_probability / 3;
+      xi.laggy_interval = xi.laggy_interval / 3;
+      dout(10) << " not laggy, new xi " << xi << dendl;
+    } else {
+      if (xi.down_stamp.sec()) {
+       int interval = ceph_clock_now(g_ceph_context).sec() - xi.down_stamp.sec();
+       xi.laggy_interval = (xi.laggy_interval * 2 + interval) / 3;
+      }
+      xi.laggy_probability = ((long long)xi.laggy_probability * 2ull + 0xffffffffull) / 3;
+      dout(10) << " laggy, now xi " << xi << dendl;
+    }
+    pending_inc.new_xinfo[from] = xi;
+
     // wait
     paxos->wait_for_commit(new C_Booted(this, m));
   }