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

Commit eb0fa46

Browse files
committed
Let MtmRefreshClusterStatus enable concrete node
1 parent 6704d40 commit eb0fa46

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

contrib/mmts/arbiter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ static void MtmTransReceiver(Datum arg)
10301030
}
10311031
if (n == 0 && Mtm->disabledNodeMask != 0) {
10321032
/* If timeout is expired and there are disabled nodes, then recheck cluster's state */
1033-
MtmRefreshClusterStatus(false);
1033+
MtmRefreshClusterStatus(false, 0);
10341034
}
10351035
}
10361036
}

contrib/mmts/multimaster.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
802802
timestamp_t now = MtmGetSystemTime();
803803
if (Mtm->lastClusterStatusUpdate + MSEC_TO_USEC(MtmHeartbeatRecvTimeout) < now) {
804804
Mtm->lastClusterStatusUpdate = now;
805-
MtmRefreshClusterStatus(true);
805+
MtmRefreshClusterStatus(true, 0);
806806
}
807807
if (!IsBackgroundWorker && Mtm->status != MTM_ONLINE) {
808808
/* Do not take in account bg-workers which are performing recovery */
@@ -1462,9 +1462,9 @@ MtmBuildConnectivityMatrix(nodemask_t* matrix, bool nowait)
14621462
* Build connectivity graph, find clique in it and extend disabledNodeMask by nodes not included in clique.
14631463
* This function returns false if current node is excluded from cluster, true otherwise
14641464
*/
1465-
bool MtmRefreshClusterStatus(bool nowait)
1465+
bool MtmRefreshClusterStatus(bool nowait, int testNodeId)
14661466
{
1467-
nodemask_t mask, clique, disabled;
1467+
nodemask_t mask, clique, disabled, enabled;
14681468
nodemask_t matrix[MAX_NODES];
14691469
MtmTransState *ts;
14701470
int clique_size;
@@ -1497,17 +1497,13 @@ bool MtmRefreshClusterStatus(bool nowait)
14971497
MtmDisableNode(i+1);
14981498
}
14991499
}
1500-
#if 0 /* Do not enable nodes here: them will be enabled after completion of recovery */
15011500
enabled = clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
1502-
for (i = 0, mask = enabled; mask != 0; i++, mask >>= 1) {
1503-
if (mask & 1) {
1504-
MtmEnableNode(i+1);
1505-
}
1501+
if (testNodeId != 0 && BIT_CHECK(enabled, testNodeId-1)) {
1502+
MtmEnableNode(testNodeId);
15061503
}
1507-
Mtm->reconnectMask |= clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
1508-
#endif
1504+
// Mtm->reconnectMask |= clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
15091505

1510-
if (disabled) {
1506+
if (disabled|enabled) {
15111507
MtmCheckQuorum();
15121508
}
15131509
/* Interrupt voting for active transaction and abort them */
@@ -1623,7 +1619,7 @@ void MtmOnNodeDisconnect(int nodeId)
16231619
}
16241620
MtmUnlock();
16251621
} else {
1626-
MtmRefreshClusterStatus(false);
1622+
MtmRefreshClusterStatus(false, 0);
16271623
}
16281624
}
16291625

@@ -2596,7 +2592,7 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
25962592
MtmCheckQuorum();
25972593
} else {
25982594
MtmUnlock();
2599-
MtmRefreshClusterStatus(true);
2595+
MtmRefreshClusterStatus(true, MtmReplicationNodeId);
26002596
MtmLock(LW_SHARED);
26012597
if (BIT_CHECK(Mtm->disabledNodeMask, MtmReplicationNodeId-1)) {
26022598
MtmUnlock();

contrib/mmts/multimaster.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ extern TransactionId MtmGetCurrentTransactionId(void);
273273
extern XidStatus MtmGetCurrentTransactionStatus(void);
274274
extern XidStatus MtmExchangeGlobalTransactionStatus(char const* gid, XidStatus status);
275275
extern bool MtmIsRecoveredNode(int nodeId);
276-
extern bool MtmRefreshClusterStatus(bool nowait);
276+
extern bool MtmRefreshClusterStatus(bool nowait, int testNodeId);
277277
extern void MtmSwitchClusterMode(MtmNodeStatus mode);
278278
extern void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr);
279279
extern void MtmSetupReplicationHooks(struct PGLogicalHooks* hooks);

0 commit comments

Comments
 (0)