1 /*
2    Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License, version 2.0,
6    as published by the Free Software Foundation.
7 
8    This program is also distributed with certain software (including
9    but not limited to OpenSSL) that is licensed under separate terms,
10    as designated in a particular file or component or in included license
11    documentation.  The authors of MySQL hereby grant you an additional
12    permission to link the program and your derivative works with the
13    separately licensed software that they have included with MySQL.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License, version 2.0, for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
23 */
24 
25 #ifndef NODEPING_HPP
26 #define NODEPING_HPP
27 
28 #include "SignalData.hpp"
29 
30 
31 /*
32  * NodePingReq/Conf is sent between QMGR nodes to help determine the
33  * available connectivity in a cluster experiencing heartbeat problems
34  *
35  * When a node detects that it has not received a heartbeat from a
36  * connected node for the heartbeat period, it initiates a global
37  * connectivity check protocol by sending a NODE_PING_REQ signal to all
38  * nodes considered to be running.
39  *
40  * On receiving this signal, a node will respond with NODE_PING_CONF to
41  * the sender, and begin its own connectivity check, if it is not
42  * already involved in one.
43  *
44  * In this way, all nodes reachable within some latency n will begin
45  * a connectivity check.  If they do not receive a NODE_PING_CONF from a
46  * peer node within some further latency m, then they consider it to
47  * be suspect, and after a further latency p they consider it failed.
48  *
49  * In environments where latency between nodes fluctuates, but
50  * connectivity is maintained (for example where TCP connections observe
51  * latency due to underlying IP re-routing/failover), the connectivity
52  * check allows nodes to arm themselves in preparation for the potential
53  * race of FAIL_REP signals that can arise in these situations, by marking
54  * connections experiencing latency as SUSPECT.  Once a node is marked as
55  * SUSPECT, FAIL_REP signals originating from it may not be trusted or
56  * acted upon.
57  */
58 
59 class NodePingReq {
60   /**
61    * Sender(s) / Receiver(s)
62    */
63   friend class Qmgr;
64 public:
65   STATIC_CONST( SignalLength = 2 );
66 
67   Uint32 senderData;
68   Uint32 senderRef;
69 };
70 
71 class NodePingConf {
72   /**
73    * Sender(s) / Receiver(s)
74    */
75   friend class Qmgr;
76 public:
77   STATIC_CONST( SignalLength = 2 );
78 
79   Uint32 senderData;
80   Uint32 senderRef;
81 };
82 
83 #endif
84