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

Commit a2f8df4

Browse files
committed
iterate through activeList in PollStatus as transList may be broken after AdjustOldestXid
1 parent af70e59 commit a2f8df4

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

multimaster.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,8 +2011,13 @@ void MtmHandleApplyError(void)
20112011
*/
20122012
void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId, bool commitPrecommited)
20132013
{
2014-
MtmTransState *ts;
2015-
for (ts = Mtm->transListHead; ts != NULL; ts = ts->next) {
2014+
MtmL2List *start = Mtm->activeTransList.next;
2015+
MtmL2List *cur;
2016+
2017+
for (cur = start; cur->next != start; cur = cur->next)
2018+
{
2019+
MtmTransState *ts = MtmGetActiveTransaction(cur);
2020+
20162021
if (TransactionIdIsValid(ts->gtid.xid)
20172022
&& ts->gtid.node == disabledNodeId
20182023
&& ts->votingCompleted
@@ -2050,8 +2055,13 @@ void MtmPollStatusOfPreparedTransactionsForDisabledNode(int disabledNodeId, bool
20502055
void
20512056
MtmPollStatusOfPreparedTransactions(bool majorMode)
20522057
{
2053-
MtmTransState *ts;
2054-
for (ts = Mtm->transListHead; ts != NULL; ts = ts->next) {
2058+
MtmL2List *start = Mtm->activeTransList.next;
2059+
MtmL2List *cur;
2060+
2061+
for (cur = start; cur->next != start; cur = cur->next)
2062+
{
2063+
MtmTransState *ts = MtmGetActiveTransaction(cur);
2064+
20552065
if (TransactionIdIsValid(ts->gtid.xid)
20562066
&& ts->votingCompleted /* If voting is not yet completed, then there is some backend coordinating this transaction */
20572067
&& (ts->status == TRANSACTION_STATUS_UNKNOWN || ts->status == TRANSACTION_STATUS_IN_PROGRESS))

0 commit comments

Comments
 (0)