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

Commit 8b327d3

Browse files
committed
Do not enable node without recovery
1 parent 563d921 commit 8b327d3

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

contrib/mmts/arbiter.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ static void MtmMonitor(Datum arg)
779779
if (rc & WL_POSTMASTER_DEATH) {
780780
break;
781781
}
782-
MtmRefreshClusterStatus(true, 0);
782+
MtmRefreshClusterStatus(true);
783783
}
784784
}
785785

@@ -1086,7 +1086,7 @@ static void MtmReceiver(Datum arg)
10861086
}
10871087
if (n == 0 && Mtm->disabledNodeMask != 0) {
10881088
/* If timeout is expired and there are disabled nodes, then recheck cluster's state */
1089-
MtmRefreshClusterStatus(false, 0);
1089+
MtmRefreshClusterStatus(false);
10901090
}
10911091
}
10921092
}

contrib/mmts/multimaster.c

+6-18
Original file line numberDiff line numberDiff line change
@@ -1628,8 +1628,8 @@ bool MtmRecoveryCaughtUp(int nodeId, XLogRecPtr slotLSN)
16281628
BIT_CLEAR(Mtm->nodeLockerMask, nodeId-1);
16291629
Mtm->nLockers -= 1;
16301630
} else {
1631-
MTM_LOG1("%d: node %d is caugth-up without locking cluster", MyProcPid, nodeId);
1632-
/* We are lucky: caugth-up without locking cluster! */
1631+
MTM_LOG1("%d: node %d is caught-up without locking cluster", MyProcPid, nodeId);
1632+
/* We are lucky: caught-up without locking cluster! */
16331633
}
16341634
MtmEnableNode(nodeId);
16351635
Mtm->nConfigChanges += 1;
@@ -1779,9 +1779,9 @@ MtmBuildConnectivityMatrix(nodemask_t* matrix, bool nowait)
17791779
* Build connectivity graph, find clique in it and extend disabledNodeMask by nodes not included in clique.
17801780
* This function returns false if current node is excluded from cluster, true otherwise
17811781
*/
1782-
bool MtmRefreshClusterStatus(bool nowait, int testNodeId)
1782+
bool MtmRefreshClusterStatus(bool nowait)
17831783
{
1784-
nodemask_t mask, clique, disabled, enabled;
1784+
nodemask_t mask, clique, disabled;
17851785
nodemask_t matrix[MAX_NODES];
17861786
int clique_size;
17871787
int i;
@@ -1822,13 +1822,6 @@ bool MtmRefreshClusterStatus(bool nowait, int testNodeId)
18221822
}
18231823
}
18241824
}
1825-
}
1826-
enabled = clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
1827-
if (testNodeId != 0 && BIT_CHECK(enabled, testNodeId-1)) {
1828-
MtmEnableNode(testNodeId);
1829-
}
1830-
1831-
if (disabled|enabled) {
18321825
MtmCheckQuorum();
18331826
}
18341827
#if 0
@@ -1908,7 +1901,7 @@ void MtmOnNodeDisconnect(int nodeId)
19081901
}
19091902

19101903
MtmSleep(MSEC_TO_USEC(MtmHeartbeatSendTimeout));
1911-
MtmRefreshClusterStatus(false, 0);
1904+
MtmRefreshClusterStatus(false);
19121905
}
19131906

19141907
void MtmOnNodeConnect(int nodeId)
@@ -3077,12 +3070,7 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
30773070
MtmCheckQuorum();
30783071
} else {
30793072
MtmUnlock();
3080-
MtmRefreshClusterStatus(true, MtmReplicationNodeId);
3081-
MtmLock(LW_SHARED);
3082-
if (BIT_CHECK(Mtm->disabledNodeMask, MtmReplicationNodeId-1)) {
3083-
MtmUnlock();
3084-
elog(ERROR, "Disabled node %d tries to reconnect without recovery", MtmReplicationNodeId);
3085-
}
3073+
elog(ERROR, "Disabled node %d tries to reconnect without recovery", MtmReplicationNodeId);
30863074
}
30873075
} else {
30883076
MTM_LOG1("Node %d start logical replication to node %d in normal mode", MtmNodeId, MtmReplicationNodeId);

contrib/mmts/multimaster.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ extern TransactionId MtmGetCurrentTransactionId(void);
350350
extern XidStatus MtmGetCurrentTransactionStatus(void);
351351
extern XidStatus MtmExchangeGlobalTransactionStatus(char const* gid, XidStatus status);
352352
extern bool MtmIsRecoveredNode(int nodeId);
353-
extern bool MtmRefreshClusterStatus(bool nowait, int testNodeId);
353+
extern bool MtmRefreshClusterStatus(bool nowait);
354354
extern void MtmSwitchClusterMode(MtmNodeStatus mode);
355355
extern void MtmUpdateNodeConnectionInfo(MtmConnectionInfo* conn, char const* connStr);
356356
extern void MtmSetupReplicationHooks(struct PGLogicalHooks* hooks);

0 commit comments

Comments
 (0)