Re: non-exclusive backup cleanup is mildly broken

2019-12-19 Thread Robert Haas
On Tue, Dec 17, 2019 at 3:48 PM Tom Lane wrote: > Oh, scratch that --- looking closer, I see that the only two use-cases in > the patched code are via before_shmem_exit and PG_ENSURE_ERROR_CLEANUP, > and both of those require a function with the signature of an on_exit > callback. Yeah, that's wh

Re: non-exclusive backup cleanup is mildly broken

2019-12-18 Thread Michael Paquier
On Wed, Dec 18, 2019 at 07:43:43AM -0500, Robert Haas wrote: > On Tue, Dec 17, 2019 at 11:36 PM Fujii Masao wrote: >> If pg_abort_backup callback function can be called safely even when >> the backup is not in progress, we can just use the global variable like >> pg_abort_backup_registered to regi

Re: non-exclusive backup cleanup is mildly broken

2019-12-18 Thread Robert Haas
On Tue, Dec 17, 2019 at 11:36 PM Fujii Masao wrote: > If pg_abort_backup callback function can be called safely even when > the backup is not in progress, we can just use the global variable like > pg_abort_backup_registered to register the callback function only > on first call. In this way, canc

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Kyotaro Horiguchi
At Tue, 17 Dec 2019 15:48:40 -0500, Tom Lane wrote in > I wrote: > > Took a quick look. I agree that this seems a lot cleaner than the > > alternative proposals. I'd suggest however that the header comment > > for do_pg_abort_backup could do with more work, perhaps along the > > lines of "The o

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Fujii Masao
On Wed, Dec 18, 2019 at 12:19 PM Robert Haas wrote: > > On Tue, Dec 17, 2019 at 6:40 PM Michael Paquier wrote: > > So that's how you prevent piling up multiple registrations of this > > callback compared to v1. FWIW, I think that it is a cleaner approach > > to remove the callback once a non-exc

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Robert Haas
On Tue, Dec 17, 2019 at 6:40 PM Michael Paquier wrote: > So that's how you prevent piling up multiple registrations of this > callback compared to v1. FWIW, I think that it is a cleaner approach > to remove the callback once a non-exclusive backup is done, because a > session has no need for it o

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Michael Paquier
On Tue, Dec 17, 2019 at 12:52:05PM -0500, Robert Haas wrote: > On Tue, Dec 17, 2019 at 8:38 AM Robert Haas wrote: >> Since there doesn't seem to be any opposition to my original fix, >> except for the fact that I included a bug in it, I'm going to go see >> about getting that committed. > > Perha

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Tom Lane
I wrote: > Took a quick look. I agree that this seems a lot cleaner than the > alternative proposals. I'd suggest however that the header comment > for do_pg_abort_backup could do with more work, perhaps along the > lines of "The odd-looking signature allows this to be registered > directly as a

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Magnus Hagander
On Tue, Dec 17, 2019 at 7:05 PM Tom Lane wrote: > Robert Haas writes: > > Perhaps I spoke too soon: I'm not sure whether Michael's comments > > amount to an objection. While I give him a chance to respond, here's > > an updated patch. > > Took a quick look. I agree that this seems a lot cleaner

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Tom Lane
Robert Haas writes: > Perhaps I spoke too soon: I'm not sure whether Michael's comments > amount to an objection. While I give him a chance to respond, here's > an updated patch. Took a quick look. I agree that this seems a lot cleaner than the alternative proposals. I'd suggest however that th

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Robert Haas
On Tue, Dec 17, 2019 at 8:38 AM Robert Haas wrote: > Since there doesn't seem to be any opposition to my original fix, > except for the fact that I included a bug in it, I'm going to go see > about getting that committed. Perhaps I spoke too soon: I'm not sure whether Michael's comments amount to

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Robert Haas
On Fri, Dec 13, 2019 at 3:00 AM Michael Paquier wrote: > Agreed, that's an issue and do_pg_abort_abort should not touch > sessionBackupState, so you should keep cancel_before_shmem_exit after > pg_stop_backup(). I don't understand this comment, because that can't possibly work. It assumes either

Re: non-exclusive backup cleanup is mildly broken

2019-12-17 Thread Robert Haas
On Tue, Dec 17, 2019 at 1:31 AM Kyotaro Horiguchi wrote: > The patch can cause removal of a wrong cleanup function on non-cassert > build. That might be unwanted. But I think the assertion is needed > anyway. I agree with the first part of this critique, but not necessarily with the second part.

Re: non-exclusive backup cleanup is mildly broken

