pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Prevent concurrent SimpleLruTruncate() for any given SLRU.
Date: Sat, 15 Aug 2020 17:20:14 +0000
Message-ID: <E1k6zqo-0008VA-Vj@gemulon.postgresql.org> (raw)

Prevent concurrent SimpleLruTruncate() for any given SLRU.

The SimpleLruTruncate() header comment states the new coding rule.  To
achieve this, add locktype "frozenid" and two LWLocks.  This closes a
rare opportunity for data loss, which manifested as "apparent
wraparound" or "could not access status of transaction" errors.  Data
loss is more likely in pg_multixact, due to released branches' thin
margin between multiStopLimit and multiWrapLimit.  If a user's physical
replication primary logged ":  apparent wraparound" messages, the user
should rebuild standbys of that primary regardless of symptoms.  At less
risk is a cluster having emitted "not accepting commands" errors or
"must be vacuumed" warnings at some point.  One can test a cluster for
this data loss by running VACUUM FREEZE in every database.  Back-patch
to 9.5 (all supported versions).

Discussion: https://postgr.es/m/20190218073103.GA1434723@rfd.leadboat.com

Branch
------
REL_11_STABLE

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

Modified Files
--------------
doc/src/sgml/catalogs.sgml               |  4 +++-
doc/src/sgml/monitoring.sgml             | 20 +++++++++++++++--
src/backend/access/transam/slru.c        |  8 +++++++
src/backend/access/transam/subtrans.c    |  4 ++--
src/backend/commands/async.c             | 37 +++++++++++++++++++++++---------
src/backend/commands/vacuum.c            | 13 +++++++++++
src/backend/storage/lmgr/lmgr.c          | 20 +++++++++++++++++
src/backend/storage/lmgr/lwlocknames.txt |  2 ++
src/backend/utils/adt/lockfuncs.c        | 12 +++++++++++
src/include/storage/lmgr.h               |  3 +++
src/include/storage/lock.h               | 10 +++++++++
11 files changed, 118 insertions(+), 15 deletions(-)



view thread (9+ messages)  latest in thread

Message-ID: <E1k6zqo-0008VA-Vj@gemulon.postgresql.org>
Permalink:  ../E1k6zqo-0008VA-Vj@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1k6zqo-0008VA-Vj@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Prevent concurrent SimpleLruTruncate() for any given SLRU.
  In-Reply-To: <E1k6zqo-0008VA-Vj@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