Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvLtL-0003d8-P9 for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Jan 2013 05:50:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TvLtK-0004Ql-6i for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Jan 2013 05:50:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvLtJ-0004Qf-8b for pgsql-bugs@postgresql.org; Wed, 16 Jan 2013 05:50:25 +0000 Received: from mail12.ics.ntts.co.jp ([210.232.35.65]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvLtE-0000gQ-Ka for pgsql-bugs@postgresql.org; Wed, 16 Jan 2013 05:50:24 +0000 Received: from sadoku34.silk.ntts.co.jp (sadoku34 [10.7.18.34]) by mail12.ics.ntts.co.jp (8.14.4/8.14.4/NTTSOFT) with ESMTP id r0G5oA2D003491; Wed, 16 Jan 2013 14:50:10 +0900 (JST) Received: (from root@localhost) by sadoku34.silk.ntts.co.jp (8.13.8/NTTSOFT) id r0G5o9pn023672; Wed, 16 Jan 2013 14:50:09 +0900 (JST) Received: from ccmds32.silk.ntts.co.jp [10.107.0.32] by sadoku34.silk.ntts.co.jp with SMTP id QAA23669; Wed, 16 Jan 2013 14:50:09 +0900 Received: from mail147.silk.ntts.co.jp (ccmds32.silk.ntts.co.jp [127.0.0.1]) by ccmds32.silk.ntts.co.jp (8.14.3/8.14.3) with ESMTP id r0G5o8iu019034; Wed, 16 Jan 2013 14:50:08 +0900 Received: from mail147.silk.ntts.co.jp (localhost.localdomain [127.0.0.1]) by mail147.silk.ntts.co.jp (8.14.5/8.14.5/NTTSOFT) with ESMTP id r0G5o5xF021266; Wed, 16 Jan 2013 14:50:05 +0900 Received: from ccmds32 (mail145.silk.ntts.co.jp [10.107.0.145]) by mail147.silk.ntts.co.jp (8.14.5/8.14.5/NTTSOFT) with SMTP id r0G5o556021262; Wed, 16 Jan 2013 14:50:05 +0900 Message-ID: <50F63F39.7080306@po.ntts.co.jp> Date: Wed, 16 Jan 2013 14:48:41 +0900 From: Tomonari Katsumata User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: Fujii Masao CC: Heikki Linnakangas , Simon Riggs , pgsql-bugs@postgresql.org Subject: Re: BUG #7803: Replication Problem(no master is there) References: <50EFCFF5.4040109@vmware.com> <50F00301.1060301@po.ntts.co.jp> <50F4E52E.9000603@po.ntts.co.jp> <50F51294.4090406@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: CC-Mail-V4.3-Client X-CC-Mail-RelayStamp: CC-Mail-V4.3-Server X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi, (2013/01/16 4:03), Fujii Masao wrote: > On Tue, Jan 15, 2013 at 5:25 PM, Heikki Linnakangas > wrote: >> On 15.01.2013 10:14, Simon Riggs wrote: >>> >>> On 15 January 2013 05:12, Tomonari Katsumata >>> 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