Re: Non-reserved replication slots and slot advancing

2018-07-10 Thread Michael Paquier
On Tue, Jul 10, 2018 at 09:51:27AM -0400, Alvaro Herrera wrote: > On 2018-Jul-10, Michael Paquier wrote: > I say please push already. We can push more fixes later if they are > needed. OK, I have pushed what I have now, with all the suggestions from upthread included. -- Michael signature.asc D

Re: Non-reserved replication slots and slot advancing

2018-07-10 Thread Alvaro Herrera
On 2018-Jul-10, Michael Paquier wrote: > Yep, let's change that as well. If you want to look at that stuff more > deeply, please feel free. Otherwise I could always push what I have > now. I say please push already. We can push more fixes later if they are needed. -- Álvaro Herrera

Re: Non-reserved replication slots and slot advancing

2018-07-10 Thread Michael Paquier
On Tue, Jul 10, 2018 at 01:16:30AM -0700, Andres Freund wrote: > On 2018-07-10 16:59:07 +0900, Michael Paquier wrote: > > if (moveto < minlsn) > > - { > > - ReplicationSlotRelease(); > > ereport(ERROR, > > (errcode(ERRCODE_FEATURE_NOT_SUPPORTE

Re: Non-reserved replication slots and slot advancing

2018-07-10 Thread Andres Freund
On 2018-07-10 16:59:07 +0900, Michael Paquier wrote: > On Tue, Jul 10, 2018 at 12:26:30AM -0700, Andres Freund wrote: > > Why is the ReplicationSlotRelease() needed here? Souldn't the error > > handling code do so automatically? > > Oh, indeed. I didn't know that PostgresMain was doing some clean

Re: Non-reserved replication slots and slot advancing

2018-07-10 Thread Michael Paquier
On Tue, Jul 10, 2018 at 12:26:30AM -0700, Andres Freund wrote: > Why is the ReplicationSlotRelease() needed here? Souldn't the error > handling code do so automatically? Oh, indeed. I didn't know that PostgresMain was doing some cleanup here. There is a second place where this can be removed, wh

Re: Non-reserved replication slots and slot advancing

2018-07-10 Thread Andres Freund
Hi, On 2018-07-10 09:54:28 +0900, Michael Paquier wrote: > > > Also, ERRCODE_FEATURE_NOT_SUPPORTED doesn't quite seem right. How about > > > ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE? > > > > +1 to both of Andres' suggestions. > > Those indeed sound better. What do you think of the attached? Lo

Re: Non-reserved replication slots and slot advancing

2018-07-09 Thread Michael Paquier
On Mon, Jul 09, 2018 at 02:48:28PM -0400, Alvaro Herrera wrote: > On 2018-Jul-09, Andres Freund wrote: > > On 2018-07-09 15:48:33 +0900, Michael Paquier wrote: > > > + if (XLogRecPtrIsInvalid(MyReplicationSlot->data.restart_lsn)) > > > + { > > > + ReplicationSlotRelease(); > > > + e

Re: Non-reserved replication slots and slot advancing

2018-07-09 Thread Alvaro Herrera
On 2018-Jul-09, Andres Freund wrote: > On 2018-07-09 15:48:33 +0900, Michael Paquier wrote: > > + if (XLogRecPtrIsInvalid(MyReplicationSlot->data.restart_lsn)) > > + { > > + ReplicationSlotRelease(); > > + ereport(ERROR, > > + (errcode(ERRCODE_FEA

Re: Non-reserved replication slots and slot advancing

2018-07-09 Thread Andres Freund
On 2018-07-09 15:48:33 +0900, Michael Paquier wrote: > On Mon, Jul 09, 2018 at 03:13:04PM +0900, Kyotaro HORIGUCHI wrote: > > Looking the attached patch, I noticed that both "WAL" and "wal" > > are used in similar ERROR messages. Grepping the source tree > > showed me that it is always in upper cas

Re: Non-reserved replication slots and slot advancing

2018-07-09 Thread Kyotaro HORIGUCHI
Hello. At Mon, 9 Jul 2018 15:48:33 +0900, Michael Paquier wrote in <20180709064833.gb30...@paquier.xyz> > On Mon, Jul 09, 2018 at 03:13:04PM +0900, Kyotaro HORIGUCHI wrote: > > Looking the attached patch, I noticed that both "WAL" and "wal" > > are used in similar ERROR messages. Grepping the so

Re: Non-reserved replication slots and slot advancing

2018-07-08 Thread Michael Paquier
On Mon, Jul 09, 2018 at 03:13:04PM +0900, Kyotaro HORIGUCHI wrote: > Looking the attached patch, I noticed that both "WAL" and "wal" > are used in similar ERROR messages. Grepping the source tree > showed me that it is always in upper case letters except in the > case it is a part of other words li

Re: Non-reserved replication slots and slot advancing

2018-07-08 Thread Kyotaro HORIGUCHI
Hello. At Mon, 9 Jul 2018 14:18:51 +0900, Michael Paquier wrote in <20180709051851.ga30...@paquier.xyz> > On Fri, Jul 06, 2018 at 03:37:57PM +0900, Kyotaro HORIGUCHI wrote: > > I'm not so in favor of the word "reserve" in first place since it > > doesn't seem intuitive for me, but "active" is al

Re: Non-reserved replication slots and slot advancing

2018-07-08 Thread Michael Paquier
On Fri, Jul 06, 2018 at 03:37:57PM +0900, Kyotaro HORIGUCHI wrote: > I'm not so in favor of the word "reserve" in first place since it > doesn't seem intuitive for me, but "active" is already used for > the state where the connection with the peer is made. (The word > "reserve" may be misused since

Re: Non-reserved replication slots and slot advancing

2018-07-05 Thread Kyotaro HORIGUCHI
At Fri, 6 Jul 2018 14:26:42 +0900, Michael Paquier wrote in <20180706052642.gb...@paquier.xyz> > On Fri, Jul 06, 2018 at 01:07:47PM +0900, Kyotaro HORIGUCHI wrote: > > Form the reasons above, I'd like to vote +1 for just ERRORing > > in the case. > > Thanks for the lookup. Do you have a good id

Re: Non-reserved replication slots and slot advancing

2018-07-05 Thread Michael Paquier
On Fri, Jul 06, 2018 at 01:07:47PM +0900, Kyotaro HORIGUCHI wrote: > Form the reasons above, I'd like to vote +1 for just ERRORing > in the case. Thanks for the lookup. Do you have a good idea for the error message to provide to users in this case? I would tend to think that "cannot move slot wh

Re: Non-reserved replication slots and slot advancing

2018-07-05 Thread Kyotaro HORIGUCHI
Hello. At Fri, 6 Jul 2018 08:16:08 +0900, Michael Paquier wrote in <20180705231608.ga2...@paquier.xyz> > On Thu, Jul 05, 2018 at 12:35:29PM -0400, Alvaro Herrera wrote: > > Do we use the term "reserved" anywhere else? It just doesn't click for > > me. Other than "All rights reserved", that is

Re: Non-reserved replication slots and slot advancing

2018-07-05 Thread Michael Paquier
On Thu, Jul 05, 2018 at 12:35:29PM -0400, Alvaro Herrera wrote: > Do we use the term "reserved" anywhere else? It just doesn't click for > me. Other than "All rights reserved", that is ... This is used in a couple of places in the docs: $ git grep -i slot | grep reserved src/sgml/catalogs.sgml:

Re: Non-reserved replication slots and slot advancing

2018-07-05 Thread Alvaro Herrera
On 2018-Jul-05, Michael Paquier wrote: > On Wed, Jul 04, 2018 at 09:57:31AM -0400, Alvaro Herrera wrote: > > None from me. > > Thanks Alvaro. For now the patch uses the following error message: > +SELECT pg_replication_slot_advance('regression_slot3', '0/1'); -- error > +ERROR: cannot move slot

Re: Non-reserved replication slots and slot advancing

2018-07-04 Thread Michael Paquier
On Wed, Jul 04, 2018 at 09:57:31AM -0400, Alvaro Herrera wrote: > None from me. Thanks Alvaro. For now the patch uses the following error message: +SELECT pg_replication_slot_advance('regression_slot3', '0/1'); -- error +ERROR: cannot move slot with non-reserved restart_lsn Mentioning directly

Re: Non-reserved replication slots and slot advancing

2018-07-04 Thread Alvaro Herrera
On 2018-Jul-04, Michael Paquier wrote: > At the end, are their any objections into fixing the issue and > tightening the advancing API? None from me. -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: Non-reserved replication slots and slot advancing

2018-07-03 Thread Michael Paquier
On Tue, Jul 03, 2018 at 01:51:48PM -0400, Alvaro Herrera wrote: > On 2018-Jul-03, Andres Freund wrote: >> Fair enough, but that's what a plain slot allows you as well, pretty >> fundamentally, no? The precise point at which recycling will be blocked >> will differer, sure. ReplicationSlotsComputeR

Re: Non-reserved replication slots and slot advancing

2018-07-03 Thread Michael Paquier
On Tue, Jul 03, 2018 at 01:51:48PM -0400, Alvaro Herrera wrote: > Getting this fixed is +0.2 from me -- I'm not really on the side of this > being a severe bug as all that. This can also cause incorrect results for clients querying pg_replication_slots when measuring bloat in pg_wal/, hence as thi

Re: Non-reserved replication slots and slot advancing

2018-07-03 Thread Alvaro Herrera
On 2018-Jul-03, Andres Freund wrote: > On 2018-07-03 13:23:50 -0400, Alvaro Herrera wrote: > > On 2018-Jul-03, Andres Freund wrote: > > > > > I'm not clear to why this is a problem? Seems like either behaviour can > > > be argued for. I don't really have an opinion either way. I'd just > > > remo

Re: Non-reserved replication slots and slot advancing

2018-07-03 Thread Andres Freund
On 2018-07-03 13:23:50 -0400, Alvaro Herrera wrote: > On 2018-Jul-03, Andres Freund wrote: > > > I'm not clear to why this is a problem? Seems like either behaviour can > > be argued for. I don't really have an opinion either way. I'd just > > remove the item from the open items list, I don't thin

Re: Non-reserved replication slots and slot advancing

2018-07-03 Thread Alvaro Herrera
On 2018-Jul-03, Andres Freund wrote: > I'm not clear to why this is a problem? Seems like either behaviour can > be argued for. I don't really have an opinion either way. I'd just > remove the item from the open items list, I don't think we need to hold > up the release for it? After reading this

Re: Non-reserved replication slots and slot advancing

2018-07-03 Thread Andres Freund
Hi, On 2018-06-26 16:13:05 +0900, Michael Paquier wrote: > I have been chewing for the last couple of days on this email from > Horiguchi-san: > https://www.postgresql.org/message-id/20180622.163312.254556300.horiguchi.kyot...@lab.ntt.co.jp > > As summarized, it is actually strange to be able to

Non-reserved replication slots and slot advancing

2018-06-26 Thread Michael Paquier
Hi all, I have been chewing for the last couple of days on this email from Horiguchi-san: https://www.postgresql.org/message-id/20180622.163312.254556300.horiguchi.kyot...@lab.ntt.co.jp As summarized, it is actually strange to be able to advance a slot which has a non-reserved restart_lsn. For e