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

Commitf78894b

Browse files
knizhnikkelvich
authored andcommitted
Recovery in progress
1 parent1d135e6 commitf78894b

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

‎arbiter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ static void MtmOpenConnections()
376376
}
377377
if (Mtm->nNodes<MtmNodes/2+1) {/* no quorum */
378378
elog(WARNING,"Node is out of quorum: only %d nodes from %d are accssible",Mtm->nNodes,MtmNodes);
379-
Mtm->status=MTM_IN_MINORITY;
379+
MtmSwitchClusterMode(MTM_IN_MINORITY);
380380
}elseif (Mtm->status==MTM_INITIALIZATION) {
381381
MtmSwitchClusterMode(MTM_CONNECTED);
382382
}

‎multimaster.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,13 @@ static int64 MtmGetSlotLag(int nodeId)
972972
*/
973973
boolMtmIsRecoveredNode(intnodeId)
974974
{
975-
if (BIT_CHECK(Mtm->disabledNodeMask,nodeId-1)) {
975+
returnBIT_CHECK(Mtm->disabledNodeMask,nodeId-1));
976+
}
977+
978+
979+
voidMtmRecoveryPorgress(XLogRecPtrlsn)
980+
{
981+
976982
Assert(MyWalSnd!=NULL);/* This function is called by WAL-sender, so it should not be NULL */
977983
if (!BIT_CHECK(Mtm->nodeLockerMask,nodeId-1)
978984
&&MyWalSnd->sentPtr+MtmMinRecoveryLag>GetXLogInsertRecPtr())
@@ -1134,7 +1140,7 @@ bool MtmRefreshClusterStatus(bool nowait)
11341140
}
11351141
}else {
11361142
elog(WARNING,"Clique %lx has no quorum",clique);
1137-
Mtm->status=MTM_IN_MINORITY;
1143+
MtmSwitchClusterMode(MTM_IN_MINORITY);
11381144
}
11391145
return true;
11401146
}
@@ -1144,12 +1150,12 @@ void MtmCheckQuorum(void)
11441150
if (Mtm->nNodes<MtmNodes/2+1) {
11451151
if (Mtm->status==MTM_ONLINE) {/* out of quorum */
11461152
elog(WARNING,"Node is in minority: disabled mask %lx",Mtm->disabledNodeMask);
1147-
Mtm->status=MTM_IN_MINORITY;
1153+
MtmSwitchClusterMode(MTM_IN_MINORITY);
11481154
}
11491155
}else {
11501156
if (Mtm->status==MTM_IN_MINORITY) {
11511157
elog(WARNING,"Node is in majority: dissbled mask %lx",Mtm->disabledNodeMask);
1152-
Mtm->status=MTM_ONLINE;
1158+
MtmSwitchClusterMode(MTM_ONLINE);
11531159
}
11541160
}
11551161
}
@@ -1695,6 +1701,19 @@ void MtmDropNode(int nodeId, bool dropSlot)
16951701
}
16961702
}
16971703

1704+
staticvoid
1705+
MtmReplicationStartupHook(structPGLogicalStartupHookArgs*args)
1706+
{
1707+
MtmLock(LW_EXCLUSIVE);
1708+
if (BIT_CHECK(Mtm->disabledNodeMask,MtmReplicationNodeId-1)) {
1709+
elog(WARNING,"Recovery of node %d is completed: start normal replication",MtmReplicationNodeId);
1710+
BIT_CLEAR(Mtm->disabledNodeMask,MtmReplicationNodeId-1);
1711+
Mtm->nNodes+=1;
1712+
MtmCheckQuorum();
1713+
}
1714+
MtmUnlock();
1715+
}
1716+
16981717
staticvoid
16991718
MtmReplicationShutdownHook(structPGLogicalShutdownHookArgs*args)
17001719
{
@@ -1714,6 +1733,7 @@ MtmReplicationTxnFilterHook(struct PGLogicalTxnFilterArgs* args)
17141733

17151734
voidMtmSetupReplicationHooks(structPGLogicalHooks*hooks)
17161735
{
1736+
hooks->startup_hook=MtmReplicationStartupHook;
17171737
hooks->shutdown_hook=MtmReplicationShutdownHook;
17181738
hooks->txn_filter_hook=MtmReplicationTxnFilterHook;
17191739
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp