pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Extend the abilities of libpq's target_session_attrs parameter.
3+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2021-03-03 d422a2a94b Silence perlcritic warning in commit ee28cacf6.
* pgsql: Extend the abilities of libpq's target_session_attrs parameter.
@ 2021-03-03 01:17 Tom Lane <tgl@sss.pgh.pa.us>
2021-03-03 03:54 ` Re: pgsql: Extend the abilities of libpq's target_session_attrs parameter. Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2021-03-03 01:17 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Extend the abilities of libpq's target_session_attrs parameter.
In addition to the existing options of "any" and "read-write", we
now support "read-only", "primary", "standby", and "prefer-standby".
"read-write" retains its previous meaning of "transactions are
read-write by default", and "read-only" inverts that. The other
three modes test specifically for hot-standby status, which is not
quite the same thing. (Setting default_transaction_read_only on
a primary server renders it read-only to this logic, but not a
standby.)
Furthermore, if talking to a v14 or later server, no extra network
round trip is needed to detect the session's status; the GUC_REPORT
variables delivered by the server are enough. When talking to an
older server, a SHOW or SELECT query is issued to detect session
read-only-ness or server hot-standby state, as needed.
Haribabu Kommi, Greg Nancarrow, Vignesh C, Tom Lane; reviewed at
various times by Laurenz Albe, Takayuki Tsunakawa, Peter Smith.
Discussion: https://postgr.es/m/CAF3+xM+8-ztOkaV9gHiJ3wfgENTq97QcjXQt+rbFQ6F7oNzt9A@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/ee28cacf619f4d9c23af5a80e1171a5adae97381
Modified Files
--------------
doc/src/sgml/libpq.sgml | 79 ++++++--
src/interfaces/libpq/fe-connect.c | 352 ++++++++++++++++++++++++++--------
src/interfaces/libpq/fe-exec.c | 21 +-
src/interfaces/libpq/libpq-fe.h | 9 +-
src/interfaces/libpq/libpq-int.h | 27 ++-
src/test/recovery/t/001_stream_rep.pl | 82 +++++++-
6 files changed, 456 insertions(+), 114 deletions(-)
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Extend the abilities of libpq's target_session_attrs parameter.
2021-03-03 01:17 pgsql: Extend the abilities of libpq's target_session_attrs parameter. Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-03-03 03:54 ` Michael Paquier <michael@paquier.xyz>
2021-03-03 04:33 ` Re: pgsql: Extend the abilities of libpq's target_session_attrs parameter. Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Paquier @ 2021-03-03 03:54 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On Wed, Mar 03, 2021 at 01:17:57AM +0000, Tom Lane wrote:
> Extend the abilities of libpq's target_session_attrs parameter.
>
> In addition to the existing options of "any" and "read-write", we
> now support "read-only", "primary", "standby", and "prefer-standby".
> "read-write" retains its previous meaning of "transactions are
> read-write by default", and "read-only" inverts that. The other
> three modes test specifically for hot-standby status, which is not
> quite the same thing. (Setting default_transaction_read_only on
> a primary server renders it read-only to this logic, but not a
> standby.)
pgperlcritic is complaining after this commit:
./src/test/recovery/t/001_stream_rep.pl: Variable declared in
conditional statement at line 88, column 2. Declare variables outside
of the condition. ([Variables::ProhibitConditionalDeclarations]
Severity: 5)
perlcritic is picky on this one, but you could just separate that
stuff into two lines like in the attached.
--
Michael
Attachments:
recovery-perlcritic.patch (text/x-diff, 588B) download
diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl
index 07a9912ce2..684bc8adbd 100644
--- a/src/test/recovery/t/001_stream_rep.pl
+++ b/src/test/recovery/t/001_stream_rep.pl
@@ -85,7 +85,8 @@ sub test_target_session_attrs
my $node2_port = $node2->port;
my $node2_name = $node2->name;
- my $target_name = $target_node->name if (defined $target_node);
+ my $target_name = undef;
+ $target_name = $target_node->name if defined($target_node);
# Build connection string for connection attempt.
my $connstr = "host=$node1_host,$node2_host ";
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Extend the abilities of libpq's target_session_attrs parameter.
2021-03-03 01:17 pgsql: Extend the abilities of libpq's target_session_attrs parameter. Tom Lane <tgl@sss.pgh.pa.us>
2021-03-03 03:54 ` Re: pgsql: Extend the abilities of libpq's target_session_attrs parameter. Michael Paquier <michael@paquier.xyz>
@ 2021-03-03 04:33 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2021-03-03 04:33 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org, vignesh C <vignesh21@gmail.com>
Michael Paquier <michael@paquier.xyz> writes:
> perlcritic is picky on this one, but you could just separate that
> stuff into two lines like in the attached.
Done like that, thanks for the advice.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-03-03 04:33 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 01:17 pgsql: Extend the abilities of libpq's target_session_attrs parameter. Tom Lane <tgl@sss.pgh.pa.us>
2021-03-03 03:54 ` Michael Paquier <michael@paquier.xyz>
2021-03-03 04:33 ` Tom Lane <tgl@sss.pgh.pa.us>
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