Skip to content

Commit 6beea7c

Browse files
committed
Revert "Detect too late snapshot"
This reverts commit af5213a.
1 parent cd9d3a2 commit 6beea7c

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

contrib/multimaster/multimaster.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,6 @@ static void DtmInitialize()
748748
dtm->initialized = false;
749749
BgwPoolInit(&dtm->pool, MMExecutor, MMDatabaseName, MMQueueSize);
750750
RegisterXactCallback(DtmXactCallback, NULL);
751-
RegisterSubXactCallback(DtmSubXactCallback, NULL);
752751
}
753752
LWLockRelease(AddinShmemInitLock);
754753

contrib/pg_dtm/pg_dtm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ static SnapshotData DtmSnapshot = { HeapTupleSatisfiesMVCC };
107107
static bool DtmHasGlobalSnapshot;
108108
static bool DtmGlobalXidAssigned;
109109
static int DtmLocalXidReserve;
110+
static int DtmCurcid;
110111
static Snapshot DtmLastSnapshot;
111112
static TransactionManager DtmTM = {
112113
DtmGetTransactionStatus,
@@ -613,9 +614,9 @@ static Snapshot DtmGetSnapshot(Snapshot snapshot)
613614
}
614615
if (TransactionIdIsValid(DtmNextXid) && snapshot != &CatalogSnapshotData)
615616
{
616-
if (!DtmHasGlobalSnapshot) {
617+
if (!DtmHasGlobalSnapshot && (snapshot != DtmLastSnapshot || DtmCurcid != snapshot->curcid))
617618
DtmGlobalGetSnapshot(DtmNextXid, &DtmSnapshot, &dtm->minXid);
618-
}
619+
DtmCurcid = snapshot->curcid;
619620
DtmLastSnapshot = snapshot;
620621
DtmMergeWithGlobalSnapshot(snapshot);
621622
if (!IsolationUsesXactSnapshot())
@@ -725,7 +726,6 @@ static void DtmInitialize()
725726
dtm->nReservedXids = 0;
726727
dtm->minXid = InvalidTransactionId;
727728
RegisterXactCallback(DtmXactCallback, NULL);
728-
RegisterSubXactCallback(DtmSubXactCallback, NULL);
729729
}
730730
LWLockRelease(AddinShmemInitLock);
731731

contrib/pg_tsdtm/pg_dtm.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static cid_t dtm_sync(cid_t global_cid)
177177
SpinLockAcquire(&local->lock);
178178
}
179179
#endif
180-
return local_cid;
180+
return global_cid;
181181
}
182182

183183
void
@@ -647,10 +647,7 @@ cid_t DtmLocalAccess(DtmCurrentTrans* x, GlobalTransactionId gtid, cid_t global_
647647
x->is_global = true;
648648
}
649649
SpinLockRelease(&local->lock);
650-
if (global_cid < local_cid - DtmVacuumDelay*USEC) {
651-
elog(ERROR, "Too old snapshot: requested %ld, current %ld", global_cid, local_cid);
652-
}
653-
return global_cid;
650+
return local_cid;
654651
}
655652

656653
void DtmLocalBeginPrepare(GlobalTransactionId gtid)

0 commit comments

Comments
 (0)