Re: BUG #19897: Recovery fails after "LOG: consistent recovery state reached"

From: TAKATSUKA Haruka <harukat(at)sraoss(dot)co(dot)jp>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19897: Recovery fails after "LOG: consistent recovery state reached"
Date: 2026-11-19 01:42:03
Message-ID: 20261119104203.f4fd0f95c12c0778783ff5e4@sraoss.co.jp
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you for creating the patch.

I applied the contents of this v3 patch to version 15.x
(with no special adjustments except for pg_fallthrough.)

I tested it on the pgdata where the issue was initially detected in 15.x
and confirmed that the problem has been resolved.

I also verified that the regular regression tests passed on 15.x.
But TAP test No.9 of 003_recovery_targets.pl which is commented as
"Check behavior when recovery ends before target is reached" is failed.
Is is expected "FATAL: recovery ended before configured recovery target was reached",
but after applying this patch the server now starts successfully.

+++ tap check in src/test/recovery +++
t/003_recovery_targets.pl .. 9/?
# Failed test 'recovery end before target reached is a fatal error'
# at t/003_recovery_targets.pl line 182.
t/003_recovery_targets.pl .. 29/? # Looks like you failed 1 test of 29.
t/003_recovery_targets.pl .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/29 subtests

Test Summary Report
-------------------
t/003_recovery_targets.pl (Wstat: 256 (exited 1) Tests: 29 Failed: 1)
Failed test: 9
Non-zero exit status: 1
Files=1, Tests=29, 202 wallclock secs ( 0.01 usr 0.01 sys + 2.01 cusr 3.90 csys = 5.93 CPU)
Result: FAIL
make: *** [Makefile:23: check] Error 1

$ tail tmp_check/log/003_recovery_targets_standby_8.log
2026-11-19 09:44:18.606 JST [6254] LOG: starting point-in-time recovery to "does_not_exist"
2026-11-19 09:44:18.609 JST [6254] LOG: restored log file "000000010000000000000003" from archive
2026-11-19 09:44:18.621 JST [6254] LOG: redo starts at 0/3000028
2026-11-19 09:44:18.625 JST [6254] LOG: restored log file "000000010000000000000004" from archive
2026-11-19 09:44:18.626 JST [6254] LOG: consistent recovery state reached at 0/3000100
2026-11-19 09:44:18.626 JST [6251] LOG: database system is ready to accept read-only connections
cp: cannot stat '/var/lib/pgsql/install/postgresql-15.5/src/test/recovery/tmp_check/t_003_recovery_targets_primary_data/archives/000000010000000000000005': No such file or directory
cp: cannot stat '/var/lib/pgsql/install/postgresql-15.5/src/test/recovery/tmp_check/t_003_recovery_targets_primary_data/archives/000000010000000000000005': No such file or directory
2026-11-19 09:44:18.635 JST [6254] LOG: pausing at the end of recovery
2026-11-19 09:44:18.635 JST [6254] HINT: Execute pg_wal_replay_resume() to promote.

I also tried on REL_15_STABLE head code and got same results.

with best regards,
Takatsuka Haruka / SRA OSS

On Sun, 15 Nov 2026 10:15:02 -0600
Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:

> And after thinking about these changes, I realized that both of our
> patches broke standby promotion: both resulted in cases where we
> promoted the standby when we shouldn't have.
>
> The attached v3 now doesn't modify the logic when we have a primary
> connection set, and contains both patches in one file instead.

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message David Rowley 2026-11-18 21:29:27 Re: BUG #19915: Qual over function-wrapped grouping column pushed past DISTINCT ON returns wrong rows