postgresql/src/backend/postmaster
Fujii Masao ad8b674922 Shut down transaction tracking at startup process exit.
Maxim Orlov reported that the shutdown of standby server could result in
the following assertion failure. The cause of this issue was that,
when the shutdown caused the startup process to exit, recovery-time
transaction tracking was not shut down even if it's already initialized,
and some locks the tracked transactions were holding could not be released.
At this situation, if other process was invoked and the PGPROC entry that
the startup process used was assigned to it, it found such unreleased locks
and caused the assertion failure, during the initialization of it.

    TRAP: FailedAssertion("SHMQueueEmpty(&(MyProc->myProcLocks[i]))"

This commit fixes this issue by making the startup process shut down
transaction tracking and release all locks, at the exit of it.

Back-patch to all supported branches.

Reported-by: Maxim Orlov
Author: Fujii Masao
Reviewed-by: Maxim Orlov
Discussion: https://postgr.es/m/ad4ce692cc1d89a093b471ab1d969b0b@postgrespro.ru
2021-04-06 02:25:37 +09:00
..
autovacuum.c Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
bgworker.c Use SIGURG rather than SIGUSR1 for latches. 2021-03-01 12:44:12 +13:00
bgwriter.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
checkpointer.c Change checkpoint_completion_target default to 0.9 2021-03-24 13:07:51 -04:00
fork_process.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
interrupt.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
Makefile Partially deduplicate interrupt handling for background processes. 2019-12-17 13:14:28 -05:00
pgarch.c Do not rely on pgstat.h to indirectly include storage/ headers. 2021-04-02 20:02:47 -07:00
pgstat.c Split backend status and progress related functionality out of pgstat.c. 2021-04-03 11:42:52 -07:00
postmaster.c Improve connection denied error message during recovery. 2021-03-25 10:41:28 +09:00
startup.c Shut down transaction tracking at startup process exit. 2021-04-06 02:25:37 +09:00
syslogger.c Use errmsg_internal for debug messages 2021-02-17 11:33:25 +01:00
walwriter.c Force to send remaining WAL stats to the stats collector at walwriter exit. 2021-03-12 13:29:59 +09:00