]> granicus.if.org Git - postgresql/commitdiff
Fix thinko introduced in 2bef06d516460 et al.
authorAndres Freund <andres@anarazel.de>
Sun, 6 Aug 2017 03:52:53 +0000 (20:52 -0700)
committerAndres Freund <andres@anarazel.de>
Sun, 6 Aug 2017 21:20:55 +0000 (14:20 -0700)
The callers for GetOldestSafeDecodingTransactionId() all inverted the
argument for the argument introduced in 2bef06d516460. Luckily this
appears to be inconsequential for the moment, as we wait for
concurrent in-progress transaction when assembling a
snapshot. Additionally this could only make a difference when adding a
second logical slot, because only a pre-existing slot could cause an
issue by lowering the returned xid dangerously much.

Reported-By: Antonin Houska
Discussion: https://postgr.es/m/32704.1496993134@localhost
Backport: 9.4-, where 2bef06d516460 was backpatched to.

src/backend/replication/logical/logical.c
src/backend/replication/logical/snapbuild.c

index 85721ead3eca9b2641f88431bff044810f29f177..efb9785f25e5fc23f2c5149dee9e617706400e94 100644 (file)
@@ -288,7 +288,7 @@ CreateInitDecodingContext(char *plugin,
         */
        LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
 
-       xmin_horizon = GetOldestSafeDecodingTransactionId(need_full_snapshot);
+       xmin_horizon = GetOldestSafeDecodingTransactionId(!need_full_snapshot);
 
        slot->effective_catalog_xmin = xmin_horizon;
        slot->data.catalog_xmin = xmin_horizon;
index 281b7ab869f5af0c2ef74ff30e9a95b0c3b339c3..153d1712ef3a2cef4452f8f00a03a722ba6e4057 100644 (file)
@@ -574,7 +574,7 @@ SnapBuildInitialSnapshot(SnapBuild *builder)
                TransactionId safeXid;
 
                LWLockAcquire(ProcArrayLock, LW_SHARED);
-               safeXid = GetOldestSafeDecodingTransactionId(true);
+               safeXid = GetOldestSafeDecodingTransactionId(false);
                LWLockRelease(ProcArrayLock);
 
                Assert(TransactionIdPrecedesOrEquals(safeXid, snap->xmin));