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.96) (envelope-from ) id 1vXpqN-0078kj-1D for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2025 00:01:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vXpqM-00GlDx-0d for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Dec 2025 00:01:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXpqL-00GlDo-2k for pgsql-hackers@lists.postgresql.org; Tue, 23 Dec 2025 00:01:38 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vXpqJ-002CWM-1s for pgsql-hackers@lists.postgresql.org; Tue, 23 Dec 2025 00:01:38 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-29efd139227so59681765ad.1 for ; Mon, 22 Dec 2025 16:01:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766448093; x=1767052893; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=KykYZMfYUlBh7xmjnqmuCN5xuCiN9WTcuRWAmly4omY=; b=L7GRHwWMZAdyO/R+2EFyF0jmMPo3lFtfrY5PVUoLTJqkMJ3VIUOECnZh8YIB0vVxiv JHQnEWj1ONPe8Nf5MTCoCzl7cYYTiLSKrcu2qdWGkAZQ/Lv4ZnKTfZFU5kdDj5veL67n mxeR1X8Hi8nMVPiWN+fdiCAdw8yDRpYIgm+FCFG2w89S0Py74DPTISd0dDLw+BVcoIF9 /LXklShte6pTsFtRTwTxhmzefwopm+T/UWc4Bi0QIrJeCRnVswm6NvVEfWUCRsQCdrTe IrBAATFUG5h2OmgU1PN0XIIIJi6kqXYWFqmRQtuBFs3haouQQNq8VNVM4hnvlv4OmyDi b/cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766448093; x=1767052893; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KykYZMfYUlBh7xmjnqmuCN5xuCiN9WTcuRWAmly4omY=; b=A21xntaBpDKyDJciIWAmnHPdstN0YpAsdLtPjp5EOAo+4Qk0kmZcnQrriKA7CABz3J CzyK64coSIi5KUgEokjpmk9psNbNExm6TCL4wNhZEgWv9G/0fmES/aoPVaEPJ9lR6vtT gW1oohHi4TzmI4sjORX+RlI3Rh6+1P7bLahhsLZzJZYlsH5cUkDVoMnomi5jzg6w29Sy +pDX7Ao8efOZMvM/WAMm3DjK9DKt2Rlv8v1TqvFjY86LL4ihKYC4Hb94iPRJbxjos2Od DGFp39BjUvcot1qhEUJLMi0ydt4SMU3nb34e/ZJKWuqUPYwFg9jWEX2TEEdPLClcZKDF pjGA== X-Forwarded-Encrypted: i=1; AJvYcCVi7zZXU0bRS9wXYI5XcIjoLgERarUI4Hr5Ue+XwPB/bC6CbeTQxf8xXvRO+2wCwgeDHVsXryIcIEu3XZAF@lists.postgresql.org X-Gm-Message-State: AOJu0Yww2fdM1ddmrkIsZ1OGLbQUKHpLVciXAnAikoYjh34/+KbkzRl1 18HOSTccT57BwQ78H7tniXNXExuladsHhN7OxWO31DAkMVz7p/5pcQn0 X-Gm-Gg: AY/fxX49BoGDTY/D4sh4f4X5PtFY15UBrQRj1ylFVpTP9hgbRmdCqs82DilMt/W3FjP UIt09qLIGlbc4BC0jyxwGSqafkiEewaKFXd/WyTnIWaknWs3kxjfMdiiQtlXTwc7xWYQYcjN3VB nOHop5bgKXWe8Z05a3hj+pe1HnLqGwiBztdyYIKDTqkh72t15NtcR8RTx2Xyfp67v1I8cTX1wPx KFXjDxUeIfohZ1oZKQmwrlPCOX8TqrgNUTjDMm+13ggpAb67gA730y1Hivi/bPtAs19Prihxn0Q 0sJiEj4NPXwe2ldGxOWtOXYqZSmibL/FqzEwL6puwdCu5BKIdiTgB4pzo9qq+mkAlNY5QCrfEsd Yfs+d73AXspeYm/YuLTRcEuc+AUzCTf3+z3kbRNd1RimOmmftruQ5JoWXe3W3M+yt2KMwbR4Anp fIBJF5KWd0JROKVSldJCew X-Google-Smtp-Source: AGHT+IFNZU7RA7RC8XIWMc7ZfEtcLkPeglRFcIVyLLivdoJRWdZrgE5vL2qutfsfOtiIrMDH9IhRqg== X-Received: by 2002:a05:7022:208f:b0:11b:2138:476a with SMTP id a92af1059eb24-121722de680mr8575519c88.27.1766448093115; Mon, 22 Dec 2025 16:01:33 -0800 (PST) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-121724ddc30sm53226949c88.6.2025.12.22.16.01.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Dec 2025 16:01:32 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) From: Chao Li In-Reply-To: Date: Tue, 23 Dec 2025 08:00:57 +0800 Cc: Xuneng Zhou , Andres Freund , Kirill Reshke , Robert Haas , Andrey Borodin , PostgreSQL Hackers , Heikki Linnakangas Content-Transfer-Encoding: quoted-printable Message-Id: <7F5BCD7A-764D-4D8D-8E27-6F2CAAEA1CEE@gmail.com> References: <2wk7jo4m4qwh5sn33pfgerdjfujebbccsmmlownybddbh6nawl@mdyyqpqzxjek> <6BC5DBAB-6084-4BB8-8450-52E9648AB021@gmail.com> To: Melanie Plageman X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 23, 2025, at 01:57, Melanie Plageman = wrote: >=20 > On Mon, Dec 22, 2025 at 2:20=E2=80=AFAM Chao Li = wrote: >>=20 >> A few more comments on v29: >=20 > Thanks for the continued review! I've attached v30. >=20 >> 1 - 0002 - Looks like since 0002, visibilitymap_set()=E2=80=99s = return value is no longer used, so do we need to update the function and = change return type to void? I remember in some patches, to address = Coverity alerts, people had to do =E2=80=9C(void) = function_with_a_return_value()=E2=80=9D. >=20 > I was torn about whether or not to change the return value. Coverity > doesn't always warn about unused return values. Usually it warns if it > perceives the return value as needed for error checking or if it > thinks not using the return value is incorrect. It may still warn in > this case, but it's not obvious to me which way it would go. >=20 > I have changed the function signature as you suggested in v30. >=20 > My hesitation is that visibilitymap_set() is in a header file and > could be used by extensions/forks, etc. Adding more information by > changing a return value from void to non-void doesn't have any > negative effect on those potential callers. But taking away a return > value is more likely to affect them in a potentially negative way. >=20 > However, I'm significantly changing the signature in this release, so > everybody that used it will have to change their code completely > anyway. Also, I just added a return value for visibilitymap_set() in > the previous release (18). Historically, it returned void. So, I've > gone with your suggestion. =46rom a previous patch, I learned from Peter Eisentraut that =E2=80=9CWe = don't care about ABI changes in major releases.=E2=80=9D, see: = https://www.postgresql.org/message-id/70913dbd-dadf-4560-9f81-c0df72bf6578= %40eisentraut.org >> - * HEAP_PAGE_PRUNE_FREEZE indicates that we will also freeze = tuples, and >> - * will return 'all_visible', 'all_frozen' flags to the = caller. >> + * HEAP_PAGE_PRUNE_FREEZE indicates that we will also freeze = tuples >>=20 >> Nit: a tailing dot is needed in the end of the comment line. >=20 > I've changed it. One interesting thing is that our "policy" for > periods in comments is that we don't put periods at the end of > one-line comments and we do put them at the end of mult-line comment > sentences. This is a one-line comment inside a comment block, so I > wasn't sure what to do. If you noticed it, and it bothered you, it's > easy enough to change, though. If this is a one-line comment, I would have not been caring about the = tailing period. The problem is this is a paragraph of a block comment, and the above and = below paragraphs all have tailing periods. So, for consistency, I raised = the comment. ``` * HEAP_PAGE_PRUNE_MARK_UNUSED_NOW indicates that dead items can = be set * LP_UNUSED during pruning. <=3D=3D=3D Has a tailing period * - * HEAP_PAGE_PRUNE_FREEZE indicates that we will also freeze = tuples, and - * will return 'all_visible', 'all_frozen' flags to the caller. + * HEAP_PAGE_PRUNE_FREEZE indicates that we will also freeze = tuples <=3D=3D=3D Not a tailing period * * HEAP_PAGE_PRUNE_UPDATE_VM indicates that we will set the = page's status * in the VM. <=3D=3D=3D Has a = tailing period ``` >=20 >> 9 - 0006 >>=20 >> @@ -3537,6 +3537,7 @@ heap_page_would_be_all_visible(Relation rel, = Buffer buf, >> { >> ItemId itemid; >> HeapTupleData tuple; >> + TransactionId dead_after =3D InvalidTransactionId; >> ``` >>=20 >> This initialization seems to not needed, as = HeapTupleSatisfiesVacuumHorizon() will always set a value to it. >=20 > I think this is a comment for a later patch in the set (you originally > said it was from 0006), but I've changed dead_after to not be > initialized like this. My bad. This comment was actually for 0009. In v31, I see you have = removed the initialization to dead_after. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/