Re: Non-reserved replication slots and slot advancing - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Non-reserved replication slots and slot advancing
Date
Msg-id 20180710072630.oosunvidrxjdjdbb@alap3.anarazel.de
Whole thread Raw
In response to Re: Non-reserved replication slots and slot advancing  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Non-reserved replication slots and slot advancing  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
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?

Looks generally good. One remark:

> +    /* A slot whose restart_lsn has never been reserved cannot be advanced */
> +    if (XLogRecPtrIsInvalid(MyReplicationSlot->data.restart_lsn))
> +    {
> +        ReplicationSlotRelease();
> +        ereport(ERROR,
> +                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
> +                 errmsg("cannot advance replication slot that has not previously reserved WAL")));
> +    }

Why is the ReplicationSlotRelease() needed here? Souldn't the error
handling code do so automatically?

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Recovery performance of standby for multiple concurrenttruncates on large tables
Next
From: 杨杰
Date:
Subject: user-friendliness improvement of pageinspect