pgsql: RelationTruncate() must set DELAY_CHKPT_START.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: RelationTruncate() must set DELAY_CHKPT_START.
Date: 2024-12-02 21:32:11
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

RelationTruncate() must set DELAY_CHKPT_START.

Previously, it set only DELAY_CHKPT_COMPLETE. That was important,
because it meant that if the XLOG_SMGR_TRUNCATE record preceded a
XLOG_CHECKPOINT_ONLINE record in the WAL, then the truncation would also
happen on disk before the XLOG_CHECKPOINT_ONLINE record was
written.

However, it didn't guarantee that the sync request for the truncation
was processed before the XLOG_CHECKPOINT_ONLINE record was written. By
setting DELAY_CHKPT_START, we guarantee that if an XLOG_SMGR_TRUNCATE
record is written to WAL before the redo pointer of a concurrent
checkpoint, the sync request queued by that operation must be processed
by that checkpoint, rather than being left for the following one.

This is a refinement of commit 412ad7a5563. Back-patch to all supported
releases, like that commit.

Author: Robert Haas <robertmhaas(at)gmail(dot)com>
Reported-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Discussion: https://postgr.es/m/CA%2BhUKG%2B-2rjGZC2kwqr2NMLBcEBp4uf59QT1advbWYF_uc%2B0Aw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/75818b3afbf850d600e0fcd1a3b03199077063f8

Modified Files
--------------
src/backend/catalog/storage.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2024-12-02 21:32:24 pgsql: RelationTruncate() must set DELAY_CHKPT_START.
Previous Message Nathan Bossart 2024-12-02 19:31:12 pgsql: Deprecate MD5 passwords.