Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit62697ed

Browse files
knizhnikkelvich
authored andcommitted
Let MtmRefreshClusterStatus enable concrete node
1 parent9593dbe commit62697ed

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_tnow=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-
boolMtmRefreshClusterStatus(boolnowait)
1464+
boolMtmRefreshClusterStatus(boolnowait,inttestNodeId)
14651465
{
1466-
nodemask_tmask,clique,disabled;
1466+
nodemask_tmask,clique,disabled,enabled;
14671467
nodemask_tmatrix[MAX_NODES];
14681468
MtmTransState*ts;
14691469
intclique_size;
@@ -1496,17 +1496,13 @@ bool MtmRefreshClusterStatus(bool nowait)
14961496
MtmDisableNode(i+1);
14971497
}
14981498
}
1499-
#if0/* 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
externXidStatusMtmGetCurrentTransactionStatus(void);
274274
externXidStatusMtmExchangeGlobalTransactionStatus(charconst*gid,XidStatusstatus);
275275
externboolMtmIsRecoveredNode(intnodeId);
276-
externboolMtmRefreshClusterStatus(boolnowait);
276+
externboolMtmRefreshClusterStatus(boolnowait,inttestNodeId);
277277
externvoidMtmSwitchClusterMode(MtmNodeStatusmode);
278278
externvoidMtmUpdateNodeConnectionInfo(MtmConnectionInfo*conn,charconst*connStr);
279279
externvoidMtmSetupReplicationHooks(structPGLogicalHooks*hooks);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp