Commit 5af4456a authored by Andres Freund's avatar Andres Freund

Fix thinko introduced in 2bef06d5 et al.

The callers for GetOldestSafeDecodingTransactionId() all inverted the
argument for the argument introduced in 2bef06d5. 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 2bef06d5 was backpatched to.
parent 0d1f98b8
......@@ -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;
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment