Re: fe-utils - share query cancellation code

2019-12-03 Thread Michael Paquier
On Tue, Dec 03, 2019 at 01:11:27PM +0100, Fabien COELHO wrote: > Looks fine to me: patch applies, compiles, runs. Thanks for double-checking. Done. -- Michael signature.asc Description: PGP signature

Re: fe-utils - share query cancellation code

2019-12-03 Thread Fabien COELHO
Bonjour Michaël, Committed the patch after splitting things into two commits and after testing things from Linux and from a Windows console: the actual refactoring and the pgbench changes. I have found that we have a useless declaration of CancelRequested in common.h, which is already part

Re: fe-utils - share query cancellation code

2019-12-03 Thread Michael Paquier
On Mon, Dec 02, 2019 at 11:54:02AM +0900, Michael Paquier wrote: > Committed the patch after splitting things into two commits and after > testing things from Linux and from a Windows console: the actual > refactoring and the pgbench changes. I have found that we have a useless declaration of

Re: fe-utils - share query cancellation code

2019-12-01 Thread Michael Paquier
On Fri, Nov 29, 2019 at 08:44:25AM +0100, Fabien COELHO wrote: > I do not have a Windows host, so I can only do blind tests. I just moved the > declaration out of !WIN32 scope in attached v7, which might solve the > resolution error. All other issues pointed out above seem fixed in the v6 > you

Re: fe-utils - share query cancellation code

2019-11-28 Thread Fabien COELHO
Bonjour Michaël, The query cancellation added to pgbench is different than the actual refactoring, and it is a result of the refactoring, so I would rather split that into two different commits for clarity. The split is easy enough, so that's fine not to send two different patches. Yep,

Re: fe-utils - share query cancellation code

2019-11-27 Thread Michael Paquier
On Wed, Nov 06, 2019 at 10:41:39AM +0100, Fabien COELHO wrote: > Indeed, I put it on the wrong side of a "#ifndef WIN32". > > Basically it is a false constant under WIN32, which it seems does not have > sigint handler, but the code checks whether the non existent handler is > enabled anyway. > >

Re: fe-utils - share query cancellation code

2019-11-06 Thread Fabien COELHO
It looks like don't define sigint_interrupt_jmp and sigint_interrupt_enabled on Windows, yet they are still declared and referenced? Indeed, I put it on the wrong side of a "#ifndef WIN32". Basically it is a false constant under WIN32, which it seems does not have sigint handler, but the

Re: fe-utils - share query cancellation code

2019-11-03 Thread Thomas Munro
On Sat, Nov 2, 2019 at 10:38 AM Fabien COELHO wrote: > Attached patch v4 does it. Hi Fabien, It looks like don't define sigint_interrupt_jmp and sigint_interrupt_enabled on Windows, yet they are still declared and referenced? command.obj : error LNK2001: unresolved external symbol

Re: fe-utils - share query cancellation code

2019-11-01 Thread Fabien COELHO
Then you need to add #include libpq-fe.h in cancel.h. Our policy is that headers compile standalone (c.h / postgres_fe.h / postgres.h excluded). Ok. I do not make a habit of adding headers in postgres, so I did not notice there was an alphabetical logic to that. Attached patch v4 does it.

Re: fe-utils - share query cancellation code

2019-11-01 Thread Alvaro Herrera
On 2019-Nov-01, Fabien COELHO wrote: > Because "cancel.h" requires PGconn declaration, thus must appear after > "libpq-fe.h", Then you need to add #include libpq-fe.h in cancel.h. Our policy is that headers compile standalone (c.h / postgres_fe.h / postgres.h excluded). -- Álvaro Herrera

Re: fe-utils - share query cancellation code

2019-11-01 Thread Fabien COELHO
I understand that you are unhappy about something, but where the issue is fails me, the "wtf" 3 characters are not enough to point me in the right direction. Feel free to elaborate a little bit more:-) I don't see why you move the "conditional.h" line out of its correct alphabetical position

Re: fe-utils - share query cancellation code

2019-11-01 Thread Alvaro Herrera
On 2019-Nov-01, Fabien COELHO wrote: > > > #include "common/int.h" > > > #include "common/logging.h" > > > -#include "fe_utils/conditional.h" > > > #include "getopt_long.h" > > > #include "libpq-fe.h" > > > +#include "fe_utils/conditional.h" > > > +#include "fe_utils/cancel.h" > > > #include

Re: fe-utils - share query cancellation code

2019-11-01 Thread Fabien COELHO
Hello Alvaro, #include "common/int.h" #include "common/logging.h" -#include "fe_utils/conditional.h" #include "getopt_long.h" #include "libpq-fe.h" +#include "fe_utils/conditional.h" +#include "fe_utils/cancel.h" #include "pgbench.h" #include "portability/instr_time.h" wtf? I

Re: fe-utils - share query cancellation code

2019-11-01 Thread Alvaro Herrera
On 2019-Nov-01, Fabien COELHO wrote: > diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c > index 03bcd22996..389b4d7bcd 100644 > --- a/src/bin/pgbench/pgbench.c > +++ b/src/bin/pgbench/pgbench.c > @@ -59,9 +59,10 @@ > > #include "common/int.h" > #include "common/logging.h" >

Re: fe-utils - share query cancellation code

2019-11-01 Thread Fabien COELHO
Hello, I give a quick look and I think we can void psql_setup_cancel_handler(void) { setup_cancel_handler(psql_sigint_callback); } Because it does not matter for setup_cancel_handler what we passed because it is ignoring that in case of windows. The "psql_sigint_callback" function

Re: fe-utils - share query cancellation code

2019-10-31 Thread Ibrar Ahmed
On Thu, Oct 31, 2019 at 11:43 PM Fabien COELHO wrote: > > Hello Devs, > > This patch moves duplicated query cancellation code code from psql & > scripts to fe-utils, so that it is shared and may be used by other > commands. > > This is because Masao-san suggested to add a query cancellation

fe-utils - share query cancellation code

2019-10-31 Thread Fabien COELHO
Hello Devs, This patch moves duplicated query cancellation code code from psql & scripts to fe-utils, so that it is shared and may be used by other commands. This is because Masao-san suggested to add a query cancellation feature to pgbench for long queries (server-side data generation