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 1ve0Nw-007k6S-0U for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Jan 2026 00:29:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1ve0Nt-0054Eo-2C for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Jan 2026 00:29:46 +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 1ve0Ns-0054Ef-2N for pgsql-hackers@lists.postgresql.org; Fri, 09 Jan 2026 00:29:46 +0000 Received: from fout-b7-smtp.messagingengine.com ([202.12.124.150]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ve0Nn-005NN4-1K for pgsql-hackers@postgresql.org; Fri, 09 Jan 2026 00:29:45 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id 782DD1D00118; Thu, 8 Jan 2026 19:29:37 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Thu, 08 Jan 2026 19:29:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to :reply-to:subject:subject:to:to; s=fm2; t=1767918577; x= 1768004977; bh=rfqkUBZ+aZbv5PmwkfFO9bFMs3ZGcrsj5ODYF+Mj/h0=; b=k iQexW7Hl1KIEZa7rNk/I6Fs6cyQzvHyDthjDUmqlmdfuHMSki+30nDPccvof2364 YqoiH7Ff4QSFVzLE7hXk0KSMz5G5iG3Ga3jI72Fi5g/BzSkkwDzck2iOYwHEuAge r+lwXVMwYFdB+rTwse8V3Jr9Rt+9DI/UhGPzIcrtk7JTenzBbi21UeLseALPRVfv wxUANpaZaMGoyexk8z8JSGs1yq5yssiNEJvHM4fbhFZhLDtDVoddnxtSCQ1CbMWH tK0m2j/CIPcORgjvZXUPLqITsq5yP/2uPa9A8lpcBbCazWevwbxx3WiKDe8K4pfW bN+MUkfsh7Um7BLLiBKug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:reply-to:subject :subject:to:to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1767918577; x=1768004977; bh=rfqkUBZ+aZbv5PmwkfFO9bFMs3ZG crsj5ODYF+Mj/h0=; b=pKl2cloaeJX48I/8eeDcIjO4uqNbiRKi1iY+wJlX/otd ASsaMbvR3NMlh08roo/V5ZKRe611r4PoeCkWzUOgeEpHYcIm9TpUHWnDMsqKZ0GH wT+XdCwjzlAemj8CpZXUItUuYFen/7jzr/q568Q2JgoXBOvskia8Q9dD7yvGJEqf f9GLX1x0a3nvVDyU1udt0b6TkDGhGdwG8vLhe47938hETH37lp3C1A9mxNz7gcD3 4muLu/kjsUhxqBmHBUdKTqoYnk4LPusCvdQfoOwm/69JLzE8g+4FH2OcfdGA13R5 Q//jZ4eqpYinIrOLXxIMBZULJpo+rk7GnVrZWX6Qgw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddutdejfeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffvvefukfhrfhggtggujgfhsehmtdfsredttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpeeuvedvgefhfeegffeiheejgfevieejudfghfehhfeuieeutedvgfeggeei udelleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grnhgurhgvshesrghnrghrrgiivghlrdguvgdpnhgspghrtghpthhtohepkedpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepsghovghkvgifuhhrmhdophhoshhtghhrvghsse hgmhgrihhlrdgtohhmpdhrtghpthhtohepmhgvlhgrnhhivghplhgrghgvmhgrnhesghhm rghilhdrtghomhdprhgtphhtthhopehmihgthhgrvghlrdhprghquhhivghrsehgmhgrih hlrdgtohhmpdhrtghpthhtoheprhhosggvrhhtmhhhrggrshesghhmrghilhdrtghomhdp rhgtphhtthhopehthhhomhgrshdrmhhunhhrohesghhmrghilhdrtghomhdprhgtphhtth hopehhlhhinhhnrghkrgesihhkihdrfhhipdhrtghpthhtohepnhhorghhsehlvggruggs ohgrthdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrh gvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 8 Jan 2026 19:29:36 -0500 (EST) Date: Thu, 8 Jan 2026 19:29:35 -0500 To: Heikki Linnakangas Cc: Melanie Plageman , Matthias van de Meent , pgsql-hackers@postgresql.org, Thomas Munro , Noah Misch , Robert Haas , Michael Paquier Subject: Re: Buffer locking is special (hints, checksums, AIO writes) Message-ID: <4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf> Reply-To: Andres Freund References: <6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar> <3nce7i72ayzkunai6mkz24ckbxk74jodz4ua2chcdrwppxlxcd@w6x5kfkjrkru> <1108f18d-cf7c-4f17-b29c-a119fe42f7e5@iki.fi> <5dwlfu2jyzkyf3nrlzxxblxctb6xio5es73ptgsahjnmfu5miu@772rc764hfhi> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="rkiyqpij3ajqn7ww" Content-Disposition: inline In-Reply-To: From: Andres Freund List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --rkiyqpij3ajqn7ww Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I pushed what was 0001, 0002 in v8. Attached is an updated set of patches for the rest. Main changes: - the explanation in "heapam: Use exclusive lock on old page in CLUSTER" as to why it's problematic to not set hint bits wasn't quite right. I've updated it: heapam: Use exclusive lock on old page in CLUSTER To be able to guarantee that we can set the hint bit, acquire an exclusive lock on the old buffer. This is required as a future commit will only allow hint bits to be set with a new lock level, which is acquired as-needed in a non-blocking fashion. We need the hint bits, set in heapam_relation_copy_for_cluster() -> HeapTupleSatisfiesVacuum(), to be set, as otherwise reform_and_rewrite_tuple() -> rewrite_heap_tuple() will get confused. Specifically, rewrite_heap_tuple() checks for HEAP_XMAX_INVALID in the old tuple to determine whether to check the old-to-new mapping hash table. - I added a patch that inverts the meaning of LW_FLAG_RELEASE_OK, to make the equivalent code for content locks easier. For buffer content locks we reset the flags when invalidating, and otherwise we'd either need to not have the equivalent of LW_FLAG_RELEASE_OK in the flag mask or explicitly add it after making the buffer valid. I think it's also nicer this way round, because we e.g. can assert that there are no pending wakeups when invalidating a buffer. - I added a patch to reorganize some of the flags stuff in buf_internals.h, to make the later patches cleaner. In particular flags are now defined with a macro so that changing at which offset flag bits are doesn't require touching every single flag value. - For the main commit, the reorganized flag stuff removed one of the remaining FIXMEs. - I removed the performance instrumentation stuff from the batch visibility commit. I think 0001, 0002, 0003 can be committed. 0004, 0005 are new and probably could use a sanity check. 0006 hasn't changed much and is imo pretty much ready, but should be pushed together with 0007. 0007 is getting close, I think. 0008-0010 need a bit more work, but I think that can wait until 0007 has been pushed. For 0008, it'd be nice if somebody could look at the way buf_internals.h now looks. The only remaining FIXME in 0008 is about the the reuse of PGPROC->{lwWaiting,lwWaitMode,lwWaitLink}. I think reusing them for content locks isn't pretty, but it's probably not worth duplicating them. Thoughts? Greetings, Andres Freund --rkiyqpij3ajqn7ww Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v9-0001-freespace-Don-t-modify-page-without-any-lock.patch"