2019-12-16 Thread Kyotaro Horiguchi
At Tue, 17 Dec 2019 15:11:55 +0900 (JST), Kyotaro Horiguchi wrote in > At Tue, 17 Dec 2019 11:46:03 +0900, Fujii Masao wrote > in > PREPARE. The attached does that and changes the if condition of > cancel_before_shmem_exit into assertion. The patch can cause removal of a wrong cleanup functi

Re: non-exclusive backup cleanup is mildly broken

2019-12-16 Thread Kyotaro Horiguchi
At Tue, 17 Dec 2019 11:46:03 +0900, Fujii Masao wrote in > On Tue, Dec 17, 2019 at 4:19 AM Robert Haas wrote: > > > > On Sun, Dec 15, 2019 at 8:44 PM Kyotaro Horiguchi > > wrote: > > > However I don't object to the restriction, couldn't we allow the > > > cancel_before_shmem_exit to search for

Re: non-exclusive backup cleanup is mildly broken

2019-12-16 Thread Fujii Masao
On Tue, Dec 17, 2019 at 4:19 AM Robert Haas wrote: > > On Sun, Dec 15, 2019 at 8:44 PM Kyotaro Horiguchi > wrote: > > However I don't object to the restriction, couldn't we allow the > > cancel_before_shmem_exit to search for the given entry looping over > > the before_shmem_exit array? If we don

Re: non-exclusive backup cleanup is mildly broken

2019-12-16 Thread Robert Haas
On Sun, Dec 15, 2019 at 8:44 PM Kyotaro Horiguchi wrote: > However I don't object to the restriction, couldn't we allow the > cancel_before_shmem_exit to search for the given entry looping over > the before_shmem_exit array? If we don't do that, an assrtion is needed > instead. > > Since pg_stop_b

Re: non-exclusive backup cleanup is mildly broken

2019-12-15 Thread Kyotaro Horiguchi
At Fri, 13 Dec 2019 18:50:25 -0500, David Steele wrote in > On 12/13/19 3:56 AM, Magnus Hagander wrote: > > On Fri, Dec 13, 2019 at 9:00 AM Michael Paquier > think that's a bad idea to put a restriction of this kind.  There > > are large consumers of 2PC, and everybody needs backups. > > You

Re: non-exclusive backup cleanup is mildly broken

2019-12-13 Thread David Steele
On 12/13/19 3:56 AM, Magnus Hagander wrote: On Fri, Dec 13, 2019 at 9:00 AM Michael Paquier I think that's a bad idea to put a restriction of this kind.  There are large consumers of 2PC, and everybody needs backups. You misunderstood me. I certainly didn't mean that people who use 2PC

Re: non-exclusive backup cleanup is mildly broken

2019-12-13 Thread Magnus Hagander
On Fri, Dec 13, 2019 at 9:00 AM Michael Paquier wrote: > On Thu, Dec 12, 2019 at 01:52:31PM +0100, Magnus Hagander wrote: > > On Thu, Dec 12, 2019 at 5:58 AM Kyotaro Horiguchi < > horikyota@gmail.com> > > wrote: > > > My first reaction would be to just disallow the combination of prepared > >

Re: non-exclusive backup cleanup is mildly broken

2019-12-13 Thread Michael Paquier
On Thu, Dec 12, 2019 at 01:52:31PM +0100, Magnus Hagander wrote: > On Thu, Dec 12, 2019 at 5:58 AM Kyotaro Horiguchi > wrote: >> The direction seems reasonable, but the patch doesn't free up the >> before_shmem_exec slot nor avoid duplicate registration of the >> callback. Actually before_shmem_ex

Re: non-exclusive backup cleanup is mildly broken

2019-12-12 Thread Magnus Hagander
On Thu, Dec 12, 2019 at 5:58 AM Kyotaro Horiguchi wrote: > Hello. > > At Wed, 11 Dec 2019 17:32:05 -0500, Robert Haas > wrote in > > While reviewing the first patch in Asif Rehman's series of patches for > > parallel backup over at > > > http://postgr.es/m/CADM=Jeg3ZN+kPQpiSfeWCXr=xgplrq4cbqe5zv

Re: non-exclusive backup cleanup is mildly broken

2019-12-11 Thread Kyotaro Horiguchi
Hello. At Wed, 11 Dec 2019 17:32:05 -0500, Robert Haas wrote in > While reviewing the first patch in Asif Rehman's series of patches for > parallel backup over at > http://postgr.es/m/CADM=Jeg3ZN+kPQpiSfeWCXr=xgplrq4cbqe5zviuxygkq3v...@mail.gmail.com > I discovered that commit 7117685461af50f50