pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: mansour@oxplot.com
Subject: BUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)
Date: Thu, 16 May 2019 04:56:15 +0000
Message-ID: <15808-b2c1d6d05b7ef045@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15808
Logged by:          Mansour Behabadi
Email address:      mansour@oxplot.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.



view thread (4+ messages)  latest in thread

Message-ID: <15808-b2c1d6d05b7ef045@postgresql.org>
Permalink:  ../15808-b2c1d6d05b7ef045@postgresql.org/
Also on:    postgresql.org/message-id/15808-b2c1d6d05b7ef045@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, mansour@oxplot.com
  Subject: Re: BUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)
  In-Reply-To: <15808-b2c1d6d05b7ef045@postgresql.org>
  References: <15808-b2c1d6d05b7ef045@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox