pgsql: Improve error detection capability in proclists.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Improve error detection capability in proclists.
Дата
Msg-id E1eYgpx-0001BP-C7@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Improve error detection capability in proclists.

Previously, although the initial state of a proclist_node is expected
to be next == prev == 0, proclist_delete_offset would reset nodes to
next == prev == INVALID_PGPROCNO when removing them from a list.
This is the same state that a node in a singleton list has, so that
it's impossible to distinguish not-in-a-list from in-a-list.  Change
proclist_delete_offset to reset removed nodes to next == prev == 0,
making it possible to distinguish those cases, and then add Asserts
to the list add and delete functions that the supplied node isn't
or is in a list at entry.  Also tighten assertions about the node
being in the particular list (not some other one) where it is possible
to check that in O(1) time.

In ConditionVariablePrepareToSleep, since we don't expect the process's
cvWaitLink to already be in a list, remove the more-or-less-useless
proclist_contains check; we'd rather have proclist_push_tail's new
assertion fire if that happens.

Improve various comments related to proclists, too.

Patch by me, reviewed by Thomas Munro.  This isn't back-patchable, since
there could theoretically be inlined copies of proclist_delete_offset in
third-party modules.  But it's only improving debuggability anyway.

Discussion: https://postgr.es/m/CAEepm=0NWKehYw7NDoUSf8juuKOPRnCyY3vuaSvhrEWsOTAa3w@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/storage/lmgr/condition_variable.c |  3 +-
src/include/storage/proclist.h                | 55 ++++++++++++++++-----------
src/include/storage/proclist_types.h          | 12 ++++--
3 files changed, 43 insertions(+), 27 deletions(-)


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Buildfarm status monitoring (was Re: pgsql: Implement channelbinding tls-server-end-point for SCRAM)
Следующее
От: Bruce Momjian
Дата:
Сообщение: pgsql: pg_upgrade: prevent check on live cluster from generating error