Re: pgbnech: allow to cancel queries during benchmark
Yugo Nagata <nagata@sraoss.co.jp>
From: Yugo NAGATA <nagata@sraoss.co.jp>
To: Yugo NAGATA <nagata@sraoss.co.jp>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>, PostgreSQL Developers
<pgsql-hackers@lists.postgresql.org>
Date: 2023-09-19T08:30:11Z
Lists: pgsql-hackers
Attachments
On Wed, 6 Sep 2023 20:13:34 +0900 Yugo NAGATA <nagata@sraoss.co.jp> wrote: > I attached the updated patch v3. The changes since the previous > patch includes the following; > > I removed the unnecessary condition (&& false) that you > pointed out in [1]. > > The test was rewritten by using IPC::Run signal() and integrated > to "001_pgbench_with_server.pl". This test is skipped on Windows > because SIGINT causes to terminate the test itself as discussed > in [2] about query cancellation test in psql. > > I added some comments to describe how query cancellation is > handled as I explained in [1]. > > Also, I found the previous patch didn't work on Windows so fixed it. > On non-Windows system, a thread waiting a response of long query can > be interrupted by SIGINT, but on Windows, threads do not return from > waiting until queries they are running are cancelled. This is because, > when the signal is received, the system just creates a new thread to > execute the callback function specified by setup_cancel_handler, and > other thread continue to run[3]. Therefore, the queries have to be > cancelled in the callback function. > > [1] https://www.postgresql.org/message-id/a58388ac-5411-4760-ea46-71324d8324cb%40mines-paristech.fr > [2] https://www.postgresql.org/message-id/20230906004524.2fd6ee049f8a6c6f2690b99c%40sraoss.co.jp > [3] https://learn.microsoft.com/en-us/windows/console/handlerroutine I found that --disable-thread-safety option was removed in 68a4b58eca0329. So, I removed codes involving ENABLE_THREAD_SAFETY from the patch. Also, I wrote a commit log draft. Attached is the updated version, v4. Regards, Yugo Nagata -- Yugo NAGATA <nagata@sraoss.co.jp>
Commits
-
libpq: Add encrypted and non-blocking query cancellation routines
- 61461a300c1c 17.0 cited