pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix uninitialized access to InitialRunningXacts during decoding
Date: Tue, 12 Sep 2023 04:56:15 +0000
Message-ID: <E1qfvRe-003S1y-Mx@gemulon.postgresql.org> (raw)

Fix uninitialized access to InitialRunningXacts during decoding after ERROR.

The transactions and subtransactions array that was allocated under
snapshot builder memory context and recorded during decoding was not
cleared in case of errors. This can result in an assertion failure if we
attempt to retry logical decoding within the same session. To address this
issue, we register a callback function under the snapshot builder memory
context to clear the recorded transactions and subtransactions array along
with the context.

This problem doesn't exist in PG16 and HEAD as instead of using
InitialRunningXacts, we added the list of transaction IDs and
sub-transaction IDs, that have modified catalogs and are running during
snapshot serialization, to the serialized snapshot (see commit 7f13ac8123).

Author: Hou Zhijie
Reviewed-by: Amit Kapila
Backpatch-through: 11
Discussion: http://postgr.es/m/18055-ab3beed9f4b7b7d6@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c570bb4d61b6b1225c157252c65af538834136f2

Modified Files
--------------
src/backend/replication/logical/snapbuild.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)



view thread (10+ messages)  latest in thread

Message-ID: <E1qfvRe-003S1y-Mx@gemulon.postgresql.org>
Permalink:  ../E1qfvRe-003S1y-Mx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qfvRe-003S1y-Mx@gemulon.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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix uninitialized access to InitialRunningXacts during decoding
  In-Reply-To: <E1qfvRe-003S1y-Mx@gemulon.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