summaryrefslogtreecommitdiff
path: root/src/osd/OSD.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/OSD.h')
-rw-r--r--src/osd/OSD.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/osd/OSD.h b/src/osd/OSD.h
index 99d75dc40ad..effbb5e3533 100644
--- a/src/osd/OSD.h
+++ b/src/osd/OSD.h
@@ -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 {
@@ -730,8 +734,10 @@ private:
Messenger *hbclient_messenger;
Messenger *hb_front_server_messenger;
Messenger *hb_back_server_messenger;
+ utime_t last_heartbeat_resample; ///< last time we chose random peers in waiting-for-healthy state
void _add_heartbeat_peer(int p);
+ void _remove_heartbeat_peer(int p);
bool heartbeat_reset(Connection *con);
void maybe_update_heartbeat_peers();
void reset_heartbeat_peers();
@@ -740,6 +746,11 @@ private:
void heartbeat_entry();
void need_heartbeat_peer_update();
+ void heartbeat_kick() {
+ Mutex::Locker l(heartbeat_lock);
+ heartbeat_cond.Signal();
+ }
+
struct T_Heartbeat : public Thread {
OSD *osd;
T_Heartbeat(OSD *o) : osd(o) {}
@@ -1116,6 +1127,9 @@ protected:
void start_boot();
void _maybe_boot(epoch_t oldest, epoch_t newest);
void _send_boot();
+
+ void start_waiting_for_healthy();
+ bool _is_healthy();
friend class C_OSD_GetVersion;