Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZ57K-003tIZ-UF for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Aug 2023 07:50:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qZ57I-00652z-KP for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Aug 2023 07:50:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZ57H-00652q-OJ for pgsql-hackers@lists.postgresql.org; Thu, 24 Aug 2023 07:50:56 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qZ57D-000fsX-VA for pgsql-hackers@postgresql.org; Thu, 24 Aug 2023 07:50:54 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 982A25C01D4; Thu, 24 Aug 2023 03:50:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 24 Aug 2023 03:50:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1692863449; x= 1692949849; bh=VKns/tdOi58t31MgiSxv8c9JFfEUWkISaNxi3z4yBpY=; b=R RIda0TlqQJVYK8hgNoHtdCdT+leegMEgHHtqo6BuHNH4dmBfc5p4TOdoWJBNbyku 3IF0ah0px7uf2onucrRACV9exT2T0ghwNwWnNnD3GQD7ZX01I5oBt6GV6RTkl/aD GSNU1J2VqUYh5tp/zlXcyAmYsxuUu9/04HWYutpp1ESdkE+lQITRSqJuuEPC2OXa 6gJGZ7eIxMFCQBC8uApDR+O5w67svl5tJpYhgqrpwHbHld+0xf+he8Z5xFhrw0CA ZCH5flvpXbdhQ805C7/G8GUO7qDWP9KkoLjY8EFad6rBlzpw0gPZHQKj5wbuy0Pc PJfLDbNhc+wQ8wajdcJ8g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddvhedguddvfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 24 Aug 2023 03:50:49 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id D8357A9; Thu, 24 Aug 2023 09:50:44 +0200 (CEST) Date: Thu, 24 Aug 2023 09:50:44 +0200 From: Alvaro Herrera To: Amit Kapila Cc: "Zhijie Hou (Fujitsu)" , Thomas Munro , pgsql-hackers Subject: Re: subscription/015_stream sometimes breaks Message-ID: <20230824075044.cn4slf6wgvkpdc7f@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-Aug-24, Amit Kapila wrote: > On Wed, Aug 23, 2023 at 1:31 PM Alvaro Herrera wrote: > > Hmm, I think if worker->in_use is false, we shouldn't consult the rest > > of the struct at all, so I propose to add the attached 0001 as a minimal > > fix. > > I think that way we may need to add the check for in_use before > accessing each of the LogicalRepWorker struct fields or form some rule > about which fields (or places) are okay to access without checking > in_use field. As far as I realize, we have that rule already. It's only a few relatively new places that have broken it. I understand that the in_use concept comes from the one of the same name in ReplicationSlot, except that it is not at all documented in worker_internal.h. So I propose we do both: apply Zhijie's patch and my 0001 now; and somebody gets to document the locking design for LogicalRepWorker. > > In fact, I'd go further and propose that if we do take that stance, then > > we don't need clear out the contents of this struct at all, so let's > > not. That's 0002. > > Personally, I think we should consider this change (0002 and 0002) separately. I agree. I'd maybe even retract them. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/