pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add basic infrastructure for 64 bit transaction IDs.
Date: Thu, 28 Mar 2019 05:27:01 +0000
Message-ID: <E1h9NZ7-0008KJ-12@gemulon.postgresql.org> (raw)

Add basic infrastructure for 64 bit transaction IDs.

Instead of inferring epoch progress from xids and checkpoints,
introduce a 64 bit FullTransactionId type and use it to track xid
generation.  This fixes an unlikely bug where the epoch is reported
incorrectly if the range of active xids wraps around more than once
between checkpoints.

The only user-visible effect of this commit is to correct the epoch
used by txid_current() and txid_status(), also visible with
pg_controldata, in those rare circumstances.  It also creates some
basic infrastructure so that later patches can use 64 bit
transaction IDs in more places.

The new type is a struct that we pass by value, as a form of strong
typedef.  This prevents the sort of accidental confusion between
TransactionId and FullTransactionId that would be possible if we
were to use a plain old uint64.

Author: Thomas Munro
Reported-by: Amit Kapila
Reviewed-by: Andres Freund, Tom Lane, Heikki Linnakangas
Discussion: https://postgr.es/m/CAA4eK1%2BMv%2Bmb0HFfWM9Srtc6MVe160WFurXV68iAFMcagRZ0dQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2fc7af5e966043a412e8e69c135fae55a2db6d4f

Modified Files
--------------
src/backend/access/rmgrdesc/xlogdesc.c  |   4 +-
src/backend/access/transam/clog.c       |   8 +--
src/backend/access/transam/commit_ts.c  |   4 +-
src/backend/access/transam/multixact.c  |  20 ++----
src/backend/access/transam/subtrans.c   |   8 ++-
src/backend/access/transam/twophase.c   |  40 ++++-------
src/backend/access/transam/varsup.c     |  76 ++++++++++++++++-----
src/backend/access/transam/xact.c       |  35 ++--------
src/backend/access/transam/xlog.c       | 113 ++++++++------------------------
src/backend/replication/walreceiver.c   |   5 +-
src/backend/replication/walsender.c     |   5 +-
src/backend/storage/ipc/procarray.c     |  34 +++-------
src/backend/storage/ipc/standby.c       |   2 +-
src/backend/storage/lmgr/predicate.c    |   2 +-
src/backend/utils/adt/txid.c            |  13 ++--
src/backend/utils/misc/pg_controldata.c |   5 +-
src/bin/pg_controldata/pg_controldata.c |   5 +-
src/bin/pg_resetwal/pg_resetwal.c       |  20 +++---
src/include/access/transam.h            |  51 +++++++++++++-
src/include/access/xlog.h               |   1 -
src/include/catalog/pg_control.h        |   6 +-
src/include/storage/standby.h           |   2 +-
src/include/storage/standbydefs.h       |   2 +-
src/tools/pgindent/typedefs.list        |   1 +
24 files changed, 224 insertions(+), 238 deletions(-)



Message-ID: <E1h9NZ7-0008KJ-12@gemulon.postgresql.org>
Permalink:  ../E1h9NZ7-0008KJ-12@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1h9NZ7-0008KJ-12@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: tmunro@postgresql.org
  Subject: Re: pgsql: Add basic infrastructure for 64 bit transaction IDs.
  In-Reply-To: <E1h9NZ7-0008KJ-12@gemulon.postgresql.org>
  References: <E1h9NZ7-0008KJ-12@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