pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rework activation of commit timestamps during recovery
Date: Wed, 26 Sep 2018 01:33:13 +0000
Message-ID: <E1g4yhV-0003km-Si@gemulon.postgresql.org> (raw)

Rework activation of commit timestamps during recovery

The activation and deactivation of commit timestamp tracking has not
been handled consistently for a primary or standbys at recovery.  The
facility can be activated at three different moments of recovery:
- The beginning, where a primary would use the GUC value for the
decision-making, and where a standby relies on the contents of the
control file.
- When replaying a XLOG_PARAMETER_CHANGE record at redo.
- The end, where both primary and standby rely on the GUC value.

Using the GUC value for a primary at the beginning of recovery causes
problems with commit timestamp access when doing crash recovery.
Particularly, when replaying transaction commits, it could be possible
that an attempt to read commit timestamps is done for a transaction
which committed at a moment when track_commit_timestamp was disabled.

A test case is added to reproduce the failure.  The test works down to
v11 as it takes advantage of transaction commits within procedures.

Reported-by: Hailong Li
Author: Masahiko Sawasa, Michael Paquier
Reviewed-by: Kyotaro Horiguchi
Discussion: https://postgr.es/m/11224478-a782-203b-1f17-e4797b39bdf0@qunar.com
Backpatch-through: 9.5, where commit timestamps have been introduced.

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/commit_ts.c      |  9 ++++----
src/backend/access/transam/xlog.c           |  9 ++++----
src/test/modules/commit_ts/t/004_restart.pl | 36 +++++++++++++++++++++++++----
3 files changed, 40 insertions(+), 14 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1g4yhV-0003km-Si@gemulon.postgresql.org>
Permalink:  ../E1g4yhV-0003km-Si@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g4yhV-0003km-Si@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: michael@paquier.xyz
  Subject: Re: pgsql: Rework activation of commit timestamps during recovery
  In-Reply-To: <E1g4yhV-0003km-Si@gemulon.postgresql.org>
  References: <E1g4yhV-0003km-Si@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