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 1jvSIc-000567-Vz for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Jul 2020 21:17:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jvSI6-0001i1-Bm for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Jul 2020 21:16:42 +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 1jvSI5-0001ht-PM for pgsql-hackers@lists.postgresql.org; Tue, 14 Jul 2020 21:16:42 +0000 Received: from mail.dalibo.com ([212.85.157.172]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jvSI3-0002yu-9M for pgsql-hackers@lists.postgresql.org; Tue, 14 Jul 2020 21:16:40 +0000 Received: from firost (larco.ioguix.net [82.66.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id BE476224F1; Tue, 14 Jul 2020 23:16:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1594761395; bh=QTjcMWn1GMGXn8KknUDSSqQAtltg6MTNS2BT4U2Qwto=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=B5sKp0t55/4qiUZ/o3VHpdAU/JeeXeA31Cbbeh5MF9phIiUqHmE+ndvHeLsHCOcwa sy09+P6WNZre5w5bEZFd9RhxcmvLUtsf1w6XB0KnuRHBqvUORX9JbfhC/XvAPEFWCT HfvufvZBCb0rnjlE/27fnYlZU3ejTvNwy68LZLmo= Date: Tue, 14 Jul 2020 23:16:34 +0200 From: Jehan-Guillaume de Rorthais To: Andres Freund Cc: Amul Sul , PostgreSQL Hackers , Robert Haas , Tom Lane , Fujii Masao Subject: Re: [patch] demote Message-ID: <20200714231634.7cad6815@firost> In-Reply-To: <20200714194951.rzn5yohwwgdo733q@alap3.anarazel.de> References: <20200617174451.222078b4@firost> <20200625192754.3e105cfc@firost> <20200703001210.7897b1a9@firost> <20200713170449.7a2c58b0@firost> <20200714194951.rzn5yohwwgdo733q@alap3.anarazel.de> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 14 Jul 2020 12:49:51 -0700 Andres Freund wrote: > Hi, > > On 2020-07-14 17:26:37 +0530, Amul Sul wrote: > > On Mon, Jul 13, 2020 at 8:35 PM Jehan-Guillaume de Rorthais > > wrote: > > > > > > Hi, > > > > > > Another summary + patch + tests. > > > > > > This patch supports 2PC. The goal is to keep them safe during > > > demote/promote actions so they can be committed/rollbacked later on a > > > primary. See tests. > > > > Wondering is it necessary to clear prepared transactions from shared memory? > > Can't simply skip clearing and restoring prepared transactions while > > demoting? > > Recovery doesn't use the normal PGXACT/PGPROC mechanisms to store > transaction state. So I don't think it'd be correct to leave them around > in their previous state. We'd likely end up with incorrect snapshots > if a demoted node later gets promoted... Indeed. I experienced it while debugging. PGXACT/PGPROC/locks need to be cleared.