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: Fix off-by-one possibly leading to skipped XLOG_RUNNING_XACTS re
Date: Sun, 07 May 2017 00:01:23 +0000
Message-ID: <E1d79db-0001BO-Lr@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix off-by-one possibly leading to skipped XLOG_RUNNING_XACTS records.

Since 6ef2eba3f57f1 ("Skip checkpoints, archiving on idle systems."),
GetLastImportantRecPtr() is used to avoid performing superfluous
checkpoints, xlog switches, running-xact records when the system is
idle.  Unfortunately the check concerning running-xact records had a
off-by-one error, leading to such records being potentially skipped
when only a single record has been inserted since the last
running-xact record.

An alternative approach would have been to change
GetLastImportantRecPtr()'s definition to point to the end of records,
but that would make the checkpoint code more complicated.

Author: Andres Freund
Discussion: https://postgr.es/m/20170505012447.wsrympaxnfis6ojt@alap3.anarazel.de
Backpatch: no, code only present in master

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e6c44eef55cda493c759e926cecceb92186159b8

Modified Files
--------------
src/backend/postmaster/bgwriter.c     | 7 +++++--
src/backend/postmaster/checkpointer.c | 3 ++-
2 files changed, 7 insertions(+), 3 deletions(-)


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


Message-ID: <E1d79db-0001BO-Lr@gemulon.postgresql.org>
Permalink:  ../E1d79db-0001BO-Lr@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1d79db-0001BO-Lr@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: Fix off-by-one possibly leading to skipped XLOG_RUNNING_XACTS re
  In-Reply-To: <E1d79db-0001BO-Lr@gemulon.postgresql.org>
  References: <E1d79db-0001BO-Lr@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