Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 92c7c87

Browse files
knizhnikkelvich
authored andcommitted
Fix reace condition in tw_pahse.c
1 parent 1d9e382 commit 92c7c87

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

arbiter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,9 @@ static void MtmSendHeartbeat()
371371
} else {
372372
/* Connectivity mask can be cleared by MtmWatchdog: in this case sockets[i] >= 0 */
373373
if (BIT_CHECK(Mtm->connectivityMask, i)) {
374-
MtmDisconnect(i);
374+
close(sockets[i]);
375+
sockets[i] = -1;
376+
MtmReconnectNode(i+1);
375377
//MtmOnNodeConnect(i+1);
376378
}
377379
MTM_LOG4("Send heartbeat to node %d with timestamp %ld", i+1, now);

multimaster.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,13 @@ void MtmOnNodeConnect(int nodeId)
20212021
MtmUnlock();
20222022
}
20232023

2024+
void MtmReconnectNode(int nodeId)
2025+
{
2026+
MtmLock(LW_EXCLUSIVE);
2027+
BIT_SET(Mtm->reconnectMask, nodeId-1);
2028+
MtmUnlock();
2029+
}
2030+
20242031

20252032

20262033
/*
@@ -3301,7 +3308,7 @@ bool MtmFilterTransaction(char* record, int size)
33013308
}
33023309

33033310
if (duplicate) {
3304-
MTM_LOG2("Ignore transaction %s from node %d flags=%x, our restartLSN for node: %lx,restart_lsn = (origin node %d == MtmReplicationNodeId %d) ? end_lsn=%lx, origin_lsn=%lx",
3311+
MTM_LOG1("Ignore transaction %s from node %d flags=%x, our restartLSN for node: %lx,restart_lsn = (origin node %d == MtmReplicationNodeId %d) ? end_lsn=%lx, origin_lsn=%lx",
33053312
gid, replication_node, flags, Mtm->nodes[origin_node-1].restartLSN, origin_node, MtmReplicationNodeId, end_lsn, origin_lsn);
33063313
} else {
33073314
MTM_LOG2("Apply transaction %s from node %d lsn %lx, flags=%x, origin node %d, original lsn=%lx, current lsn=%lx",

multimaster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ extern void MtmUnlock(void);
358358
extern void MtmLockNode(int nodeId, LWLockMode mode);
359359
extern void MtmUnlockNode(int nodeId);
360360
extern void MtmDropNode(int nodeId, bool dropSlot);
361+
extern void MtmReconnectNode(int nodeId);
361362
extern void MtmRecoverNode(int nodeId);
362363
extern void MtmOnNodeDisconnect(int nodeId);
363364
extern void MtmOnNodeConnect(int nodeId);

0 commit comments

Comments
 (0)