Re: Libpq support to connect to standby server as priority

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: vignesh C <vignesh21@gmail.com>
Cc: Greg Nancarrow <gregn4422@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Anastasia Lubennikova <a.lubennikova@postgrespro.ru>, Peter Smith <smithpb2250@gmail.com>, "Smith, Peter" <peters@fast.au.fujitsu.com>, David Steele <david@pgmasters.net>, "Tsunakawa, Takayuki" <tsunakawa.takay@fujitsu.com>, Haribabu Kommi <kommi.haribabu@gmail.com>, Robert Haas <robertmhaas@gmail.com>, Laurenz Albe <laurenz.albe@cybertec.at>, Dave Cramer <pg@fastcrypt.com>, Jing Wang <jingwangian@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Elvis Pranskevichus <elprans@gmail.com>
Date: 2021-03-03T18:54:18Z
Lists: pgsql-hackers
I wrote:
> vignesh C <vignesh21@gmail.com> writes:
>> Conchuela is failing because of:
>> ok 17 - connect to node standby_1 if mode "standby" and standby_1,primary
>> listed
>> ack Broken pipe: write( 13, 'SHOW port;' ) at
>> /usr/local/lib/perl5/site_perl/IPC/Run/IO.pm line 549.

> It didn't fail on the next run, so this might just be a phase-of-the-moon
> glitch.  Conchuela is a bit prone to that sort of thing, in my experience.
> We'll have to wait and see if it's at all repeatable.

Conchuela hasn't shown it again, but it turns out to be repeatable
on my old warhorse gaur.  After a bit of study I see the problem:
we're asking Perl to write to the stdin of a psql process that
may not be there to receive the data.  We've dodged that issue
in other tests by passing "undef" as the stdin to sub psql, so
that's what I did here.

			regards, tom lane



Commits

  1. Make test_target_session_attrs more robust against connection failure.

  2. Extend the abilities of libpq's target_session_attrs parameter.

  3. Mark default_transaction_read_only as GUC_REPORT.

  4. Introduce a new GUC_REPORT setting "in_hot_standby".

  5. Avoid spamming the client with multiple ParameterStatus messages.

  6. Avoid harmless Valgrind no-buffer-pin errors.

  7. Restructure libpq code to remove some duplicity

  8. libpq: Add target_session_attrs parameter.