From: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
---|---|
To: | Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> |
Cc: | Kirk Wolak <wolakk(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pgbnech: allow to cancel queries during benchmark |
Date: | 2023-07-03 12:11:36 |
Message-ID: | 1c3c36ec-c8c7-4acb-8937-51b32166af13@mines-paristech.fr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello Yugo-san,
>>> In thread #0, setup_cancel_handler is called before the loop, the
>>> CancelRequested flag is set when Ctrl+C is issued. In the loop, cancel
>>> requests are sent when the flag is set only in thread #0. SIGINT is
>>> blocked in other threads, but the threads will exit after their query
>>> are cancelled. If thread safety is disabled or OS is Windows, the signal
>>> is not blocked because pthread_sigmask cannot be used.
>>> (I didn't test the patch on WIndows yet, though.)
>>>
>>> I choose the design that the signal handler and the query cancel are
>>> performed only in thread #0 because I wanted to make the behavior as
>>> predicable as possible. However, another design that all thread can
>>> received SIGINT and that the first thread that catches the signal is
>>> responsible to sent cancel requests for all connections may also work.
>>>
>>> Also, the array of CState that contains all clients state is changed to
>>> a global variable so that all connections can be accessed within a thread.
> As a side note, actually I thought another design to create a special thread
> for handling query cancelling in which SIGINT would be catched by sigwait,
> I quit the idea because it would add complexity due to code for Windows and
> --disabled-thread-safe.
I agree that the simpler the better.
> I would appreciate it if you could kindly review and test the patch!
I'll try to have a look at it.
--
Fabien.
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2023-07-03 12:22:04 | Re: [PGdocs] fix description for handling pf non-ASCII characters |
Previous Message | jian he | 2023-07-03 11:52:23 | Re: Cleaning up array_in() |