Re: pgsql: Add support for managing physical replication slots to pg_receiv

From: Andres Freund <andres(at)anarazel(dot)de>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Add support for managing physical replication slots to pg_receiv
Date: 2014-10-07 05:55:22
Message-ID: 20141007055522.GB22022@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On 2014-10-07 14:51:59 +0900, Fujii Masao wrote:
> >> *** a/src/bin/pg_basebackup/pg_receivexlog.c
> >> --- b/src/bin/pg_basebackup/pg_receivexlog.c
> >> ***************
> >> *** 591,596 **** main(int argc, char **argv)
> >> --- 591,598 ----
> >> disconnect_and_exit(1);
> >> }
> >>
> >> + PQfinish(conn);
> >> +
> >> while (true)
> >> {
> >> StreamLog();
> >
> > But wouldn't it be better to simply pass in the connection to
> > StreamLog()?
>
> ISTM that the idea would make the code in StreamLog() somewhat complicated,
> i.e., StreamLog() needs to always check whether the conn is valid or not before
> trying to create new connection. We cannot remove the code to create new
> connection in StreamLog() because it needs to reconnect to the server when
> the connection is terminated (of course in the case where --no-loop is
> not specified).

Not that much imo.

if (conn == NULL)
conn = GetConnection();

if (!conn)
/* Error message already written in GetConnection() */
return;

...

PQfinish(conn);
conn = NULL;

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2014-10-07 05:58:31 Re: pgsql: Add support for managing physical replication slots to pg_receiv
Previous Message Fujii Masao 2014-10-07 05:51:59 Re: pgsql: Add support for managing physical replication slots to pg_receiv