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

Commit681372d

Browse files
knizhnikkelvich
authored andcommitted
Ignore LSN of prepared transactions
1 parentf8ab676 commit681372d

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

‎multimaster.c

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -312,26 +312,32 @@ void MtmReleaseLocks(void)
312312
*/
313313
voidMtmLock(LWLockModemode)
314314
{
315-
timestamp_tstart,stop;
316315
if (!MtmAtExitHookRegistered) {
317316
atexit(MtmReleaseLocks);
318317
MtmAtExitHookRegistered= true;
319318
}
320319
if (MtmLockCount!=0) {
321320
Assert(Mtm->lastLockHolder==MyProcPid);
322321
MtmLockCount+=1;
323-
return;
324322
}
325-
start=MtmGetSystemTime();
326-
LWLockAcquire((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID],mode);
327-
stop=MtmGetSystemTime();
328-
if (stop>start+MSEC_TO_USEC(MtmHeartbeatSendTimeout)) {
329-
MTM_LOG1("%d: obtaining %s lock takes %lld microseconds",MyProcPid, (mode==LW_EXCLUSIVE ?"exclusive" :"shared"),stop-start);
330-
}
331-
if (mode==LW_EXCLUSIVE) {
332-
Assert(MtmLockCount==0);
333-
Mtm->lastLockHolder=MyProcPid;
334-
MtmLockCount=1;
323+
else
324+
{
325+
#ifDEBUG_LEVEL>1
326+
timestamp_tstart,stop;
327+
start=MtmGetSystemTime();
328+
#endif
329+
LWLockAcquire((LWLockId)&Mtm->locks[MTM_STATE_LOCK_ID],mode);
330+
#ifDEBUG_LEVEL>1
331+
stop=MtmGetSystemTime();
332+
if (stop>start+MSEC_TO_USEC(MtmHeartbeatSendTimeout)) {
333+
MTM_LOG1("%d: obtaining %s lock takes %lld microseconds",MyProcPid, (mode==LW_EXCLUSIVE ?"exclusive" :"shared"),stop-start);
334+
}
335+
#endif
336+
if (mode==LW_EXCLUSIVE) {
337+
Assert(MtmLockCount==0);
338+
Mtm->lastLockHolder=MyProcPid;
339+
MtmLockCount=1;
340+
}
335341
}
336342
}
337343

@@ -527,9 +533,12 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
527533
statictimestamp_ttotalSleepTime;
528534
statictimestamp_tmaxSleepTime;
529535
#endif
530-
timestamp_tstart=MtmGetSystemTime();
531536
timestamp_tdelay=MIN_WAIT_TIMEOUT;
532537
inti;
538+
#ifDEBUG_LEVEL>1
539+
timestamp_tstart=MtmGetSystemTime();
540+
#endif
541+
533542
Assert(xid!=InvalidTransactionId);
534543

535544
if (!MtmUseDtm) {
@@ -551,9 +560,11 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
551560
if (ts->csn>MtmTx.snapshot) {
552561
MTM_LOG4("%d: tuple with xid=%lld(csn=%lld) is invisible in snapshot %lld",
553562
MyProcPid, (long64)xid,ts->csn,MtmTx.snapshot);
563+
#ifDEBUG_LEVEL>1
554564
if (MtmGetSystemTime()-start>USECS_PER_SEC) {
555565
MTM_ELOG(WARNING,"Backend %d waits for transaction %s (%llu) status %lld usecs",MyProcPid,ts->gid, (long64)xid,MtmGetSystemTime()-start);
556566
}
567+
#endif
557568
MtmUnlock();
558569
return true;
559570
}
@@ -593,10 +604,12 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
593604
MTM_LOG4("%d: tuple with xid=%lld(csn= %lld) is %s in snapshot %lld",
594605
MyProcPid, (long64)xid,ts->csn,invisible ?"rollbacked" :"committed",MtmTx.snapshot);
595606
MtmUnlock();
607+
#ifDEBUG_LEVEL>1
596608
if (MtmGetSystemTime()-start>USECS_PER_SEC) {
597609
MTM_ELOG(WARNING,"Backend %d waits for %s transaction %s (%llu) %lld usecs",MyProcPid,invisible ?"rollbacked" :"committed",
598610
ts->gid, (long64)xid,MtmGetSystemTime()-start);
599611
}
612+
#endif
600613
returninvisible;
601614
}
602615
}
@@ -608,7 +621,11 @@ bool MtmXidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
608621
}
609622
}
610623
MtmUnlock();
624+
#ifDEBUG_LEVEL>1
611625
MTM_ELOG(ERROR,"Failed to get status of XID %llu in %lld usec", (long64)xid,MtmGetSystemTime()-start);
626+
#else
627+
MTM_ELOG(ERROR,"Failed to get status of XID %llu", (long64)xid);
628+
#endif
612629
return true;
613630
}
614631

@@ -3815,6 +3832,7 @@ bool MtmFilterTransaction(char* record, int size)
38153832
switch (event)
38163833
{
38173834
casePGLOGICAL_PREPARE:
3835+
return false;
38183836
casePGLOGICAL_PRECOMMIT_PREPARED:
38193837
casePGLOGICAL_ABORT_PREPARED:
38203838
gid=pq_getmsgstring(&s);

‎pglogical_apply.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,9 @@ process_remote_commit(StringInfo in)
649649
lsn_torigin_lsn;
650650
intorigin_node;
651651
chargid[MULTIMASTER_MAX_GID_SIZE];
652+
653+
gid[0]='\0';
654+
652655
/* read event */
653656
event=pq_getmsgbyte(in);
654657
MtmReplicationNodeId=pq_getmsgbyte(in);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp