Re: pg_dump -j against standbys

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_dump -j against standbys
Date: 2016-05-25 13:59:06
Message-ID: CABUevEwfaF4nD4aU84j7CrZa-9FAOkH_p1bkBp7ocKc9OyTh8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 24, 2016 at 5:39 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Magnus Hagander <magnus(at)hagander(dot)net> writes:
> > I think the cleanest way to do it is to just track if it's a standby in
> the
> > AH struct as written.
>
> > Comments?
>
> This patch will cause pg_dump to fail entirely against pre-9.0 servers.
> You need to execute the test conditionally.
>

Ugh. can I blame coding while too jetlagged?

> Also, in view of that, this test
>
> - if (fout->remoteVersion >= 90000)
> + if (fout->remoteVersion >= 90000 && fout->isStandby)
>
> could be reduced to just "if (fout->isStandby)". And the comment in
> front of it could stand some attention (possibly just replace it with
> the one that's currently within the inner if() ... actually, that
> comment should move to where you moved the test to, no?)
>

True. Will fix.

> Also, why didn't you keep using ExecuteSqlQueryForSingleRow()?
> As coded, you're losing a sanity check that the query gives exactly
> one row back.
>
>
The reason I did that is that ExecuteSqlQueryForSingleRow() is a static
method in pg_dump.c. I was planning to go back and review that, and
consider moving it, but I forgot it :S

I think the clean thing is probably to use that one, and also move it over
to not be a static method in pg_dump.c, but instead sit next to
ExecuteSqlQuery in pg_backup_db.c. Do you agree that's reasonable, and
something that's OK to backpatch?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2016-05-25 14:01:34 Re: pg_dump -j against standbys
Previous Message Tom Lane 2016-05-25 13:50:32 Re: Deleting prepared statements from libpq.