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

Commit9d5096e

Browse files
committed
Merge branch 'master' of github.com:postgrespro/postgres_cluster
2 parentsef7c139 +8e729f5 commit9d5096e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

‎contrib/mmts/multimaster.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,13 @@ MtmPrePrepareTransaction(MtmCurrentTrans* x)
737737
Assert(TransactionIdIsValid(x->xid));
738738

739739
if (Mtm->disabledNodeMask!=0) {
740-
MtmRefreshClusterStatus(true);
740+
timestamp_tnow=MtmGetSystemTime();
741+
if (Mtm->lastClusterStatusUpdate+MSEC_TO_USEC(MtmRaftPollDelay)<now) {
742+
Mtm->lastClusterStatusUpdate=now;
743+
MtmRefreshClusterStatus(true);
744+
}
741745
if (!IsBackgroundWorker&&Mtm->status!=MTM_ONLINE) {
742-
/* Do not take inaccoutn bg-workers which are performing recovery */
746+
/* Do not take inaccount bg-workers which are performing recovery */
743747
elog(ERROR,"Abort current transaction because this cluster node is in %s status",MtmNodeStatusMnem[Mtm->status]);
744748
}
745749
}
@@ -835,8 +839,10 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
835839
time_ttransTimeout=Max(Mtm2PCMinTimeout, (ts->csn-ts->snapshot)*Mtm2PCPrepareRatio/100000);/* usec->msec and percents */
836840
intresult=0;
837841
intnConfigChanges=Mtm->nConfigChanges;
842+
843+
timestamp_tstart=MtmGetSystemTime();
838844
/* wait votes from all nodes */
839-
while (!ts->votingCompleted&&!(result&WL_TIMEOUT))
845+
while (!ts->votingCompleted&&start+transTimeout >=MtmGetSystemTime())
840846
{
841847
MtmUnlock();
842848
MtmWatchdog();
@@ -845,7 +851,7 @@ MtmPostPrepareTransaction(MtmCurrentTrans* x)
845851
x->status=TRANSACTION_STATUS_ABORTED;
846852
return;
847853
}
848-
result=WaitLatch(&MyProc->procLatch,WL_LATCH_SET|WL_TIMEOUT,transTimeout);
854+
result=WaitLatch(&MyProc->procLatch,WL_LATCH_SET|WL_TIMEOUT,MtmHeartbeatRecvTimeout);
849855
if (result&WL_LATCH_SET) {
850856
ResetLatch(&MyProc->procLatch);
851857
}
@@ -1569,6 +1575,7 @@ static void MtmInitialize()
15691575
Mtm->recoverySlot=0;
15701576
Mtm->locks=GetNamedLWLockTranche(MULTIMASTER_NAME);
15711577
Mtm->csn=MtmGetCurrentTime();
1578+
Mtm->lastClusterStatusUpdate=MtmGetSystemTime();
15721579
Mtm->lastCsn=INVALID_CSN;
15731580
Mtm->oldestXid=FirstNormalTransactionId;
15741581
Mtm->nLiveNodes=MtmNodes;

‎contrib/mmts/multimaster.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ typedef struct
189189
This list is expected to be in CSN ascending order, by strict order may be violated */
190190
uint64transCount;/* Counter of transactions perfromed by this node */
191191
uint64gcCount;/* Number of global transactions performed since last GC */
192-
BgwPoolpool;/* Pool of background workers for applying logical replication patches */
192+
timestamp_tlastClusterStatusUpdate;/* Time of last update of cluster status */
193+
BgwPoolpool;/* Pool of background workers for applying logical replication patches */
193194
MtmNodeInfonodes[1];/* [Mtm->nAllNodes]: per-node data */
194195
}MtmState;
195196

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp