Re: Non-reserved replication slots and slot advancing

From: Andres Freund <andres(at)anarazel(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org, petr(at)2ndquadrant(dot)com, simon(at)2ndQuadrant(dot)com
Subject: Re: Non-reserved replication slots and slot advancing
Date: 2018-07-10 07:26:30
Message-ID: 20180710072630.oosunvidrxjdjdbb@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 杨杰 2018-07-10 07:41:06 user-friendliness improvement of pageinspect
Previous Message Andres Freund 2018-07-10 07:14:45 Re: Recovery performance of standby for multiple concurrent truncates on large tables