pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Implement waiting for given lsn at transaction start
Date: Tue, 07 Apr 2020 20:54:53 +0000
Message-ID: <E1jLvFF-00017n-Cn@gemulon.postgresql.org> (raw)

Implement waiting for given lsn at transaction start

This commit adds following optional clause to BEGIN and START TRANSACTION
commands.

  WAIT FOR LSN lsn [ TIMEOUT timeout ]

New clause pospones transaction start till given lsn is applied on standby.
This clause allows user be sure, that changes previously made on primary would
be visible on standby.

New shared memory struct is used to track awaited lsn per backend.  Recovery
process wakes up backend once required lsn is applied.

Author: Ivan Kartyshov, Anna Akenteva
Reviewed-by: Craig Ringer, Thomas Munro, Robert Haas, Kyotaro Horiguchi
Reviewed-by: Masahiko Sawada, Ants Aasma, Dmitry Ivanov, Simon Riggs
Reviewed-by: Amit Kapila, Alexander Korotkov
Discussion: https://postgr.es/m/0240c26c-9f84-30ea-fca9-93ab2df5f305%40postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0f5ca02f53ac2b211d8518f0882c49284c0c9610

Modified Files
--------------
doc/src/sgml/ref/begin.sgml             |  17 +-
doc/src/sgml/ref/start_transaction.sgml |  17 +-
src/backend/access/transam/xlog.c       |  13 ++
src/backend/commands/Makefile           |   3 +-
src/backend/commands/wait.c             | 295 ++++++++++++++++++++++++++++++++
src/backend/nodes/copyfuncs.c           |  15 ++
src/backend/nodes/equalfuncs.c          |  13 ++
src/backend/nodes/outfuncs.c            |  28 +++
src/backend/parser/gram.y               |  37 +++-
src/backend/storage/ipc/ipci.c          |   7 +
src/backend/storage/lmgr/proc.c         |   4 +
src/backend/tcop/utility.c              |  13 ++
src/backend/utils/adt/misc.c            |   2 -
src/include/commands/wait.h             |  26 +++
src/include/nodes/nodes.h               |   1 +
src/include/nodes/parsenodes.h          |  12 ++
src/include/parser/kwlist.h             |   3 +
src/include/utils/timestamp.h           |   2 +
src/test/recovery/t/020_begin_wait.pl   |  85 +++++++++
src/tools/pgindent/typedefs.list        |   2 +
20 files changed, 585 insertions(+), 10 deletions(-)



view thread (11+ messages)  latest in thread

Message-ID: <E1jLvFF-00017n-Cn@gemulon.postgresql.org>
Permalink:  ../E1jLvFF-00017n-Cn@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jLvFF-00017n-Cn@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: akorotkov@postgresql.org
  Subject: Re: pgsql: Implement waiting for given lsn at transaction start
  In-Reply-To: <E1jLvFF-00017n-Cn@gemulon.postgresql.org>
  References: <E1jLvFF-00017n-Cn@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