Re: Copy function for logical replication slots

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Copy function for logical replication slots
Date: 2019-02-15 18:37:23
Message-ID: 2f785d52-fe25-ec97-abc6-287d523709cf@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 15/01/2019 02:56, Masahiko Sawada wrote:
> On Tue, Nov 27, 2018 at 3:46 AM Petr Jelinek
> <petr(dot)jelinek(at)2ndquadrant(dot)com> wrote:
>>> +
>>> + /*
>>> + * The requested wal lsn is no longer available. We don't want to retry
>>> + * it, so raise an error.
>>> + */
>>> + if (!XLogRecPtrIsInvalid(requested_lsn))
>>> + {
>>> + char filename[MAXFNAMELEN];
>>> +
>>> + XLogFileName(filename, ThisTimeLineID, segno, wal_segment_size);
>>> + ereport(ERROR,
>>> + (errmsg("could not reserve WAL segment %s", filename)));
>>> + }
>>
>> I would reword the comment to something like "The caller has requested a
>> specific wal lsn which we failed to reserve. We can't retry here as the
>> requested wal is no longer available." (It took me a while to understand
>> this part).
>>
>> Also the ereport should have errcode as it's going to be thrown to user
>> sessions and it might be better if the error itself used same wording as
>> CheckXLogRemoved() and XLogRead() for consistency. What do you think?
>>
>
> I agreed your both comments. I've changed the above comment and
> ereport. Attached the updated version patch.
>

I went through this again and I am pretty much happy with the current
version. So I am going to mark it as RFC.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-02-15 18:41:21 Re: WAL insert delay settings
Previous Message Andres Freund 2019-02-15 17:16:55 Re: shared-memory based stats collector