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: Avoid repeated decoding of prepared transactions after a restart
Date: Mon, 01 Mar 2021 03:51:47 +0000
Message-ID: <E1lGZb1-00008g-UN@gemulon.postgresql.org> (raw)

Avoid repeated decoding of prepared transactions after a restart.

In commit a271a1b50e, we allowed decoding at prepare time and the prepare
was decoded again if there is a restart after decoding it. It was done
that way because we can't distinguish between the cases where we have not
decoded the prepare because it was prior to consistent snapshot or we have
decoded it earlier but restarted. To distinguish between these two cases,
we have introduced an initial_consistent_point at the slot level which is
an LSN at which we found a consistent point at the time of slot creation.
This is also the point where we have exported a snapshot for the initial
copy. So, prepare transaction prior to this point are sent along with
commit prepared.

This commit bumps SNAPBUILD_VERSION because of change in SnapBuild. It
will break existing slots which is fine in a major release.

Author: Ajin Cherian, based on idea by Andres Freund
Reviewed-by: Amit Kapila and Vignesh C
Discussion: https://postgr.es/m/d0f60d60-133d-bf8d-bd70-47784d8fabf3@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8bdb1332eb51837c15a10a972c179b84f654279e

Modified Files
--------------
contrib/test_decoding/expected/twophase.out        | 38 +++++++---------------
contrib/test_decoding/expected/twophase_stream.out | 28 ++--------------
doc/src/sgml/logicaldecoding.sgml                  |  9 ++---
src/backend/replication/logical/decode.c           |  2 ++
src/backend/replication/logical/logical.c          |  3 +-
src/backend/replication/logical/reorderbuffer.c    | 10 +++---
src/backend/replication/logical/snapbuild.c        | 26 +++++++++++++--
src/include/replication/reorderbuffer.h            |  1 +
src/include/replication/slot.h                     |  7 ++++
src/include/replication/snapbuild.h                |  4 ++-
10 files changed, 61 insertions(+), 67 deletions(-)



Message-ID: <E1lGZb1-00008g-UN@gemulon.postgresql.org>
Permalink:  ../E1lGZb1-00008g-UN@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lGZb1-00008g-UN@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 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-committers@postgresql.org
  Cc: akapila@postgresql.org
  Subject: Re: pgsql: Avoid repeated decoding of prepared transactions after a restart
  In-Reply-To: <E1lGZb1-00008g-UN@gemulon.postgresql.org>
  References: <E1lGZb1-00008g-UN@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