Re: pg_receivexlog and replication slots

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, furuyao(at)pm(dot)nttdata(dot)co(dot)jp, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_receivexlog and replication slots
Date: 2014-09-01 12:06:13
Message-ID: 20140901120613.GB20990@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-09-01 20:58:29 +0900, Michael Paquier wrote:
> On Sun, Aug 31, 2014 at 10:45 PM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> > As this is a number of patches rolled into one - do you happen to keep
> > them separate in your local repo? If so can you send them as separate
> > ones (refactor identify_system should be quite unrelated to supporting
> > replication slots, right?), for easier review? (if not, I'll just
> > split them apart mentally, but it's easier to review separately)
> Thanks for your review!
>
> OK, here are 2 patches, the 2nd needing the 1st one:
> 1) Refactor IDENTIFY_SYSTEM and replslot create/drop APIs
> 2) Support for --create and --drop in pg_receivexlog
>
> > On the identify_system part - my understanding of the code is that
> > what you pass in as num_cols is the number of columns required for it
> > to work, right?
> The argument is I would say cross-version compatibility and
> consistency with the existing 9.4 code, but... (see below for the rest
> of the story).

I don't really see a need to that for slot specific code. The locations
where we more lenient are ones where < 9.4 is ok, or a better message is
following shortly afterwards.

> > We probably need to adjust the error message as well
> > in that case, because it's no longer what's "expected", it's what's
> > "required"?
> OK, changed this way.

The reason for the formulation of the current error message is that it's
the same across all callsites emitting it to make it easier for
translators. It used to be more specific at some point and then was
changed. Since these aren't expected to be hit much I don't really see a
need to be very detailed.

> > And we might want to include a hint about the reason (wrong version)?
> I am not sure about that, a simple error message looks fine IMO, and
> there is no notion of error hinting in the other client utilities as
> well.

Agreed.

> > Actually - why do we even care about the 3 vs 4 in RunIdentifySystem,
> > as it never actually looks at the 4th column anyway? If we do
> > specifically want it to fail in the case of pg_recvlogical, we really
> > need to think up a better error message for it, and perhaps a
> > different way of specifying it?

> Hm. I'd vote to simplify the code a bit based on the argument that the
> current API only looks at the 3 first columns and does not care about
> the 4th which is the plugin name.

Why not return all four columns from RunIdentifySystem(), setting plugin
to NULL if not available. Then the caller can error out.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2014-09-01 12:06:41 Re: LIMIT for UPDATE and DELETE
Previous Message Michael Paquier 2014-09-01 11:58:29 Re: pg_receivexlog and replication slots