File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,12 @@ typedef struct
102
102
MtmArbiterMessage * data ;
103
103
} MtmBuffer ;
104
104
105
- static int * sockets ;
106
- static int gateway ;
107
- static bool send_heartbeat ;
108
- static TimeoutId heartbeat_timer ;
109
- static int busy_socket ;
105
+ static int * sockets ;
106
+ static int gateway ;
107
+ static bool send_heartbeat ;
108
+ static timestamp_t last_sent_hearbeat ;
109
+ static TimeoutId heartbeat_timer ;
110
+ static int busy_socket ;
110
111
111
112
static void MtmTransSender (Datum arg );
112
113
static void MtmTransReceiver (Datum arg );
@@ -326,6 +327,8 @@ static void MtmSetSocketOptions(int sd)
326
327
327
328
static void MtmScheduleHeartbeat ()
328
329
{
330
+ Assert (!last_sent_hearbeat || last_sent_hearbeat + MSEC_TO_USEC (MtmHeartbeatRecvTimeout ) >= MtmGetSystemTime ());
331
+ enable_timeout_after (heartbeat_timer , MtmHeartbeatSendTimeout );
329
332
send_heartbeat = true;
330
333
PGSemaphoreUnlock (& Mtm -> votingSemaphore );
331
334
}
@@ -338,7 +341,8 @@ static void MtmSendHeartbeat()
338
341
msg .disabledNodeMask = Mtm -> disabledNodeMask ;
339
342
msg .oldestSnapshot = Mtm -> nodes [MtmNodeId - 1 ].oldestSnapshot ;
340
343
msg .node = MtmNodeId ;
341
-
344
+ last_sent_hearbeat = MtmGetSystemTime ();
345
+
342
346
for (i = 0 ; i < Mtm -> nAllNodes ; i ++ )
343
347
{
344
348
if (sockets [i ] >= 0 && sockets [i ] != busy_socket && !BIT_CHECK (Mtm -> disabledNodeMask |Mtm -> reconnectMask , i ))
You can’t perform that action at this time.
0 commit comments