Re: [HACKERS] Optional message to user when terminating/cancelling backend

2019-02-03 Thread Michael Paquier
On Fri, Nov 30, 2018 at 06:02:15PM +0100, Dmitry Dolgov wrote: > Just for the records, cfbot complains during the compilation: > > option.c: In function ‘parseCommandLine’: > option.c:265:8: error: ignoring return value of ‘getcwd’, declared > with attribute warn_unused_result

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-11-30 Thread Dmitry Dolgov
On Mon, Nov 12, 2018 at 8:36 PM Tom Lane wrote: > > Daniel Gustafsson writes: > > I’ve split the patch into two logical parts, the signalling functionality > > and > > the userfacing terminate/cancel part. For extra clarity I’ve also included > > the > > full v19 patch, in case you prefer

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-11-12 Thread Tom Lane
Daniel Gustafsson writes: > I’ve split the patch into two logical parts, the signalling functionality and > the userfacing terminate/cancel part. For extra clarity I’ve also included > the > full v19 patch, in case you prefer that instead when seeing the two. I'm a bit befuddled by this patch,

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-30 Thread Daniel Gustafsson
> On 11 Oct 2018, at 03:29, Michael Paquier wrote: Hi!, Thanks for reviewing this patch, and sorry for having been slow lately. > On Wed, Oct 10, 2018 at 02:20:53PM +0200, Daniel Gustafsson wrote: >>> On 9 Oct 2018, at 07:38, Michael Paquier wrote: >>> In order to make a test with non-ASCII

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-10 Thread Michael Paquier
On Wed, Oct 10, 2018 at 02:20:53PM +0200, Daniel Gustafsson wrote: >> On 9 Oct 2018, at 07:38, Michael Paquier wrote: >> In order to make a test with non-ASCII characters in the error message, >> we could use a trick similar to xml.sql: use a function which ignores >> the test case if

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-10 Thread Daniel Gustafsson
> On 9 Oct 2018, at 07:38, Michael Paquier wrote: > > On Fri, Oct 05, 2018 at 10:11:45AM +0200, Daniel Gustafsson wrote: >> Thanks! Attached is a v17 which rebases the former 0002 patch on top of >> current master, along with the test fix for Windows that Thomas reported >> upthread (no other

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-08 Thread Michael Paquier
On Fri, Oct 05, 2018 at 10:11:45AM +0200, Daniel Gustafsson wrote: > Thanks! Attached is a v17 which rebases the former 0002 patch on top of > current master, along with the test fix for Windows that Thomas reported > upthread (no other changes introduced over earlier versions). Thanks for the

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-05 Thread Daniel Gustafsson
> On 4 Oct 2018, at 13:00, Michael Paquier wrote: > > On Thu, Oct 04, 2018 at 10:06:06AM +0200, Daniel Gustafsson wrote: >> Yes, you are correct, the signalfuncs.h includes in 0001 are a rebase error >> from when I renamed the file. They are not present in the v15 patch but got >> introduced in

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-04 Thread Michael Paquier
On Thu, Oct 04, 2018 at 10:06:06AM +0200, Daniel Gustafsson wrote: > Yes, you are correct, the signalfuncs.h includes in 0001 are a rebase error > from when I renamed the file. They are not present in the v15 patch but got > introduced in v16 when I clearly wasn’t caffeinated enough to rebase.

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-04 Thread Daniel Gustafsson
> On 4 Oct 2018, at 09:59, Michael Paquier wrote: > > On Wed, Oct 03, 2018 at 12:09:54PM +1300, Thomas Munro wrote: >> It looks like you missed another case that needs tolerance for late >> signal delivery on Windows: >> >> +select pg_cancel_backend(pg_backend_pid()); >> >>

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-04 Thread Michael Paquier
On Wed, Oct 03, 2018 at 12:09:54PM +1300, Thomas Munro wrote: > It looks like you missed another case that needs tolerance for late > signal delivery on Windows: > > +select pg_cancel_backend(pg_backend_pid()); > > https://ci.appveyor.com/project/postgresql-cfbot/postgresql/build/1.0.15263

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-02 Thread Thomas Munro
On Tue, Oct 2, 2018 at 1:37 AM Daniel Gustafsson wrote: > > On 1 Oct 2018, at 01:19, Michael Paquier wrote: > > On Sun, Sep 30, 2018 at 10:51:44PM +0900, Michael Paquier wrote: > >> You could have chosen something less complicated, like "ホゲ", which is > >> the equivalent of "foo" in English.

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-01 Thread Michael Paquier
On Mon, Oct 01, 2018 at 02:37:42PM +0200, Daniel Gustafsson wrote: >> On 1 Oct 2018, at 01:19, Michael Paquier wrote: >> Looking at the refactoring patch 0001, wouldn't signalfuncs.c make a >> better name for the new file? There are already multiple examples of >> this type, like logicalfuncs.c,

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-10-01 Thread Daniel Gustafsson
> On 1 Oct 2018, at 01:19, Michael Paquier wrote: > > On Sun, Sep 30, 2018 at 10:51:44PM +0900, Michael Paquier wrote: >> You could have chosen something less complicated, like "ホゲ", which is >> the equivalent of "foo" in English. Anyway, non-ASCII characters should >> not be included in the

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-09-30 Thread Michael Paquier
On Sun, Sep 30, 2018 at 10:51:44PM +0900, Michael Paquier wrote: > You could have chosen something less complicated, like "ホゲ", which is > the equivalent of "foo" in English. Anyway, non-ASCII characters should > not be included in the final patch. Looking at the refactoring patch 0001, wouldn't

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-09-30 Thread Michael Paquier
On Mon, Aug 27, 2018 at 12:06:18PM +0200, Daniel Gustafsson wrote: > I like that idea, so I’ve updated the patch to see what the cfbot > thinks of it. + when pg_cancel_backend(pg_backend_pid(), 'ソケットをブロッキングモードに設定できませんでした') You could have chosen something less complicated, like "ホゲ", which is

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-27 Thread Daniel Gustafsson
> On 23 Aug 2018, at 20:53, Tom Lane wrote: > I think this is just a timing problem: the signal gets sent, > but it might or might not get received before the current statement ends. > It's possible that a signal-sent-to-self can be expected to be received > synchronously on all Unix platforms,

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-27 Thread Daniel Gustafsson
> On 24 Aug 2018, at 03:37, Tom Lane wrote: > > Thomas Munro writes: >> On Fri, Aug 24, 2018 at 6:53 AM, Tom Lane wrote: >>> I think this is just a timing problem: the signal gets sent, >>> but it might or might not get received before the current statement ends. > >> How about we just wait

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-23 Thread Tom Lane
Thomas Munro writes: > On Fri, Aug 24, 2018 at 6:53 AM, Tom Lane wrote: >> I think this is just a timing problem: the signal gets sent, >> but it might or might not get received before the current statement ends. > How about we just wait forever if the function manages to return? > select case

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-23 Thread Thomas Munro
On Fri, Aug 24, 2018 at 6:53 AM, Tom Lane wrote: > Thomas Munro writes: >> On Wed, Jul 25, 2018 at 7:27 PM, Daniel Gustafsson wrote: >>> Seems the build of the updated patch built and tested Ok. Still have no >>> idea >>> why the previous one didn’t. > >> That problem apparently didn't go

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-23 Thread Tom Lane
Thomas Munro writes: > On Wed, Jul 25, 2018 at 7:27 PM, Daniel Gustafsson wrote: >> Seems the build of the updated patch built and tested Ok. Still have no idea >> why the previous one didn’t. > That problem apparently didn't go away. cfbot tested it 7 times in > the past week, and it passed

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-20 Thread Thomas Munro
On Wed, Jul 25, 2018 at 7:27 PM, Daniel Gustafsson wrote: >> On 24 Jul 2018, at 22:57, Daniel Gustafsson wrote: >> >>> On 6 Jul 2018, at 02:18, Thomas Munro wrote: >>> >>> On Fri, Jun 15, 2018 at 9:56 AM, Daniel Gustafsson wrote: attached >>> >>> Hi Daniel, >>> >>> 6118 --select

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-12 Thread Daniel Gustafsson
> On 12 Aug 2018, at 11:01, Andres Freund wrote: > > On August 12, 2018 12:17:59 AM GMT+02:00, Daniel Gustafsson > wrote: >>> On 6 Aug 2018, at 09:47, Heikki Linnakangas wrote: >>> >>> Has there been any consideration to encodings? >> >> Thats a good point, no =/ >> >>> What happens if the

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-12 Thread Andres Freund
On August 12, 2018 12:17:59 AM GMT+02:00, Daniel Gustafsson wrote: >> On 6 Aug 2018, at 09:47, Heikki Linnakangas wrote: >> >> Has there been any consideration to encodings? > >Thats a good point, no =/ > >> What happens if the message contains non-ASCII characters, and the >sending backend

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-12 Thread Pavel Stehule
2018-08-12 10:29 GMT+02:00 Daniel Gustafsson : > > On 12 Aug 2018, at 07:42, Pavel Stehule wrote: > > 2018-08-12 0:17 GMT+02:00 Daniel Gustafsson dan...@yesql.se>>: > > > On 6 Aug 2018, at 09:47, Heikki Linnakangas hlinn...@iki.fi>> wrote: > > > > What happens if the message contains non-ASCII

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-12 Thread Daniel Gustafsson
> On 12 Aug 2018, at 07:42, Pavel Stehule wrote: > 2018-08-12 0:17 GMT+02:00 Daniel Gustafsson >: > > On 6 Aug 2018, at 09:47, Heikki Linnakangas > > wrote: > > What happens if the message contains non-ASCII characters, and the sending > >

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-11 Thread Pavel Stehule
2018-08-12 0:17 GMT+02:00 Daniel Gustafsson : > > On 6 Aug 2018, at 09:47, Heikki Linnakangas wrote: > > > > Has there been any consideration to encodings? > > Thats a good point, no =/ > > > What happens if the message contains non-ASCII characters, and the > sending backend is connected to

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-11 Thread Daniel Gustafsson
> On 6 Aug 2018, at 09:47, Heikki Linnakangas wrote: > > Has there been any consideration to encodings? Thats a good point, no =/ > What happens if the message contains non-ASCII characters, and the sending > backend is connected to database that uses a different encoding than the > backend

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-08-06 Thread Heikki Linnakangas
Has there been any consideration to encodings? What happens if the message contains non-ASCII characters, and the sending backend is connected to database that uses a different encoding than the backend being signaled? - Heikki

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-07-25 Thread Daniel Gustafsson
> On 24 Jul 2018, at 22:57, Daniel Gustafsson wrote: > >> On 6 Jul 2018, at 02:18, Thomas Munro wrote: >> >> On Fri, Jun 15, 2018 at 9:56 AM, Daniel Gustafsson wrote: >>> attached >> >> Hi Daniel, >> >> 6118 --select pg_cancel_backend(pg_backend_pid(), 'it brings on many >> changes'); >>

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-07-24 Thread Daniel Gustafsson
> On 6 Jul 2018, at 02:18, Thomas Munro wrote: > > On Fri, Jun 15, 2018 at 9:56 AM, Daniel Gustafsson wrote: >> attached > > Hi Daniel, > > 6118 --select pg_cancel_backend(pg_backend_pid(), 'it brings on many > changes'); > 6119 select pg_cancel_backend(pg_backend_pid(), NULL); > 6120!

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-07-24 Thread Daniel Gustafsson
> On 6 Jul 2018, at 03:47, Michael Paquier wrote: > > On Fri, Jul 06, 2018 at 12:18:02PM +1200, Thomas Munro wrote: >> 6118 --select pg_cancel_backend(pg_backend_pid(), 'it brings on many >> changes'); >> 6119 select pg_cancel_backend(pg_backend_pid(), NULL); >> 6120! ERROR: canceling

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-07-24 Thread Daniel Gustafsson
> On 6 Jul 2018, at 14:12, Pavel Stehule wrote: > I am testing last patch and looks so truncating message and appending "..." > doesn't work. Thanks for testing, and sorry about the late response. > The slot->len hold trimmed length, not original length. Fixed in the attached rebased

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-07-06 Thread Pavel Stehule
Hi I am testing last patch and looks so truncating message and appending "..." doesn't work. The slot->len hold trimmed length, not original length. Regards Pavel

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-07-05 Thread Michael Paquier
On Fri, Jul 06, 2018 at 12:18:02PM +1200, Thomas Munro wrote: > 6118 --select pg_cancel_backend(pg_backend_pid(), 'it brings on many > changes'); > 6119 select pg_cancel_backend(pg_backend_pid(), NULL); > 6120! ERROR: canceling statement due to user request > 6121--- 25,32 > 6122 > 6123

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-07-05 Thread Thomas Munro
On Fri, Jun 15, 2018 at 9:56 AM, Daniel Gustafsson wrote: > attached Hi Daniel, 6118 --select pg_cancel_backend(pg_backend_pid(), 'it brings on many changes'); 6119 select pg_cancel_backend(pg_backend_pid(), NULL); 6120! ERROR: canceling statement due to user request 6121--- 25,32 6122

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-06-14 Thread Daniel Gustafsson
> On 13 Jun 2018, at 21:16, Andres Freund wrote: Thanks for the review! > I'm not sure I really like the appending bit. There's a security > argument to be made about doing so, but from a user POV that mostly > seems restrictive. I wonder if that aspect would be better handled by > adding an

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-06-13 Thread Andres Freund
Hi, Onder, I CCed you because it seems worthwhile to ensure that the relevant Citus code could use this instead of the gross hack you and I committed... On 2018-06-13 20:54:03 +0200, Daniel Gustafsson wrote: > > On 9 Apr 2018, at 23:55, Andres Freund wrote: > > On 2017-06-20 13:01:35 -0700,

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-06-13 Thread Daniel Gustafsson
> On 9 Apr 2018, at 23:55, Andres Freund wrote: > On 2017-06-20 13:01:35 -0700, Andres Freund wrote: >> For extensions it'd also be useful if it'd be possible to overwrite the >> error code. E.g. for citus there's a distributed deadlock detector, >> running out of process because there's no way

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-04-09 Thread Andres Freund
Hi, On 2017-06-20 13:01:35 -0700, Andres Freund wrote: > For extensions it'd also be useful if it'd be possible to overwrite the > error code. E.g. for citus there's a distributed deadlock detector, > running out of process because there's no way to interrupt lock waits > locally, and we've to

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-04-09 Thread Daniel Gustafsson
> On 09 Apr 2018, at 02:47, Michael Paquier wrote: > > On Fri, Apr 06, 2018 at 11:18:34AM +0200, Daniel Gustafsson wrote: >> Yep, I completely agree. Attached are patches with the quotes removed and >> rebased since Oids were taken etc. > > I still find this idea

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-04-08 Thread Michael Paquier
On Fri, Apr 06, 2018 at 11:18:34AM +0200, Daniel Gustafsson wrote: > Yep, I completely agree. Attached are patches with the quotes removed and > rebased since Oids were taken etc. I still find this idea interesting for plugin authors. However, as feature freeze for v11 is in effect, I am

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-04-06 Thread Daniel Gustafsson
> On 06 Apr 2018, at 04:49, Michael Paquier wrote: > > On Thu, Apr 05, 2018 at 11:33:57PM +0200, Daniel Gustafsson wrote: >> It seemed like a good idea at the time to indicate which part was submitted >> by >> the user, but looking at it now the colon sign is a pretty clear

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-04-05 Thread Michael Paquier
On Thu, Apr 05, 2018 at 11:33:57PM +0200, Daniel Gustafsson wrote: > It seemed like a good idea at the time to indicate which part was submitted by > the user, but looking at it now the colon sign is a pretty clear indicator > already. Dropping the quotes is more consistent with other error

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-04-05 Thread Daniel Gustafsson
> On 05 Apr 2018, at 23:16, Peter Eisentraut > wrote: > > The documentation change suggests the error will be > > ERROR: canceling statement due to user request: "Cancellation message text" > > Why the quotes? It seemed like a good idea at the time to

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-04-05 Thread Peter Eisentraut
The documentation change suggests the error will be ERROR: canceling statement due to user request: "Cancellation message text" Why the quotes? -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-03-27 Thread Eren Başak
Hi, I have reviewed the v8 patches. I can confirm that the patches apply and pass the tests as of 03/27/2018 11:00am (UTC). I didn't test whether the docs compile but they look good. I have briefly tested the patch again and can confirm that the patch does what is intended. The v8 patches

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-03-20 Thread Daniel Gustafsson
> On 20 Mar 2018, at 12:12, Eren Başak wrote: > I reviewed the patch. Here are my notes: Thanks! > The patch does not add new tests (maybe isolation tests) for the new feature. > Are there any opportunities to have tests for confirming the new behavior? Good point, not

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-03-20 Thread Christoph Berg
Re: Eren Başak 2018-03-20 > Another thing is that, in a similar manner, we could allow changing the > error code which might be useful for extensions. For example, Citus could > use it to cancel remote backends when it detects a

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-03-20 Thread Eren Başak
Hi, I reviewed the patch. Here are my notes: I can confirm that the patches apply and pass the tests as of 03/19/2018 @ 11:00am (UTC). I didn't test whether the docs compile or look good. I have briefly tested and can confirm that the patch does what is intended. Here are my comments about the

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-03-05 Thread Daniel Gustafsson
> On 26 Jan 2018, at 00:05, Daniel Gustafsson wrote: > >> On 24 Jan 2018, at 16:45, Alvaro Herrera wrote: >> Maybe have two patches, 0001 creates the files moving the contents over, >> then 0002 adds your new stuff on top. > > The two attached patches

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-01-25 Thread Daniel Gustafsson
> On 24 Jan 2018, at 16:45, Alvaro Herrera wrote: > > A quick suggestion from a passer-by -- would you put the new code in > src/backend/storage/ipc/backend_signal.c instead? Sounds like a better > place than utils/misc/; and "signal" is more general in nature than just

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-01-24 Thread Michael Paquier
On Wed, Jan 24, 2018 at 12:45:48PM -0300, Alvaro Herrera wrote: > /me wonders if there's anything that would suggest to make this > extensive to processes other than backends ... That's a good thought. Now ProcessInterrupts() is not used by non-backend processes. For example the WAL receiver has

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2018-01-24 Thread Daniel Gustafsson
> On 28 Sep 2017, at 14:55, Yugo Nagata wrote: > > On Sun, 3 Sep 2017 22:47:10 +0200 > Daniel Gustafsson wrote: > > I have reviewed your latest patch. Thanks! > I can apply this to the master branch and build this successfully, > and the behavior is as