Skip to content

Commit 62697ed

Browse files
knizhnikkelvich
authored andcommitted
Let MtmRefreshClusterStatus enable concrete node
1 parent 9593dbe commit 62697ed

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

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
}

multimaster.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
801801
timestamp_t now = MtmGetSystemTime();
802802
if (Mtm->lastClusterStatusUpdate + MSEC_TO_USEC(MtmHeartbeatRecvTimeout) < now) {
803803
Mtm->lastClusterStatusUpdate = now;
804-
MtmRefreshClusterStatus(true);
804+
MtmRefreshClusterStatus(true, 0);
805805
}
806806
if (!IsBackgroundWorker && Mtm->status != MTM_ONLINE) {
807807
/* Do not take in account bg-workers which are performing recovery */
@@ -1461,9 +1461,9 @@ MtmBuildConnectivityMatrix(nodemask_t* matrix, bool nowait)
14611461
* Build connectivity graph, find clique in it and extend disabledNodeMask by nodes not included in clique.
14621462
* This function returns false if current node is excluded from cluster, true otherwise
14631463
*/
1464-
bool MtmRefreshClusterStatus(bool nowait)
1464+
bool MtmRefreshClusterStatus(bool nowait, int testNodeId)
14651465
{
1466-
nodemask_t mask, clique, disabled;
1466+
nodemask_t mask, clique, disabled, enabled;
14671467
nodemask_t matrix[MAX_NODES];
14681468
MtmTransState *ts;
14691469
int clique_size;
@@ -1496,17 +1496,13 @@ bool MtmRefreshClusterStatus(bool nowait)
14961496
MtmDisableNode(i+1);
14971497
}
14981498
}
1499-
#if 0 /* Do not enable nodes here: them will be enabled after completion of recovery */
15001499
enabled = clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
1501-
for (i = 0, mask = enabled; mask != 0; i++, mask >>= 1) {
1502-
if (mask & 1) {
1503-
MtmEnableNode(i+1);
1504-
}
1500+
if (testNodeId != 0 && BIT_CHECK(enabled, testNodeId-1)) {
1501+
MtmEnableNode(testNodeId);
15051502
}
1506-
Mtm->reconnectMask |= clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
1507-
#endif
1503+
// Mtm->reconnectMask |= clique & Mtm->disabledNodeMask; /* new enabled nodes mask */
15081504

1509-
if (disabled) {
1505+
if (disabled|enabled) {
15101506
MtmCheckQuorum();
15111507
}
15121508
/* Interrupt voting for active transaction and abort them */
@@ -1622,7 +1618,7 @@ void MtmOnNodeDisconnect(int nodeId)
16221618
}
16231619
MtmUnlock();
16241620
} else {
1625-
MtmRefreshClusterStatus(false);
1621+
MtmRefreshClusterStatus(false, 0);
16261622
}
16271623
}
16281624

@@ -2595,7 +2591,7 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
25952591
MtmCheckQuorum();
25962592
} else {
25972593
MtmUnlock();
2598-
MtmRefreshClusterStatus(true);
2594+
MtmRefreshClusterStatus(true, MtmReplicationNodeId);
25992595
MtmLock(LW_SHARED);
26002596
if (BIT_CHECK(Mtm->disabledNodeMask, MtmReplicationNodeId-1)) {
26012597
MtmUnlock();

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy