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 1mYTBR-00027W-RR for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Oct 2021 13:11:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mYTBP-0006Jk-CM for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Oct 2021 13:11:35 +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 1mYTBO-0006Jc-My for pgsql-hackers@lists.postgresql.org; Thu, 07 Oct 2021 13:11:35 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mYTBH-0002lu-D0 for pgsql-hackers@lists.postgresql.org; Thu, 07 Oct 2021 13:11:34 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E93A95C00F3; Thu, 7 Oct 2021 09:11:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 07 Oct 2021 09:11:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=H3PmZxIdP+9/K7uEWdzjNU5IT0g3N7cpIVBdTbVNBf0=; b=kjMeAR8N aPnit2RQqVGjLIuq3Teyemb6cSXNJxg7hjfK1Y+THbQs9Iao+qwL3CXyeHe2r40Y nuNo73NKZDxAFPAsw5yFXhiAg/rLUz2QLp1TT31DQSYbRw0uPAXBGkHROVRbQ753 Kk6cTvim5bAcgRxysUsIXVjzuw8O9u66RS4S7PhhNRYrIAY/qKOLnzNbv4MJ4eW8 Xq9I9e6ccHphSGyfsvUTsY+jYUpD3A081/NkfZL5yrtVjwl2yFok5dyZ5uQl7yRx sXRpjB+1W+C/Vh5MIQMgO2vTdASiN9VZA+p1qXJkjiy2/agX5cPZV00ac7d5rF8W MLiRhh7YHiY6PQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudelkedgheelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpedujeevjeffjeevuddutedvkeeiueeitddvieelfeekveej udefgeeuvdejhfeuleenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhh vghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 7 Oct 2021 09:11:23 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 75B822A06D7; Thu, 7 Oct 2021 10:11:20 -0300 (-03) Date: Thu, 7 Oct 2021 10:11:20 -0300 From: Alvaro Herrera To: Amul Sul Cc: "Bossart, Nathan" , Kyotaro Horiguchi , "andres@anarazel.de" , "masao.fujii@oss.nttdata.com" , "pgsql-hackers@lists.postgresql.org" , "mengjuan.cmj@alibaba-inc.com" , "Jakub.Wartak@tomtom.com" , Ryo Matsumura Subject: Re: prevent immature WAL streaming Message-ID: <202110071311.4davhm2vralb@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 2021-Oct-07, Amul Sul wrote: > While reading this commit (ff9f111bce24), wondered can't we skip > missingContrecPtr global variable declaration and calculate that from > abortedRecPtr value whenever it needed. IIUC, missingContrecPtr is the > next page to the page that abortedRecPtr contain and that can be > calculated as "abortedRecPtr + (XLOG_BLCKSZ - (abortedRecPtr % > XLOG_BLCKSZ))", thoughts? Please correct me if I'm missing something, > thanks. I don't think that works -- what if the missing record is not on the next page but on some future one? Imagine an enormously large record that starts on segment 1, covers all of segment 2 and ends in segment 3. We could have flushed segment 2 already, so with your idea we would skip ahead only to that position, but really we need to skip all the way to the first page of segment 3. This is easier to imagine if you set wal segment size to 1 MB, but it is possible with the default segment size too, since commit records can be arbitrarily large, and "logical message" records as well. -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/