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

Commit c3b857a

Browse files
committed
commit recovered prepared tx that were produced by a sible major
1 parent 6247ad7 commit c3b857a

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

multimaster.c

+12
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,19 @@ void MtmSend2PCMessage(MtmTransState* ts, MtmMessageCode cmd)
16871687
static void MtmBroadcastPollMessage(MtmTransState* ts)
16881688
{
16891689
int i;
1690+
int nparts;
16901691
MtmArbiterMessage msg;
1692+
1693+
nparts = Mtm->nAllNodes - countZeroBits(ts->participantsMask, Mtm->nAllNodes);
1694+
MTM_LOG1("MtmBroadcastPollMessage: %s %lld %d", ts->gid, ts->participantsMask, nparts);
1695+
1696+
if (nparts == 1)
1697+
{
1698+
/* we were in major mode and there nobody to ask about status */
1699+
MtmFinishPreparedTransaction(ts, true);
1700+
return;
1701+
}
1702+
16911703
MtmInitMessage(&msg, MSG_POLL_REQUEST);
16921704
memcpy(msg.gid, ts->gid, MULTIMASTER_MAX_GID_SIZE);
16931705
ts->votedMask = 0;

state.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ maskToString(nodemask_t mask, int nNodes)
4141
return strMask;
4242
}
4343

44-
static int
44+
int
4545
countZeroBits(nodemask_t mask, int nNodes)
4646
{
4747
int i, count = 0;

state.h

+2
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ extern void MtmOnNodeConnect(int nodeId);
3131
extern void MtmReconnectNode(int nodeId);
3232

3333
extern void MtmRefreshClusterStatus(void);
34+
35+
extern int countZeroBits(nodemask_t mask, int nNodes);

0 commit comments

Comments
 (0)