BUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: mansour(at)oxplot(dot)com
Subject: BUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)
Date: 2019-05-16 04:56:15
Message-ID: 15808-b2c1d6d05b7ef045@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: 15808
Logged by: Mansour Behabadi
Email address: mansour(at)oxplot(dot)com
PostgreSQL version: 10.6
Operating system: Amazon RDS
Description:

We have some custom logical replication client that makes
pg_logical_slot_get_changes() calls in SQL. E.g.:

select max(1) from pg_logical_slot_get_changes('testslot', '5754/E9332B68',
1000);

Once every few thousand calls, we get the following error:

ERROR: subtransaction logged without previous top-level txn record (SQLSTATE
XX000)

which will persist on all subsequent calls, essentially forcing us to drop
the slot and create a new one.

We had little success looking for solutions online and the only lead is that
of a recent commit
(https://github.com/postgres/postgres/commit/f49a80c481f74fa81407dce8e51dea6956cb64f8)
whose commit message seem to correlate to the error we're getting. Below is
the relevant excerpt:

The second issue concerns SnapBuilder snapshots and subtransactions.
SnapBuildDistributeNewCatalogSnapshot never assigned a snapshot to a
transaction that is known to be a subtxn, which is good in the common
case that the top-level transaction already has one (no point in doing
so), but a bug otherwise. To fix, arrange to transfer the snapshot from
the subtxn to its top-level txn as soon as the kinship gets known.
test_decoding's snapshot_transfer verifies this.

We're not sure if this is a fix to our problem and whether upgrading to
Postgres 11 (which has this change in it) will solve the issue.

Please let me know if any more info is needed.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-05-16 06:06:28 Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND
Previous Message Tom Lane 2019-05-16 04:51:34 Re: BUG #15804: Assertion failure when using logging_collector with EXEC_BACKEND