]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: distinguish between definitely healthy and definitely not unhealthy
authorSage Weil <sage@inktank.com>
Wed, 29 May 2013 20:15:41 +0000 (13:15 -0700)
committerSage Weil <sage@inktank.com>
Thu, 30 May 2013 05:43:49 +0000 (22:43 -0700)
is_unhealthy() will assume they are healthy for some period after we
send our first ping attempt.  is_healthy() is now a strict check that we
know they are healthy.

Switch the failure report check to use is_unhealthy(); use is_healthy()
everywhere else, including the waiting-for-healthy pre-boot checks.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h

index 0e65172723cf02e642970e1318879b8aeb31fb58..f08a63a8ae3492e1e45aafe76553e644dee338c2 100644 (file)
@@ -2592,7 +2592,7 @@ void OSD::heartbeat_check()
             << " last_rx_back " << p->second.last_rx_back
             << " last_rx_front " << p->second.last_rx_front
             << dendl;
-    if (!p->second.is_healthy(cutoff)) {
+    if (p->second.is_unhealthy(cutoff)) {
       if (p->second.last_rx_back == utime_t() ||
          p->second.last_rx_front == utime_t()) {
        derr << "heartbeat_check: no reply from osd." << p->first
index 4eb7c9f330addaffbcbf89bcbd3fe6373f125dcc..50f7c9c073d5b4849f1eca398993fdee4deaadbd 100644 (file)
@@ -704,15 +704,19 @@ private:
     utime_t last_rx_back;   ///< last time we got a ping reply on the back side
     epoch_t epoch;      ///< most recent epoch we wanted this peer
 
-    bool is_healthy(utime_t cutoff) {
+    bool is_unhealthy(utime_t cutoff) {
       return
-       (last_rx_front > cutoff ||
-        (last_rx_front == utime_t() && (last_tx == utime_t() ||
-                                        first_tx > cutoff))) &&
-       (last_rx_back > cutoff ||
-        (last_rx_back == utime_t() && (last_tx == utime_t() ||
-                                       first_tx > cutoff)));
+       ! ((last_rx_front > cutoff ||
+           (last_rx_front == utime_t() && (last_tx == utime_t() ||
+                                           first_tx > cutoff))) &&
+          (last_rx_back > cutoff ||
+           (last_rx_back == utime_t() && (last_tx == utime_t() ||
+                                          first_tx > cutoff))));
+    }
+    bool is_healthy(utime_t cutoff) {
+      return last_rx_front > cutoff && last_rx_back > cutoff;
     }
+
   };
   /// state attached to outgoing heartbeat connections
   struct HeartbeatSession : public RefCountedObject {