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 1lUEql-0000pO-Gc for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Apr 2021 20:32:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUEqk-0008St-Ds for pgsql-hackers@arkaria.postgresql.org; Wed, 07 Apr 2021 20:32:30 +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 1lUEqj-0008PT-HM for pgsql-hackers@lists.postgresql.org; Wed, 07 Apr 2021 20:32:30 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUEqc-0005fa-L5 for pgsql-hackers@postgresql.org; Wed, 07 Apr 2021 20:32:29 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 56B5C5C0003; Wed, 7 Apr 2021 16:32:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 07 Apr 2021 16:32:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=hyuj+nGt58ffTkfzi3o5hsDYz5E KMC1HYmZACqBkNVE=; b=Fb5U3RTI5Tp11NKty9KcHdb4t06GGll14Pwf+Bk1cE+ CxdXbKX2dFabtPfQuc5/AJRsGtJxpH+BmZGOS+h+DZDP24Oz6znJ+XcrT3vNH+0g PewW8K8Lz4jU4IaPDDtAS6gy8884r6TZ0afP0/tyZwNHGVmh4Yxx8SqnPnhPfTbk Al7hVJXS8TqR3ZT+S50A9M73CzaynHfydr/Fr+v7EitQpxu7SYEnWKgDs8YUGaou tFSG/ecNfP9nng5Ilp7o6BVUzgsmtUcf/hwAJUQaKVmr1GxTJyQc9H1Ppg9NbQ9w 1rMzqRTYfCcykDK9McrEqgt7UroynXWuhRlEai84gmQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=hyuj+n Gt58ffTkfzi3o5hsDYz5EKMC1HYmZACqBkNVE=; b=asL7qB2hknpE6AHq+YhG57 Xc14RFVI2X18pm/0TCHSRU4NjGvryCfKRachGzz+PuQvIZDEuKdaGRB1fyrS60lg ykGbJX5yu6I17BwYw20uL62kkAXaDxAdN5ewE6tB38XaoZGgcArT4eoP3gDBY30f p2BzeATLq06J3Lt+bbkzoY0rUJ51adSwN9aJQN3v4ukTHdAlq6WCvhof9RbNkGe/ kPZo/m4BLt650rxHVUSJ5+IcWrYgkDfztGPwnT9MkTDvz/xC5tyeRwh2/wIkxmco xVo5xOwX1Zrc8+hnQZHI0T9BoI1FtBZe4cfcDJPgxiceXIU+J5kaU1kL7pMUZp3g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejjedgudehvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeff hfeuffdunecukfhppedutdejrddugedvrdeffedruddtfeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghrrgiivghl rdguvg X-ME-Proxy: Received: from intern.anarazel.de (107-142-33-103.lightspeed.sntcca.sbcglobal.net [107.142.33.103]) by mail.messagingengine.com (Postfix) with ESMTPA id C7D0824005B; Wed, 7 Apr 2021 16:32:19 -0400 (EDT) Date: Wed, 7 Apr 2021 13:32:18 -0700 From: Andres Freund To: "Drouvot, Bertrand" Cc: fabriziomello@gmail.com, Alvaro Herrera , tushar , "[pgdg] Robert Haas" , Amit Khandekar , Rahila Syed , pgsql-hackers Subject: Re: Minimal logical decoding on standbys Message-ID: <20210407203218.pestfxu7watrnog4@alap3.anarazel.de> References: <96644a03-0b4d-e0a6-2124-0bc37e5b54fb@amazon.com> <842d60ce-99e6-f35e-8c92-0cd49381326e@amazon.com> <6b9168e5-6a29-7fda-8903-cd50563fa84c@amazon.com> <20210406180231.qsnkyrgrm7gtxb73@alap3.anarazel.de> <20210407170954.xbovgh3xdrnogg7w@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210407170954.xbovgh3xdrnogg7w@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2021-04-07 10:09:54 -0700, Andres Freund wrote: > There's also no test for a recovery conflict due to row removal. Despite > that being a substantial part of the patchset. Another aspect that wasn't tested *at all*: Whether logical decoding actually produces useful and correct results. > I'm tempted to throw out 024 - all of its tests seem fragile and prove > little. And then add a few more tests to 025 (and renaming it). While working on this I found a, somewhat substantial, issue: When the primary is idle, on the standby logical decoding via walsender will typically not process the records until further WAL writes come in from the primary, or until a 10s lapsed. The problem is that WalSndWaitForWal() waits for the *replay* LSN to increase, but gets woken up by walreceiver when new WAL has been flushed. Which means that typically walsenders will get woken up at the same time that the startup process will be - which means that by the time the logical walsender checks GetXLogReplayRecPtr() it's unlikely that the startup process already replayed the record and updated XLogCtl->lastReplayedEndRecPtr. I think fixing this would require too invasive changes at this point. I think we might be able to live with 10s delay issue for one release, but it sure is ugly :(. Greetings, Andres Freund