Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <failure-detector.h>
Public Types | |
enum | PeerState { FAILED = 0, SUSPECTED = 1, OK = 2, UNKNOWN = 3 } |
Public Member Functions | |
MissedHeartbeatFailureDetector (int32_t max_missed_heartbeats, int32_t suspect_missed_heartbeats) | |
virtual PeerState | UpdateHeartbeat (const std::string &peer, bool seen) |
virtual PeerState | GetPeerState (const std::string &peer) |
Returns the current estimated state of a peer. More... | |
virtual void | EvictPeer (const std::string &peer) |
Remove a peer from the failure detector completely. More... | |
Static Public Member Functions | |
static const std::string & | PeerStateToString (PeerState peer_state) |
Utility method to convert a PeerState enum to a string. More... | |
Private Attributes | |
boost::mutex | lock_ |
Protects all members. More... | |
int32_t | max_missed_heartbeats_ |
int32_t | suspect_missed_heartbeats_ |
std::map< std::string, int32_t > | missed_heartbeat_counts_ |
Number of consecutive heartbeats missed by peer. More... | |
A failure detector based on a maximum number of consecutive heartbeats missed before a peer is considered failed. Clients must call UpdateHeartbeat(..., false) to indicate that a heartbeat has been missed. The MissedHeartbeatFailureDetector is most appropriate when heartbeats are being sent, not being received, because it is easy in that situation to tell when a heartbeat has not been successful. Not thread safe.
Definition at line 108 of file failure-detector.h.
|
inherited |
Enumerator | |
---|---|
FAILED | |
SUSPECTED | |
OK | |
UNKNOWN |
Definition at line 35 of file failure-detector.h.
|
inline |
max_missed_heartbeats -> the number of heartbeats that can be missed before a peer is considered failed. suspect_missed_heartbeats -> the number of heartbeats that can be missed before a peer is suspected of failure.
Definition at line 114 of file failure-detector.h.
|
virtual |
Remove a peer from the failure detector completely.
Implements impala::FailureDetector.
Definition at line 103 of file failure-detector.cc.
References lock_, and missed_heartbeat_counts_.
|
virtual |
Returns the current estimated state of a peer.
Implements impala::FailureDetector.
Definition at line 87 of file failure-detector.cc.
References impala::FailureDetector::FAILED, lock_, max_missed_heartbeats_, missed_heartbeat_counts_, impala::FailureDetector::OK, suspect_missed_heartbeats_, impala::FailureDetector::SUSPECTED, and impala::FailureDetector::UNKNOWN.
Referenced by impala::ImpalaServer::DetectNmFailures(), and UpdateHeartbeat().
|
staticinherited |
Utility method to convert a PeerState enum to a string.
Definition at line 36 of file failure-detector.cc.
References PEER_STATE_TO_STRING.
|
virtual |
Updates the state of a peer according to the most recent heartbeat state. If 'seen' is true, this method indicates that a heartbeat has been received. If seen is 'false', this method indicates that a heartbeat has not been received since the last successful heartbeat receipt. This method returns the current state of the updated peer. Note that this may be different from the state implied by seen - a single missed heartbeat, for example, may not cause a peer to enter the SUSPECTED or FAILED states. The failure detector has the benefit of looking at all samples, rather than just the most recent one.
Implements impala::FailureDetector.
Definition at line 72 of file failure-detector.cc.
References GetPeerState(), lock_, missed_heartbeat_counts_, and impala::FailureDetector::OK.
Referenced by impala::ImpalaServer::DetectNmFailures().
|
private |
Protects all members.
Definition at line 127 of file failure-detector.h.
Referenced by EvictPeer(), GetPeerState(), and UpdateHeartbeat().
|
private |
The maximum number of heartbeats that can be missed consecutively before a peer is considered failed.
Definition at line 131 of file failure-detector.h.
Referenced by GetPeerState().
|
private |
Number of consecutive heartbeats missed by peer.
Definition at line 138 of file failure-detector.h.
Referenced by EvictPeer(), GetPeerState(), and UpdateHeartbeat().
|
private |
The maximum number of heartbeats that can be missed consecutively before a peer is suspected of failure.
Definition at line 135 of file failure-detector.h.
Referenced by GetPeerState().