pgsql: Improve client error messages for immediate-stop situations.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Improve client error messages for immediate-stop situations.
Дата
Msg-id E1ksUsp-0004KJ-2J@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Improve client error messages for immediate-stop situations.

Up to now, if the DBA issued "pg_ctl stop -m immediate", the message
sent to clients was the same as for a crash-and-restart situation.
This is confusing, not least because the message claims that the
database will soon be up again, something we have no business
predicting.

Improve things so that we can generate distinct messages for the two
cases (and also recognize an ad-hoc SIGQUIT, should somebody try that).
To do that, add a field to pmsignal.c's shared memory data structure
that the postmaster sets just before broadcasting SIGQUIT to its
children.  No interlocking seems to be necessary; the intervening
signal-sending and signal-receipt should sufficiently serialize accesses
to the field.  Hence, this isn't any riskier than the existing usages
of pmsignal.c.

We might in future extend this idea to improve other
postmaster-to-children signal scenarios, although none of them
currently seem to be as badly overloaded as SIGQUIT.

Discussion: https://postgr.es/m/559291.1608587013@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7e784d1dc191be24480a6b31a4ddc8e0e52be24d

Modified Files
--------------
src/backend/postmaster/postmaster.c |  4 ++++
src/backend/storage/ipc/pmsignal.c  | 39 ++++++++++++++++++++++++++++++--
src/backend/tcop/postgres.c         | 45 ++++++++++++++++++++++++++-----------
src/include/storage/pmsignal.h      | 14 +++++++++++-
4 files changed, 86 insertions(+), 16 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Fix typos and grammar in docs and comments
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix race condition between shutdown and unstarted background wor