postgresql/src/include/storage
Fujii Masao b53b88109f Improve error message when standby does accept connections.
Even after reaching the minimum recovery point, if there are long-lived
write transactions with 64 subtransactions on the primary, the recovery
snapshot may not yet be ready for hot standby, delaying read-only
connections on the standby. Previously, when read-only connections were
not accepted due to this condition, the following error message was logged:

    FATAL:  the database system is not yet accepting connections
    DETAIL:  Consistent recovery state has not been yet reached.

This DETAIL message was misleading because the following message was
already logged in this case:

    LOG:  consistent recovery state reached

This contradiction, i.e., indicating that the recovery state was consistent
while also stating it wasn’t, caused confusion.

This commit improves the error message to better reflect the actual state:

    FATAL: the database system is not yet accepting connections
    DETAIL: Recovery snapshot is not yet ready for hot standby.
    HINT: To enable hot standby, close write transactions with more than 64 subtransactions on the primary server.

To implement this, the commit introduces a new postmaster signal,
PMSIGNAL_RECOVERY_CONSISTENT. When the startup process reaches
a consistent recovery state, it sends this signal to the postmaster,
allowing it to correctly recognize that state.

Since this is not a clear bug, the change is applied only to the master
branch and is not back-patched.

Author: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/02db8cd8e1f527a8b999b94a4bee3165@oss.nttdata.com
2025-04-02 15:13:01 +09:00
..
.gitignore When trace_lwlocks is used, identify individual lwlocks by name. 2015-09-11 14:01:39 -04:00
aio.h bufmgr: Implement AIO read support 2025-03-30 17:28:03 -04:00
aio_internal.h aio, bufmgr: Comment fixes/improvements 2025-03-29 14:45:42 -04:00
aio_subsys.h aio: Infrastructure for io_method=worker 2025-03-18 11:54:01 -04:00
aio_types.h aio: Add WARNING result status 2025-03-30 16:27:10 -04:00
barrier.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
block.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
buf.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
buf_internals.h aio: Add test_aio module 2025-04-01 13:47:46 -04:00
buffile.h Swap order of extern/static and pg_nodiscard 2025-03-14 07:18:07 +01:00
bufmgr.h Enable IO concurrency on all systems 2025-03-30 19:16:47 -04:00
bufpage.h bufmgr: Implement AIO read support 2025-03-30 17:28:03 -04:00
bulk_write.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
checksum.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
checksum_impl.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
condition_variable.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
copydir.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
dsm.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
dsm_impl.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
dsm_registry.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
fd.h aio: Implement support for reads in smgr/md/fd 2025-03-29 13:38:35 -04:00
fileset.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
freespace.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
fsm_internals.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
indexfsm.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
io_worker.h aio: Infrastructure for io_method=worker 2025-03-18 11:54:01 -04:00
ipc.h pg_noreturn to replace pg_attribute_noreturn() 2025-03-13 12:37:26 +01:00
item.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
itemid.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
itemptr.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
large_object.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
latch.h Split WaitEventSet functions to separate source file 2025-03-06 01:26:16 +02:00
lmgr.h Add GUC option to log lock acquisition failures. 2025-03-14 23:14:12 +09:00
lock.h Fix crash if LockErrorCleanup() is called twice 2025-03-28 20:19:17 +02:00
lockdefs.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
lwlock.h aio: Add io_method=io_uring 2025-03-26 19:49:13 -04:00
lwlocklist.h aio: Add io_method=worker 2025-03-18 11:54:01 -04:00
md.h aio: Implement support for reads in smgr/md/fd 2025-03-29 13:38:35 -04:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
off.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_sema.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_shmem.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
pmsignal.h Improve error message when standby does accept connections. 2025-04-02 15:13:01 +09:00
predicate.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
predicate_internals.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
proc.h aio: Infrastructure for io_method=worker 2025-03-18 11:54:01 -04:00
procarray.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
proclist.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
proclist_types.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
procnumber.h Fix comment for MAX_BACKENDS. 2025-02-24 15:02:09 -06:00
procsignal.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
read_stream.h read_stream: Introduce and use optional batchmode support 2025-03-30 18:36:41 -04:00
reinit.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
relfilelocator.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
s_lock.h Use a non-locking initial test in TAS_SPIN on AArch64. 2025-01-10 13:18:04 -06:00
sharedfileset.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
shm_mq.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
shm_toc.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
shmem.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
sinval.h Avoid invalidating all RelationSyncCache entries on publication rename. 2025-03-13 09:16:33 +05:30
sinvaladt.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
smgr.h aio: Implement support for reads in smgr/md/fd 2025-03-29 13:38:35 -04:00
spin.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
standby.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
standbydefs.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
sync.h Update copyright for 2025 2025-01-01 11:21:55 -05:00
waiteventset.h Fix compiler warnings about typedef redefinitions 2025-03-06 03:10:22 +02:00