Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAZvH-0006Tm-La for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Aug 2021 15:32:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mAZvG-0002av-K6 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Aug 2021 15:32:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAZvG-0002an-9G for pgsql-hackers@lists.postgresql.org; Mon, 02 Aug 2021 15:32:10 +0000 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAZvD-0008Bg-Ep for pgsql-hackers@postgresql.org; Mon, 02 Aug 2021 15:32:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1627918328; x=1659454328; h=to:cc:references:from:message-id:date:mime-version: in-reply-to:content-transfer-encoding:subject; bh=ZPFHgHdsX15vqJ9obO03GR+KX00KyyKi1zW4vqFBybs=; b=poHYMMdN0VnXQUfNsL2YKMEqs7mwr9Pak3A/aNemDsqu9QtLRBdjuPzU 1qw9KgcZJC8ErYASwDRHxTLoEeqqX1UZuxacdB5nUiqbIU6aUk9NlzaVa Kd5NJms/kure+LmuVOQ4FED+5EzvbZw0qkFBSVrA+n7THeIZi4oW83pFJ 0=; X-IronPort-AV: E=Sophos;i="5.84,289,1620691200"; d="scan'208";a="129550880" Subject: Re: Minimal logical decoding on standbys Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP; 02 Aug 2021 15:31:58 +0000 Received: from EX13D03EUC003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com (Postfix) with ESMTPS id 0659FA05E9; Mon, 2 Aug 2021 15:31:56 +0000 (UTC) Received: from 38f9d36c4abb.ant.amazon.com (10.43.162.216) by EX13D03EUC003.ant.amazon.com (10.43.164.192) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Mon, 2 Aug 2021 15:31:50 +0000 To: Ronan Dunklau , Ibrar Ahmed , Amit Khandekar , CC: Andres Freund , , Alvaro Herrera , tushar , "[pgdg] Robert Haas" , Rahila Syed , pgsql-hackers References: <1655255.DiLJNMXF8A@aivenronan> From: "Drouvot, Bertrand" Message-ID: Date: Mon, 2 Aug 2021 17:31:46 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <1655255.DiLJNMXF8A@aivenronan> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.43.162.216] X-ClientProxiedBy: EX13D44UWB002.ant.amazon.com (10.43.161.192) To EX13D03EUC003.ant.amazon.com (10.43.164.192) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Ronan, Thanks for looking at it. On 8/2/21 1:57 PM, Ronan Dunklau wrote: > Le mardi 27 juillet 2021, 09:23:48 CEST Drouvot, Bertrand a écrit : >> Thanks for the warning, rebase done and new v21 version attached. >> >> Bertrand > Hello, > > I've taken a look at this patch, and it looks like you adressed every prior > remark, including the race condition Andres was worried about. I think there is still 2 points that need to be addressed (see [1]) > > As for the basics: make check-world and make installcheck-world pass. > > I think the beahviour when dropping a database on the primary should be > documented, and proper procedures for handling it correctly should be > suggested. > > Something along the lines of: > > "If a database is dropped on the primary server, the logical replication slot > on the standby will be dropped as well. This means that you should ensure that > the client usually connected to this slot has had the opportunity to stream > the latest changes before the database is dropped." I am not sure we should highlight this as part of this patch. I mean, the same would currently occur on a non standby if you drop a database that has a replication slot linked to it. > > As for the patches themselves, I only have two small comments to make. > > In patch 0002, in InvalidateConflictingLogicalReplicationSlots, I don't see the > need to check for an InvalidOid since we already check the SlotIsLogical: > > + /* We are only dealing with *logical* slot conflicts. */ > + if (!SlotIsLogical(s)) > + continue; > + > + /* not our database and we don't want all the database, > skip */ > + if ((s->data.database != InvalidOid && s->data.database > != dboid) && TransactionIdIsValid(xid)) > + continue; Agree, v22 attached in [1] does remove the useless s->data.database != InvalidOid check, thanks! > > In patch 0004, small typo in the test file: > +################################################## > +# Test standby promotion and logical decoding bheavior > +# after the standby gets promoted. > +################################################## Typo also fixed in v22, thanks! Bertrand [1]: https://www.postgresql.org/message-id/69aad0bf-697a-04e1-df6c-0920ec8fa528%40amazon.com