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 <[email protected]>
Author: Imran Zaheer <[email protected]>
Author: Fujii Masao <[email protected]>
Reviewed-by: Michael Paquier <[email protected]>
Discussion: 
https://postgr.es/m/CA+UBfamzfEReT0VOGRUW_=_aeccyq-cnklr_t4q+yemjah3...@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(-)

Reply via email to