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 1nILVy-0001GB-Fa for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Feb 2022 02:18:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nILVx-0000G8-5E for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Feb 2022 02:18:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nILVw-0000Fy-TF for pgsql-bugs@lists.postgresql.org; Fri, 11 Feb 2022 02:18:24 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nILVq-0001YW-0D for pgsql-bugs@lists.postgresql.org; Fri, 11 Feb 2022 02:18:24 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 208DC3200E82; Thu, 10 Feb 2022 21:18:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 10 Feb 2022 21:18:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=sFMrUmma3RL8DC77H5BvRznH4aAnE4YLNQ45yj dmsow=; b=jLDx9DnskI7r3oFcuCIMuGwLxYlzvx3mPYcIelsDLS7knZdbmFHZj2 CzwP0Hl380S45IwH33m/HHqsh1CetIBfYluilsaujDOZ5VcOmtfMfk84C/DE2Xxt jl5JsZp8PhY6XV7ZgAXfrbVH7PAP3JPBcnEjAwYEZ9r1m9GcdeO0DjGpNGcFfjxF UjAEEVpA0LFLVussbearo5ge4eFxkR7xymlmlT6/HidHidj/3OQZpdFvnYGIy+mW dJDZD0dJO32AfZZ13sm4Pp7UVmgU3eac/vHavq7Cqbocn7uQUtY2TU4y/kl+FfIa kwCWBL2u2LfBChbgeaINQnxkmSDwu5cg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=sFMrUmma3RL8DC77H 5BvRznH4aAnE4YLNQ45yjdmsow=; b=UbH2lcDaxt+CJsqHjRiPedi3hFFPgfrw3 e2IP/1e9g8PJ65njLYrrIjcYwOdemm1zJJJNP07EUd7fow2JE740pq+1KrR5rviy c5PrrymLgD2KOvv72vs8o8q8DRFZqZ0m1rXgZEoZn7cekWiLR0MXAZYDlJUgU1HK D1kHrjSmsQX847Ra2mO0BAP43zkQ/KaPQekYqZbWhUc3SrJhu8lCepwe9+1+h1Di BS4m4M0/pM5CenuZgpSSHNFa+Xctumpotn8hSSrhTDAsoCC/f6+9QH1r07Hi+SY0 8OsufuAA/Dmxo07CPRFiMK+ypAfwJfThsGji5ANp8z293+YfvX8Yw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddriedvgdegtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeffhfeu ffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 10 Feb 2022 21:18:13 -0500 (EST) Date: Thu, 10 Feb 2022 18:18:12 -0800 From: Andres Freund To: Michael Paquier Cc: Andrey Borodin , Ben Chobot , Peter Geoghegan , PostgreSQL mailing lists Subject: Re: BUG #17401: REINDEX TABLE CONCURRENTLY creates a race condition on a streaming replica Message-ID: <20220211021812.wgv324etfaz4v4yu@alap3.anarazel.de> References: <17401-9df851bb16dde397@postgresql.org> <49421F62-E34E-4CEA-8372-F0454DC71CA0@yandex-team.ru> <7625EC28-D102-450F-86CE-3D37095636F5@yandex-team.ru> <04D2D137-102E-400D-B66B-C073C27A1327@yandex-team.ru> <20220211001240.47idtavhfyzi4aa3@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-02-11 10:38:34 +0900, Michael Paquier wrote: > My impression is that we don't really need to change the WAL format > based on the existing APIs we already have, or that in the worst case > it would be possible to make things backward-compatible enough that it > would not be a worry as long as the standbys are updated before the > primaries. I think it's a question of how "concurrently" we want concurrently to be on hot standby nodes. If we are OK with "not at all", we can just lock an AEL at the end of WaitForLockersMultiple(). It's a bit harder to cause the necessary snapshot conflict, but we could e.g. extend xl_running_xacts and use the record length to keep both older primary -> newer replica, and the reverse working. If we want to actually make concurrently work concurrently on the replica, we'd have to work harder. That doesn't strike me as feasible for backpatching. The most important bit bit would be to make WaitForOlderSnapshots() wait for the xmin of hot_standby_feedback walsenders and/or physical slot xmin horizons. For phase 5 & 6 we would probably have to do something like waiting for snapshot conflicts vs walsenders/slots in addition to the WaitForLockersMultiple() for conflicts on the primary. Greetings, Andres Freund