pgsql: Fix checkpointer restartpoint assertion failure

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix checkpointer restartpoint assertion failure
Date: 2026-09-02 05:37:08
Message-ID: E1x1del-000000038YX-0ytU@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix checkpointer restartpoint assertion failure

When recovery starts from a backup without a signal file, pg_subtrans
is not started at the beginning of recovery and remains unstarted
throughout recovery. However, previously, a restartpoint run by
the checkpointer during recovery nevertheless tried to truncate
pg_subtrans, triggering the assertion failure:

TRAP: failed Assert("TransactionIdIsValid(initial)")

This commit fixes this by tracking whether pg_subtrans has been
started during recovery, and have the checkpointer check this flag
before truncating pg_subtrans at restartpoints.

Backpatch to all supported versions.

Reported-by: Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>
Author: Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>
Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/CA+UBfamzfEReT0VOGRUW_=_AecCYQ-CNKLR_T4Q+YEmJAH3fdg@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/backend/access/transam/xlog.c | 7 ++++---
src/backend/access/transam/xlogrecovery.c | 32 +++++++++++++++++++++++++++++++
src/include/access/xlogrecovery.h | 2 ++
3 files changed, 38 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2026-09-02 05:37:18 pgsql: Fix checkpointer restartpoint assertion failure
Previous Message Fujii Masao 2026-09-02 05:36:57 pgsql: Fix checkpointer restartpoint assertion failure