From: | "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com> |
---|---|
To: | 'Alvaro Herrera' <alvherre(at)2ndquadrant(dot)com> |
Cc: | Greg Nancarrow <gregn4422(at)gmail(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>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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: | 2020-01-06 01:37:46 |
Message-ID: | OSAPR01MB50734D667954D53A8FE303B7FE3C0@OSAPR01MB5073.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
> So, we can know whether server is primary/standby by checking
> in_recovery, as opposed to knowing whether read-write which is done by
> checking transaction_read_only. So we can keep read-write as a synonym
> for "primary", and check in_recovery when used in servers that support
> the new GUC, and check transaction_read_only in older servers.
>
> It seems there's a lot of code that we can discard from the patch:
> first, we can discard checking for "read-only" altogether. Second, have
> us check transaction_read_only *only* if the server is of an older
> version.
Let me check my understanding. Are you proposing these?
* The canonical libpq connection parameter is target_session_attr = {primary | standby | prefer-standby}. Leave and document read-write as a synonym for primary.
* When the server version is 13 or later, libpq just checks in_recovery, not checking transaction_read_only or sending SHOW transaction_read_only.
* When the server version is before 13, libpq sends SHOW transaction_read_only as before.
Personally, 100% agreed, considering what we really wanted to do when target_session_attr was introduced is to tell if the server is primary or standby. The questions are:
Q1: Should we continue to use the name target_session_attr, or rename it to target_server_type and make target_session_attr a synonym for it? I'm in favor of the latter.
Q2: Can we accept the subtle incompatibility that target_session_attr=read-write and target_server_type=primary are not the same, when default_transaction_read_only is on? (I'd like to hear yes)
Q3: Can we go without supporting standby and prefer-standby for older servers? (I think yes because we can say that it's a new feature effective for new servers.)
Regards
Takayuki Tsunakawa
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2020-01-06 01:42:02 | Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema |
Previous Message | Tom Lane | 2020-01-05 22:51:37 | Re: Removing pg_pltemplate and creating "trustable" extensions |