BUG #14279: Logical decoding misses a transaction completely

From: marko(at)joh(dot)to
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14279: Logical decoding misses a transaction completely
Date: 2016-08-04 19:17:57
Message-ID: 20160804191757.1430.39011@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14279
Logged by: Marko Tiikkaja
Email address: marko(at)joh(dot)to
PostgreSQL version: 9.5.3
Operating system: Linux
Description:

Hi,

The following transaction does not get decoded at all in logical decoding:

BEGIN;
INSERT INTO foo VALUES ('bar');
SAVEPOINT s;
SELECT 1 FROM foo FOR UPDATE;
RELEASE SAVEPOINT s;
COMMIT;

The problem seems to be that ReorderBufferCommitChild() overwrites the main
transaction's base_snapshot with a NULL because it thinks the
subtransaction's base_snapshot_lsn=0 is older than the main transaction's
actual snapshot, which in ReorderBufferCommit:

/*
* If this transaction didn't have any real changes in our database,
it's
* OK not to have a snapshot. Note that ReorderBufferCommitChild will
have
* transferred its snapshot to this transaction if it had one and the
* toplevel tx didn't.
*/
if (txn->base_snapshot == NULL)
{
Assert(txn->ninvalidations == 0);
ReorderBufferCleanupTXN(rb, txn);
return;
}

causes the entire transaction to be skipped. I didn't debug further.

(Thanks to Andres Freund and Andrew Gierth for helping me track this problem
down!)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2016-08-04 19:40:18 Re: BUG #14279: Logical decoding misses a transaction completely
Previous Message David G. Johnston 2016-08-04 15:06:40 Re: [BUGS] Re: [BUGS] Return value error of‘to_timestamp’