pgsql: Remove recovery.signal at recovery end when both signal files ar

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove recovery.signal at recovery end when both signal files ar
Date: 2026-02-16 04:59:21
Message-ID: E1vrqhc-0012yJ-2f@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove recovery.signal at recovery end when both signal files are present.

When both standby.signal and recovery.signal are present, standby.signal
takes precedence and the server runs in standby mode. Previously,
in this case, recovery.signal was not removed at the end of standby mode
(i.e., on promotion) or at the end of archive recovery, while standby.signal
was removed. As a result, a leftover recovery.signal could cause
a subsequent restart to enter archive recovery unexpectedly, potentially
preventing the server from starting. This behavior was surprising and
confusing to users.

This commit fixes the issue by updating the recovery code to remove
recovery.signal alongside standby.signal when both files are present and
recovery completes.

Because this code path is particularly sensitive and changes in recovery
behavior can be risky for stable branches, this change is applied only to
the master branch.

Reported-by: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
Author: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: David Steele <david(at)pgbackrest(dot)org>
Discussion: https://postgr.es/m/CAM527d8PVAQFLt_ndTXE19F-XpDZui861882L0rLY3YihQB8qA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/351265a6c7fd15737e4b68cada778728fc325a8b

Modified Files
--------------
src/backend/access/transam/xlogrecovery.c | 10 ++++++----
src/test/recovery/t/002_archiving.pl | 18 +++++++++++++++++-
2 files changed, 23 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-02-16 08:38:03 pgsql: Change remaining StaticAssertStmt() to StaticAssertDecl()
Previous Message Michael Paquier 2026-02-16 03:19:23 pgsql: pgcrypto: Tweak error message for incorrect session key length