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: Avoid trying to write an empty WAL record in log_newpage_range()
Date: Mon, 17 Apr 2023 18:22:34 +0000
Message-ID: <E1poTUn-003ZRV-HF@gemulon.postgresql.org> (raw)

Avoid trying to write an empty WAL record in log_newpage_range().

If the last few pages in the specified range are empty (all zero),
then log_newpage_range() could try to emit an empty WAL record
containing no FPIs.  This at least upsets an Assert in
ReserveXLogInsertLocation, and might perhaps have bad real-world
consequences in non-assert builds.

This has been broken since log_newpage_range() was introduced,
but the case was hard if not impossible to hit before commit 3d6a98457
decided it was okay to leave VM and FSM pages intentionally zero.
Nonetheless, it seems prudent to back-patch.  log_newpage_range()
was added in v12 but later back-patched, so this affects all
supported branches.

Matthias van de Meent, per report from Justin Pryzby

Discussion: https://postgr.es/m/ZD1daibg4RF50IOj@telsasoft.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/86874a6dfc8b1878bede18437b1709fbe485a911

Modified Files
--------------
src/backend/access/transam/xloginsert.c | 4 ++++
1 file changed, 4 insertions(+)



view thread (6+ messages)  latest in thread

Message-ID: <E1poTUn-003ZRV-HF@gemulon.postgresql.org>
Permalink:  ../E1poTUn-003ZRV-HF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1poTUn-003ZRV-HF@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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid trying to write an empty WAL record in log_newpage_range()
  In-Reply-To: <E1poTUn-003ZRV-HF@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