Re: pgbnech: allow to cancel queries during benchmark

2024-03-31 Thread Yugo NAGATA
On Sat, 30 Mar 2024 14:35:37 +0100 Alvaro Herrera wrote: > Due to commit 61461a300c1c, this patch needs to be reworked. Thank you for pointing out this. Although cfbot doesn't report any failure, but PQcancel is now deprecated and insecure. I'll consider it too while fixing a problem I found in

Re: pgbnech: allow to cancel queries during benchmark

2024-03-30 Thread Alvaro Herrera
Due to commit 61461a300c1c, this patch needs to be reworked. -- Álvaro HerreraBreisgau, Deutschland — https://www.EnterpriseDB.com/ "La fuerza no está en los medios físicos sino que reside en una voluntad indomable" (Gandhi)

Re: pgbnech: allow to cancel queries during benchmark

2024-02-06 Thread Yugo NAGATA
On Wed, 24 Jan 2024 22:17:44 +0900 Yugo NAGATA wrote: > Attached is the updated patch, v6. Currently, on non-Windows, SIGINT is received only by thread #0. CancelRequested is checked during the loop in the thread, and queries are cancelled if it is set. However, once thread #0 exits the loop d

Re: pgbnech: allow to cancel queries during benchmark

2024-01-24 Thread Yugo NAGATA
On Fri, 19 Jan 2024 17:46:03 +0900 (JST) Tatsuo Ishii wrote: > >> +/* send cancel requests to all connections */ > >> +static void > >> +cancel_all() > >> +{ > >> + for (int i = 0; i < nclients; i++) > >> + { > >> + char errbuf[1]; > >> + if (client_states[i].cancel != NULL) >

Re: pgbnech: allow to cancel queries during benchmark

2024-01-19 Thread Tatsuo Ishii
>> +/* send cancel requests to all connections */ >> +static void >> +cancel_all() >> +{ >> +for (int i = 0; i < nclients; i++) >> +{ >> +char errbuf[1]; >> +if (client_states[i].cancel != NULL) >> +(void) PQcancel(client_states[i].cancel, errbuf,

Re: pgbnech: allow to cancel queries during benchmark

2024-01-18 Thread Yugo NAGATA
On Mon, 15 Jan 2024 16:49:44 +0900 (JST) Tatsuo Ishii wrote: > > On Wed, 6 Sep 2023 20:13:34 +0900 > > Yugo NAGATA wrote: > > > >> I attached the updated patch v3. The changes since the previous > >> patch includes the following; > >> > >> I removed the unnecessary condition (&& false) that y

Re: pgbnech: allow to cancel queries during benchmark

2024-01-14 Thread Tatsuo Ishii
> On Wed, 6 Sep 2023 20:13:34 +0900 > Yugo NAGATA 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 sig

Re: pgbnech: allow to cancel queries during benchmark

2023-09-19 Thread Yugo NAGATA
On Wed, 6 Sep 2023 20:13:34 +0900 Yugo NAGATA 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 int

Re: pgbnech: allow to cancel queries during benchmark

2023-09-06 Thread Yugo NAGATA
Hi Fabien, On Thu, 10 Aug 2023 12:32:44 +0900 Yugo NAGATA wrote: > On Wed, 9 Aug 2023 11:18:43 +0200 (CEST) > Fabien COELHO wrote: > > > > > I forgot, about the test: > > > > I think that it should be integrated in the existing > > "001_pgbench_with_server.pl" script, because a TAP script i

Re: pgbnech: allow to cancel queries during benchmark

2023-08-09 Thread Yugo NAGATA
On Wed, 9 Aug 2023 11:18:43 +0200 (CEST) Fabien COELHO wrote: > > I forgot, about the test: > > I think that it should be integrated in the existing > "001_pgbench_with_server.pl" script, because a TAP script is pretty > expensive as it creates a cluster, starts it… before running the test.

Re: pgbnech: allow to cancel queries during benchmark

2023-08-09 Thread Yugo NAGATA
Hello Fabien, On Wed, 9 Aug 2023 11:06:24 +0200 (CEST) Fabien COELHO wrote: > > Hello Yugo-san, > > Some feedback about v2. > > There is some dead code (&& false) which should be removed. I forgot to remove the debug code. I'll remove it. > >>> In multi-threads, only one thread can catches

Re: pgbnech: allow to cancel queries during benchmark

2023-08-09 Thread Fabien COELHO
Hello Yugo-san, Some feedback about v2. There is some dead code (&& false) which should be removed. Maybe it should check that cancel is not NULL before calling PQcancel? I think this is already checked as below, but am I missing something? + if (all_state[i].cancel != NULL) +

Re: pgbnech: allow to cancel queries during benchmark

2023-08-02 Thread Yugo NAGATA
On Wed, 2 Aug 2023 16:37:53 +0900 Yugo NAGATA wrote: > Hello Fabien, > > On Fri, 14 Jul 2023 20:32:01 +0900 > Yugo NAGATA wrote: > > I attached the updated patch. I'm sorry. I forgot to attach the patch. Regards, Yugo Nagata > > > Hello Fabien, > > > > Thank you for your review! > > > >

Re: pgbnech: allow to cancel queries during benchmark

2023-08-02 Thread Yugo NAGATA
Hello Fabien, On Fri, 14 Jul 2023 20:32:01 +0900 Yugo NAGATA wrote: I attached the updated patch. > Hello Fabien, > > Thank you for your review! > > On Mon, 3 Jul 2023 20:39:23 +0200 (CEST) > Fabien COELHO wrote: > > > > > Yugo-san, > > > > Some feedback about v1 of this patch. > > > > P

Re: pgbnech: allow to cancel queries during benchmark

2023-07-14 Thread Yugo NAGATA
Hello Fabien, Thank you for your review! On Mon, 3 Jul 2023 20:39:23 +0200 (CEST) Fabien COELHO wrote: > > Yugo-san, > > Some feedback about v1 of this patch. > > Patch applies cleanly, compiles. > > There are no tests, could there be one? ISTM that one could be done with a > "SELECT pg_sl

Re: pgbnech: allow to cancel queries during benchmark

2023-07-03 Thread Fabien COELHO
Yugo-san, Some feedback about v1 of this patch. Patch applies cleanly, compiles. There are no tests, could there be one? ISTM that one could be done with a "SELECT pg_sleep(...)" script?? The global name "all_state" is quite ambiguous, what about "client_states" instead? Or maybe it could

Re: pgbnech: allow to cancel queries during benchmark

2023-07-03 Thread Fabien COELHO
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

Re: pgbnech: allow to cancel queries during benchmark

2023-06-27 Thread Yugo NAGATA
On Mon, 26 Jun 2023 12:59:21 -0400 Kirk Wolak wrote: > On Mon, Jun 26, 2023 at 9:46 AM Yugo NAGATA wrote: > > > Hello, > > > > This attached patch enables pgbench to cancel queries during benchmark. > > > > Formerly, Ctrl+C during benchmark killed pgbench immediately, but backend > > processes

Re: pgbnech: allow to cancel queries during benchmark

2023-06-26 Thread Kirk Wolak
On Mon, Jun 26, 2023 at 9:46 AM Yugo NAGATA wrote: > Hello, > > This attached patch enables pgbench to cancel queries during benchmark. > > Formerly, Ctrl+C during benchmark killed pgbench immediately, but backend > processes executing long queries remained for a while. You can simply > reproduce