Make pgbench exit on SIGINT more reliably

Поиск
Список
Период
Сортировка
От Tristan Partin
Тема Make pgbench exit on SIGINT more reliably
Дата
Msg-id CSSWBAX56CVY.291H6ZNNHK7EO@c3po
обсуждение исходный текст
Ответы Re: Make pgbench exit on SIGINT more reliably
Re: Make pgbench exit on SIGINT more reliably
Список pgsql-hackers
Hello,

The way that pgbench handled SIGINT changed in
1d468b9ad81b9139b4a0b16b416c3597925af4b0. Unfortunately this had a
couple of unintended consequences, at least from what I can tell[1].

- CTRL-C no longer stops the program unless the right point in pgbench
  execution is hit
- pgbench no longer exits with a non-zero exit code

An easy reproduction of these problems is to run with a large scale
factor like: pgbench -i -s 500000. Then try to CTRL-C the program.

The attached set of patches fixes this problem by allowing callers of
setup_cancel_handler() to attach a post-PQcancel callback. In this case,
we just call _exit(2). In addition, I noticed that psql had an EXIT_USER
constant, so I moved the common exit codes from src/bin/psql/settings.h
to src/include/fe_utils/exit_codes.h and made pgbench exit with
EXIT_USER.

[1]: https://www.postgresql.org/message-id/alpine.DEB.2.21.1910311939430.27369@lancre
--
Tristan Partin
Neon (https://neon.tech)

Вложения

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