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 1u8eF7-009Lip-70 for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Apr 2025 12:02:49 +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 1u8eE4-003Yq1-B9 for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Apr 2025 12:01:45 +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 1u8eE3-003Yps-Te for pgsql-hackers@lists.postgresql.org; Sat, 26 Apr 2025 12:01:44 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u8eE2-0023JQ-1h for pgsql-hackers@lists.postgresql.org; Sat, 26 Apr 2025 12:01:43 +0000 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-af5139ad9a2so2138876a12.1 for ; Sat, 26 Apr 2025 05:01:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745668902; x=1746273702; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6RF2qtzt96yckG/Sd7WaCJE6MKp3oi5/AcZ1T0flv24=; b=KBrDTHJiZlmXEmUSw/ag8i4ha3WvqwwjAoHp1gpkzhoQSa7v2XFuTQGepVITgY07CN xrPUC+dh9vBleXUI9XSwwXcYTzL1Pda7sEr7062amGI796IvEuRPNRc8gcMrE+zc1vAU 9K+n2nNz1CUQd3+1MD0fNFujCCE4uUCPl8KpxLcDfDd7kEF7PNZyouKRY0cqHld0NR4g vNG9462C2oy1p2JjlrJOOxc9Bvuz81l8o/5YyUxQkdQXMnJfvEicAVUdWDkew+C6+1Qe 7gvSdSVB1s2wCtVj+ssIWiHUg0gkXKOGoRx2kt3cpOdp+y20cUymDsokdBE14Zw7Mpli uFkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745668902; x=1746273702; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6RF2qtzt96yckG/Sd7WaCJE6MKp3oi5/AcZ1T0flv24=; b=lZqqrFMDCUISZPFp+RwSLNnSCmuaqHufMtXn0Wu9wgwAlPTlheEgD/R51MDuNz2PDv EP+SwY+77dA1OtCwzOpencRiJ1U31509vk72aePsT5cIXdJyw1YIOQNeq2hlzSzU3Q91 yNBjX6z/2nx/Raxk6yv2T/3MxqlXI9dSqfwJ/N6pAAzEIoIkg8D508RXpxeYZ11BOCv4 fKHCHASGZNtUjxvaCwWQvWJfu1mnZKzDFu1uBJ1Lr4Db+9KB+6W95pWMwn7ZQrqNllJ4 +pbA0lhoRhueXzjhgECOQjEaXhIN9RPbgNpeSTvKtqTxP++cNI6v45aRQ8av1wDknY04 MChg== X-Forwarded-Encrypted: i=1; AJvYcCWJnIwC2zZpdvM+4JhV2WfxS3N+RV3oF1jBqO8ZUoHSVjqjAZ0rTw7CbGsCxwYWNzuwW+iSCXoV3jqDTKxL@lists.postgresql.org X-Gm-Message-State: AOJu0YwxNIxzlvoZ4ReC3Zd73qFyA1wsApN8bjZbyXndjpUVarSJzNcv lBiQaV5NqQJWgOs/Ti1Q6k2OYyPPXOJhaWyTUmZjdvhLpub3rrJB7vq6KLQuznW3OYcQchCIhZp cq2EBwhzvDM9yiUUTEEx+oYNZiFc= X-Gm-Gg: ASbGncvT/qYYCB8BzCAmevLYZdqfPHyEQhB16Sd8vEjk9Gf7lWNLyFzg3gvKvxtATdA Clb6OOVR+Zqn4Z9CqcLfWigIxjMJ3GHx3Rg1vMrJdFOyU5Cu0c3lTaFvJa5U/SQ3I+okdUGF6Yn KMA1tS/naomDq8eD9ErRb7fEiO X-Google-Smtp-Source: AGHT+IEca65jeWHI9LwhYHpGr0OVGVJGg06wC0PIA9R6AKi4J8aTmcqk5Jp5IP9Gsg8RQpajVBCIqLUid51VZegiupI= X-Received: by 2002:a17:90b:5241:b0:2ee:94d1:7a89 with SMTP id 98e67ed59e1d1-309f7d9e75bmr8022925a91.1.1745668901801; Sat, 26 Apr 2025 05:01:41 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Sat, 26 Apr 2025 17:31:29 +0530 X-Gm-Features: ATxdqUEc7zBPJbNRgJ1wBYWhcByFC-YmBDFIw5Lp0Dtxu__JoW1cPp93_Uzpoio Message-ID: Subject: Re: Fix premature xmin advancement during fast forward decoding To: Masahiko Sawada Cc: "Zhijie Hou (Fujitsu)" , PostgreSQL Hackers , shveta malik Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Apr 26, 2025 at 12:01=E2=80=AFAM Masahiko Sawada wrote: > > On Fri, Apr 25, 2025 at 4:42=E2=80=AFAM Amit Kapila wrote: > > > > On Fri, Apr 25, 2025 at 10:46=E2=80=AFAM Masahiko Sawada wrote: > > > > > > What I'm concerned about is the back branches. With this approach all > > > back branches will have such degradations and it doesn't make sense t= o > > > me to optimize SnapBuildCommitTxn() codes in back branches. > > > > > > > One possibility could be that instead of maintaining an entire > > snapshot in fast_forward mode, we can maintain snapshot's xmin in each > > ReorderBufferTXN. But then also, how would we get the minimum > > txns_by_base_snapshot_lsn as we are getting now in > > ReorderBufferGetOldestXmin? I think we need to traverse the entire > > list of txns to get it in fast_forward mode but that may not show up > > because it will not be done for each transaction. We can try such a > > thing, but it won't be clean to have fast_forward specific code and > > also it would be better to add such things only for HEAD. > > Agreed. > We may need to consider handling xmin in SnapBuildCommitTxn(), where we also set the base snapshot. > > Can you think of any better ideas? > > No idea. Hmm, there seems no reasonable way to fix this issue for back > branches. I consented to the view that these costs were something that > we should have paid from the beginning. > Right, I feel we should go with the simple change proposed by Hou-San for now to fix the bug. If, in the future, we encounter any cases where such optimizations can help for fast-forward mode, then we can consider it. Does that sound reasonable to you? --=20 With Regards, Amit Kapila.