pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Don't force-assign transaction id when exporting a snapshot.
Date: Wed, 14 Jun 2017 18:57:29 +0000
Message-ID: <E1dLDTt-0004AC-W5@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Don't force-assign transaction id when exporting a snapshot.

Previously we required every exported transaction to have an xid
assigned. That was used to check that the exporting transaction is
still running, which in turn is needed to guarantee that that
necessary rows haven't been removed in between exporting and importing
the snapshot.

The exported xid caused unnecessary problems with logical decoding,
because slot creation has to wait for all concurrent xid to finish,
which in turn serializes concurrent slot creation.   It also
prohibited snapshots to be exported on hot-standby replicas.

Instead export the virtual transactionid, which avoids the unnecessary
serialization and the inability to export snapshots on standbys. This
changes the file name of the exported snapshot, but since we never
documented what that one means, that seems ok.

Author: Petr Jelinek, slightly editorialized by me
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/f598b4b8-8cd7-0d54-0939-adda763d8c34@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6c2003f8a1bbc7c192a2e83ec51581c018aa162f

Modified Files
--------------
doc/src/sgml/ref/set_transaction.sgml       |   6 +-
src/backend/replication/logical/snapbuild.c |  14 ++--
src/backend/storage/ipc/procarray.c         |  11 ++-
src/backend/storage/lmgr/predicate.c        |  26 +++---
src/backend/utils/time/snapmgr.c            | 119 ++++++++++++++++++----------
src/include/storage/predicate.h             |   4 +-
src/include/storage/procarray.h             |   2 +-
7 files changed, 115 insertions(+), 67 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


view thread (5+ messages)  latest in thread

Message-ID: <E1dLDTt-0004AC-W5@gemulon.postgresql.org>
Permalink:  ../E1dLDTt-0004AC-W5@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1dLDTt-0004AC-W5@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: andres@anarazel.de
  Subject: Re: pgsql: Don't force-assign transaction id when exporting a snapshot.
  In-Reply-To: <E1dLDTt-0004AC-W5@gemulon.postgresql.org>
  References: <E1dLDTt-0004AC-W5@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