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

Commit c6ce52b

Browse files
committed
fix race between error check in gather and receiver shm_mq reconnect
1 parent fab1df4 commit c6ce52b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/commit.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,19 +327,25 @@ gather(uint64 participants, mtm_msg *messages, int *msg_count)
327327
"gather: got message from node%d",
328328
sender_to_node[sender_id]);
329329
}
330-
else if (sender_id >= 0)
330+
else
331331
{
332332
/*
333333
* If queue is detached then the neignbour node is probably
334334
* disconnected. Let's wait when it became disabled as we can
335335
* became offline by this time.
336336
*/
337-
if (!BIT_CHECK(MtmGetEnabledNodeMask(), sender_to_node[sender_id] - 1))
337+
int i;
338+
nodemask_t enabled = MtmGetEnabledNodeMask();
339+
340+
for (i = 0; i < MTM_MAX_NODES; i++)
338341
{
339-
BIT_CLEAR(participants, sender_to_node[sender_id] - 1);
340-
mtm_log(MtmTxTrace,
341-
"GatherPrecommit: dropping node%d from tx participants",
342-
sender_to_node[sender_id]);
342+
if (BIT_CHECK(participants, i) && !BIT_CHECK(enabled, i))
343+
{
344+
BIT_CLEAR(participants, i);
345+
mtm_log(MtmTxTrace,
346+
"GatherPrecommit: dropping node%d from tx participants",
347+
i + 1);
348+
}
343349
}
344350
}
345351

0 commit comments

Comments
 (0)