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: Try to handle torn reads of pg_control in frontend.
Date: Mon, 16 Oct 2023 04:39:35 +0000
Message-ID: <E1qsFOA-000mxg-QI@gemulon.postgresql.org> (raw)

Try to handle torn reads of pg_control in frontend.

Some of our src/bin tools read the control file without any kind of
interlocking against concurrent writes from the server.  At least ext4
and ntfs can expose partially modified contents when you do that.

For now, we'll try to tolerate this by retrying up to 10 times if the
checksum doesn't match, until we get two reads in a row with the same
bad checksum.  This is not guaranteed to reach the right conclusion, but
it seems very likely to.  Thanks to Tom Lane for this suggestion.

Various ideas for interlocking or atomicity were considered too
complicated, unportable or expensive given the lack of field reports,
but remain open for future reconsideration.

Back-patch as far as 12.  It doesn't seem like a good idea to put a
heuristic change for a very rare problem into the final release of 11.

Reviewed-by: Anton A. Melnikov <aamelnikov@inbox.ru>
Reviewed-by: David Steele <david@pgmasters.net>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/20221123014224.xisi44byq3cf5psi%40awork3.anarazel.de

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5e39884d322a7dd1dd595fbaaeb1f88c8907d3a6

Modified Files
--------------
src/common/controldata_utils.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)



view thread (6+ messages)  latest in thread

Message-ID: <E1qsFOA-000mxg-QI@gemulon.postgresql.org>
Permalink:  ../E1qsFOA-000mxg-QI@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qsFOA-000mxg-QI@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: tmunro@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Try to handle torn reads of pg_control in frontend.
  In-Reply-To: <E1qsFOA-000mxg-QI@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