pgsql: postmaster: Don't repeatedly transition to crashing state

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: postmaster: Don't repeatedly transition to crashing state
Date: 2025-01-24 22:42:08
Message-ID: E1tbSNL-003L6r-Q2@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

postmaster: Don't repeatedly transition to crashing state

Previously HandleChildCrash() skipped logging and signalling child exits if
already in an immediate shutdown or in FatalError state, but still
transitioned server state in response to a crash. That's redundant.

In the other place we transition to FatalError, we do take care to not do so
when already in FatalError state.

To make it easier to combine different paths for entering FatalError state,
only do so once in HandleChildCrash().

Reviewed-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Discussion: https://postgr.es/m/kgng5nrvnlv335evmsuvpnh354rw7qyazl73kdysev2cr2v5zu@m3cfzxicm5kp

Branch
------
master

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

Modified Files
--------------
src/backend/postmaster/postmaster.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2025-01-24 22:59:27 pgsql: Add SQL function CASEFOLD().
Previous Message Tom Lane 2025-01-24 18:20:51 pgsql: Make jsonb casts to scalar types translate JSON null to SQL NULL