pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Haribabu Kommi <kommi.haribabu@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Jing Wang <jingwangian@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
Subject: Re: Libpq support to connect to standby server as priority
Date: Fri, 16 Nov 2018 11:35:47 -0500
Message-ID: <28777.1542386147@sss.pgh.pa.us> (raw)
In-Reply-To: <096a642cff0dd68b8157a5f8838e1762d0050d18.camel@cybertec.at>
References: <CAF3+xM+8-ztOkaV9gHiJ3wfgENTq97QcjXQt+rbFQ6F7oNzt9A@mail.gmail.com>
	<CAJrrPGfzSD4kmedadcDx+3vckj_kJ_jAuufgi+NsemTkWSU5Tw@mail.gmail.com>
	<1530710078.2411.29.camel@cybertec.at>
	<CA+TgmobfBaNaMrT5Qx+nQ=JKYYy-VOZ2xxXAhAGUSSWZ=fkm4g@mail.gmail.com>
	<CAJrrPGea1hX5HmZyVzhJ3HbT8x3+2zoNp48HhPVFzQUYy5PU_w@mail.gmail.com>
	<CAJrrPGcMq9YgG-aMzLK051EndUgjdnpp8_dJwJaNDZbu=sS0qQ@mail.gmail.com>
	<CAJrrPGcwt0LLLzDF9c3-zWrESJCJko-HovDOrMobkaWQaJ5YUw@mail.gmail.com>
	<67be09458f276c0c95a4b2a2a383dca9775d19cd.camel@cybertec.at>
	<26890.1542047012@sss.pgh.pa.us>
	<096a642cff0dd68b8157a5f8838e1762d0050d18.camel@cybertec.at>

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> Tom Lane wrote:
>> I don't like this patch at all: the business with keeping two connections
>> open seems impossibly fragile and full of race conditions.

> As it is now, the patch doesn't keep two connections open.  It remembers
> the index of the host of the first successful writable connection, but
> closes the connection, and opens another one to that host if no read-only
> host can be found.

Oh!  The reason I assumed it wasn't doing that is that such a behavior
seems completely insane.  If the point is to keep down the load on your
master server, then connecting only to immediately disconnect is not
a friendly way to do that --- even without counting the fact that you
might later come back and connect again.

If that's the best we can do, we should forget the whole feature and
just recommend putting slave servers first in your hosts list when
you want prefer-slave.

			regards, tom lane




view thread (149+ messages)  latest in thread

Message-ID: <28777.1542386147@sss.pgh.pa.us>
Permalink:  ../28777.1542386147@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28777.1542386147@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laurenz.albe@cybertec.at, kommi.haribabu@gmail.com, robertmhaas@gmail.com, jingwangian@gmail.com, tsunakawa.takay@jp.fujitsu.com
  Subject: Re: Libpq support to connect to standby server as priority
  In-Reply-To: <28777.1542386147@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox