From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Greg Nancarrow <gregn4422(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>, Peter Smith <smithpb2250(at)gmail(dot)com>, "Smith, Peter" <peters(at)fast(dot)au(dot)fujitsu(dot)com>, David Steele <david(at)pgmasters(dot)net>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)fujitsu(dot)com>, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Dave Cramer <pg(at)fastcrypt(dot)com>, Jing Wang <jingwangian(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Elvis Pranskevichus <elprans(at)gmail(dot)com> |
Subject: | Re: Libpq support to connect to standby server as priority |
Date: | 2021-01-05 21:34:52 |
Message-ID: | 3425296.1609882492@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Greg Nancarrow <gregn4422(at)gmail(dot)com> writes:
> Posting an updated set of patches.
I've reviewed and pushed most of v20-0001, with the following changes:
* I realized that we had more moving parts than necessary for
in_hot_standby. We don't really need two static variables, one is
sufficient --- and we shouldn't make the SHOW hook have side-effects,
that's just dangerous.
* The documentation patches were missing an addition to config.sgml,
as well as failing to list the new GUC in the two places where we
document all GUC_REPORT variables.
What I did *not* push was the change to mark transaction_read_only
as GUC_REPORT. I find that idea highly dubious, for a couple of
reasons:
* It'll create useless ParameterStatus traffic during normal operations
of an application using "START TRANSACTION READ ONLY" or the like.
* I do not think it will actually work for the desired purpose of
finding out the read-only state during session connection. AFAICS,
we don't set XactReadOnly to a meaningful value except when starting
a transaction. Yeah, we'll run a transaction during login because
we have to examine the system catalogs ... but do we start a new
one after absorbing the effects of, say, ALTER USER SET
default_transaction_read_only? I doubt it, and even if it works
today it'd be fragile, because someday somebody will try to collapse
any multiple transactions during startup into one transaction.
I think what we want to do is mark default_transaction_read_only as
GUC_REPORT, instead. That will give a reliable report of what the
state of its GUC is, and you can combine it with is_hot_standby
to decide whether the session should be considered read-only.
If you don't get those two GUC values during connection, then you
can fall back on "SHOW transaction_read_only".
Setting this back to waiting on author.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Martinez | 2021-01-05 21:40:38 | [PATCH] Partial foreign key updates in referential integrity triggers |
Previous Message | Jeff Davis | 2021-01-05 21:28:59 | Re: New Table Access Methods for Multi and Single Inserts |