summaryrefslogtreecommitdiff
path: root/src/osd/OSD.h
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-05-22 08:44:52 -0700
committerSage Weil <sage@inktank.com>2013-05-22 16:13:37 -0700
commit27381c0c6259ac89f5f9c592b4bfb585937a1cfc (patch)
tree29e50e07a7ee4a4670036e7fa371b9ad7ee4849d /src/osd/OSD.h
parent92a558bf0e5fee6d5250e1085427bff22fe4bbe4 (diff)
downloadceph-27381c0c6259ac89f5f9c592b4bfb585937a1cfc.tar.gz
osd: ping both front and back interfaces
Send ping requests to both the front and back hb addrs for peer osds. If the front hb addr is not present, do not send it and interpret a reply as coming from both. This handles the transition from old to new OSDs seamlessly. Note both the front and back rx times. Both need to be up to date in order for the peer to be healthy. Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/osd/OSD.h')
-rw-r--r--src/osd/OSD.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/osd/OSD.h b/src/osd/OSD.h
index b26e0598f4c..428284c85ab 100644
--- a/src/osd/OSD.h
+++ b/src/osd/OSD.h
@@ -295,7 +295,7 @@ public:
next_osdmap = map;
}
ConnectionRef get_con_osd_cluster(int peer, epoch_t from_epoch);
- ConnectionRef get_con_osd_hb(int peer, epoch_t from_epoch);
+ pair<ConnectionRef,ConnectionRef> get_con_osd_hb(int peer, epoch_t from_epoch); // (back, front)
void send_message_osd_cluster(int peer, Message *m, epoch_t from_epoch);
void send_message_osd_cluster(Message *m, Connection *con) {
cluster_messenger->send_message(m, con);
@@ -696,11 +696,23 @@ private:
/// information about a heartbeat peer
struct HeartbeatInfo {
int peer; ///< peer
- Connection *con; ///< peer connection
+ Connection *con_front; ///< peer connection (front)
+ Connection *con_back; ///< peer connection (back)
utime_t first_tx; ///< time we sent our first ping request
utime_t last_tx; ///< last time we sent a ping request
- utime_t last_rx; ///< last time we got a ping reply
+ utime_t last_rx_front; ///< last time we got a ping reply on the front side
+ 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) {
+ 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)));
+ }
};
/// state attached to outgoing heartbeat connections
struct HeartbeatSession : public RefCountedObject {