pgsql: Shut down transaction tracking at startup process exit.

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Shut down transaction tracking at startup process exit.
Date: 2021-04-05 17:28:08
Message-ID: E1lTT1E-0006bo-Nr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ad8b674922eb70dc5cd02951dd82fe2c4c37c80a

Modified Files
--------------
src/backend/postmaster/startup.c | 19 +++++++++++++++++++
src/backend/storage/ipc/standby.c | 15 +++++++++++++++
2 files changed, 34 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2021-04-05 17:28:34 pgsql: Shut down transaction tracking at startup process exit.
Previous Message Alvaro Herrera 2021-04-05 15:47:14 pgsql: Align some terms in arch-dev.sgml to glossary