pgsql: Fix checkpointer restartpoint assertion failure - Mailing list pgsql-committers

From Fujii Masao
Subject pgsql: Fix checkpointer restartpoint assertion failure
Date
Msg-id E1x1deQ-000000038XD-254N@gemulon.postgresql.org
Whole thread
List 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.zhir@gmail.com>
Author: Imran Zaheer <imran.zhir@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CA+UBfamzfEReT0VOGRUW_=_AecCYQ-CNKLR_T4Q+YEmJAH3fdg@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

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

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(-)


pgsql-committers by date:

Previous
From: Richard Guo
Date:
Subject: pgsql: Remove quals made redundant by reducing outer joins to antijoins
Next
From: Alexander Korotkov
Date:
Subject: pgsql: postgres_fdw: Fix "may be used uninitialized" warning in foreign