pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix data-corruption hazard in WAL-logged CREATE DATABASE.
Date: Sat, 06 Aug 2022 15:50:50 +0000
Message-ID: <E1oKM4g-000axS-DL@gemulon.postgresql.org> (raw)

Fix data-corruption hazard in WAL-logged CREATE DATABASE.

RelationCopyStorageUsingBuffer thought it could skip copying
empty pages, but of course that does not work at all, because
subsequent blocks will be out of place.

Also fix it to acquire share lock on the source buffer.  It *might*
be safe to not do that, but it's not very certain, and I don't think
this code deserves any benefit of the doubt.

Dilip Kumar, per complaint from me

Discussion: https://postgr.es/m/3679800.1659654066@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/692df425b6883dd3edcc15bb984415ef349fafb1

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)



view thread (2+ messages)

Message-ID: <E1oKM4g-000axS-DL@gemulon.postgresql.org>
Permalink:  ../E1oKM4g-000axS-DL@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oKM4g-000axS-DL@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix data-corruption hazard in WAL-logged CREATE DATABASE.
  In-Reply-To: <E1oKM4g-000axS-DL@gemulon.postgresql.org>
  References: <E1oKM4g-000axS-DL@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