pgsql: Introduce timeout handling framework

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема pgsql: Introduce timeout handling framework
Дата
Msg-id E1Sqz0k-0000iI-Hl@gemulon.postgresql.org
обсуждение исходный текст
Ответы Re: pgsql: Introduce timeout handling framework
Список pgsql-committers
Introduce timeout handling framework

Management of timeouts was getting a little cumbersome; what we
originally had was more than enough back when we were only concerned
about deadlocks and query cancel; however, when we added timeouts for
standby processes, the code got considerably messier.  Since there are
plans to add more complex timeouts, this seems a good time to introduce
a central timeout handling module.

External modules register their timeout handlers during process
initialization, and later enable and disable them as they see fit using
a simple API; timeout.c is in charge of keeping track of which timeouts
are in effect at any time, installing a common SIGALRM signal handler,
and calling setitimer() as appropriate to ensure timely firing of
external handlers.

timeout.c additionally supports pluggable modules to add their own
timeouts, though this capability isn't exercised anywhere yet.

Additionally, as of this commit, walsender processes are aware of
timeouts; we had a preexisting bug there that made those ignore SIGALRM,
thus being subject to unhandled deadlocks, particularly during the
authentication phase.  This has already been fixed in back branches in
commit 0bf8eb2a, which see for more details.

Main author: Zoltán Böszörményi
Some review and cleanup by Álvaro Herrera
Extensive reworking by Tom Lane

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/f34c68f09671c4566854c7e20e9253d4f335c0b0

Modified Files
--------------
src/backend/postmaster/autovacuum.c |    9 +-
src/backend/postmaster/postmaster.c |   36 ++-
src/backend/postmaster/startup.c    |   22 +-
src/backend/replication/walsender.c |    3 +-
src/backend/storage/ipc/standby.c   |   80 ++++--
src/backend/storage/lmgr/proc.c     |  435 +-------------------------------
src/backend/tcop/postgres.c         |   15 +-
src/backend/utils/init/postinit.c   |   33 ++-
src/backend/utils/misc/Makefile     |    4 +-
src/backend/utils/misc/timeout.c    |  479 +++++++++++++++++++++++++++++++++++
src/include/storage/proc.h          |   13 +-
src/include/storage/standby.h       |    3 +-
src/include/utils/timeout.h         |   54 ++++
13 files changed, 688 insertions(+), 498 deletions(-)


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Remove unreachable code
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: pgsql: Introduce timeout handling framework