From: Tomonari Katsumata <katsumata.tomonari@po.ntts.co.jp>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Heikki Linnakangas <hlinnakangas@vmware.com>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7803: Replication Problem(no master is there)
Date: Wed, 16 Jan 2013 14:48:41 +0900
Message-ID: <50F63F39.7080306@po.ntts.co.jp> (raw)
In-Reply-To: <CAHGQGwGsGoi8xgRC+9XDPqpLNmzwunY+=iuchxEjM10m6zZQew@mail.gmail.com>
References: <E1TtVvj-0004B3-2Z@wrigleys.postgresql.org>
<50EFCFF5.4040109@vmware.com>
<50F00301.1060301@po.ntts.co.jp>
<CA+U5nM+T7UbzziULTx22sSQQqvXqJ-AVzzdqDn-q=4k94pu_Ew@mail.gmail.com>
<50F4E52E.9000603@po.ntts.co.jp>
<CA+U5nMJEVsP6dKuthyD1GpuW-LPeToPjpvtL3gZEC5Nv7_YROQ@mail.gmail.com>
<50F51294.4090406@vmware.com>
<CAHGQGwGsGoi8xgRC+9XDPqpLNmzwunY+=iuchxEjM10m6zZQew@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Hi,
(2013/01/16 4:03), Fujii Masao wrote:
> On Tue, Jan 15, 2013 at 5:25 PM, Heikki Linnakangas
> <hlinnakangas@vmware.com> wrote:
>> On 15.01.2013 10:14, Simon Riggs wrote:
>>>
>>> On 15 January 2013 05:12, Tomonari Katsumata
>>> <katsumata.tomonari@po.ntts.co.jp> wrote:
>>>
>>>>> We added a REPLICATION privelge onto user accounts to control access.
>>>>>
>>>>> Perhaps we should add a CASCADE privilege as well, so that we can
>>>>> control whether we can connect to a master and/or a standby.
>>>>>
>>>>> Syntax would be
>>>>>
>>>>> ALTER USER foo
>>>>> [MASTER | CASCADE] REPLICATION
>>>>>
>>>>> REPLICATION allows both master and cascaded replication (same as now)
>>>>> MASTER REPLICATION allows master only
>>>>> CASCADE REPLICATION allows cascaded replication only
>>>>> NOREPLICATION allows neither option
>>>>>
>>>
>>>> Someone is working for it already ?
>>>> If not yet, may I try to implement it ?
>>>
>>>
>>> Please do. It looks fairly short.
>>
>>
>> To me, permissions doesn't feel like the right vehicle for
controlling this.
>> Not sure what to suggest instead, a new GUC perhaps.
>>
If this is before releasing 9.2.0, it is not problem to have a new GUC.
But 9.2 has released already.
I'm thinking about this change is for 9.3, right ?
And I'm thinking about compatibility when version up too.
If we control this with permissions, I think it is easy to
upgrade from 9.1 and 9.2 to 9.3 using pg_upgrade/pg_dumpall.
Type of pg_authid.rolreplication is boolean.
---------------------------------------------------------------------
9.1 false(f=0) true(t=1)
9.2 false(f=0) true(t=1)
---------------------------------------------------------------------
If I add permissions for cascading replication,
it will become integer and represent each permission like this:
---------------------------------------------------------------------
9.3 noreplication(0) replication(1) master-only(2) cascade-only(3)
---------------------------------------------------------------------
If pg_upgrade/pg_dumpall handle like bellow, user would never mind about
difference between versions.
from 9.1 to 9.3.
false(f=0) --> noreplication(0)
true(t=1) --> master-only(2)
from 9.2 to 9.3.
false(f=0) --> noreplication(0)
true(t=1) --> replication(1)
>> BTW, is there any reason to not allow streaming replication when
>> hot_standby=off? A streaming replication connection doesn't execute any
>> queries, so it doesn't need the system to be consistent.
>
> I was thinking that the system must be consistent since streaming
replication
> connection reads the system catalog (e.g., ROLE information).
>
And I think it's because replication connection is established
by same way with another backend connection.
>> Another thing to consider is that "pg_basebackup -X stream" also uses
>> streaming replication, so if you forbid cascade replication, you
also forbid
>> using "pg_basebackup -X stream" on the standby. At the protocol level,
>> pg_basebackup streams the WAL just like a standby server does, so we
cannot
>> distinguish those two cases in the server. The client could tell the
server
>> which one it is, but using permissions to allow/forbid based on that
would
>> make no sense as the client could lie which one it is.
>
> Probably I'm missing something, but the standby server only has to
reject the
> replication connection if cascade replication is disabled, whether
it's from
> another standby or pg_basebackup. ISTM there is no need to distinguish
> those connections. No?
>
> When "pg_basebackup -X stream" fails to establish the replication
connection,
> it only has to just fail or automatically switch to "pg_basebackup -X
fetch".
>
I think so too.
If user who does not have right permission executes "pg_basebackup -X
stream",
it would make fail.
regards,
--------
NTT Software Corporation
Tomonari Katsumata
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: katsumata.tomonari@po.ntts.co.jp, masao.fujii@gmail.com, hlinnakangas@vmware.com, simon@2ndquadrant.com
Subject: Re: BUG #7803: Replication Problem(no master is there)
In-Reply-To: <50F63F39.7080306@po.ntts.co.jp>
References: <E1TtVvj-0004B3-2Z@wrigleys.postgresql.org> <50EFCFF5.4040109@vmware.com> <50F00301.1060301@po.ntts.co.jp> <CA+U5nM+T7UbzziULTx22sSQQqvXqJ-AVzzdqDn-q=4k94pu_Ew@mail.gmail.com> <50F4E52E.9000603@po.ntts.co.jp> <CA+U5nMJEVsP6dKuthyD1GpuW-LPeToPjpvtL3gZEC5Nv7_YROQ@mail.gmail.com> <50F51294.4090406@vmware.com> <CAHGQGwGsGoi8xgRC+9XDPqpLNmzwunY+=iuchxEjM10m6zZQew@mail.gmail.com> <50F63F39.7080306@po.ntts.co.jp>
* 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