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 1w0xRI-002MX4-2o for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2026 08:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0xRG-002Q1b-0J for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Mar 2026 08:00:06 +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.96) (envelope-from ) id 1w0xRF-002Q1S-2D for pgsql-hackers@lists.postgresql.org; Fri, 13 Mar 2026 08:00:06 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0xRE-00000001uGC-1Au9 for pgsql-hackers@postgresql.org; Fri, 13 Mar 2026 08:00:05 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4853c3c2fe7so10500385e9.0 for ; Fri, 13 Mar 2026 01:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773388803; x=1773993603; darn=postgresql.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=LbG/V1fCwBMOO8hBWAMC8TKdqf5heq4Y8lxPuKeBOwA=; b=SSj2S9iFj4mk7tBYa2v/qY+Vw3taEtVauAUmvc1CgJ676kaTfbCSILs1JKgmgNb8gV 2naSDm6r4UsYFktxf3ez/2plCXI0I7qqugxHz5GpPn8slcQy270tXZ1ytCe/vn1qX7P5 6gK0jQhhnXLeLLJGD2FiYsfNYA3LjIfejwuc0f0J20+envlkwFTOIabPicS+u47v4EDo NNnoHyosb7Hz0Y45O+eF2DHLZ7kWksGsp2HeOsflQlF2qVaE5fSVSg8whdVeZJzcF1Jv mJU0z89jkvF5hswFflW3a1jCb6LJGsuzJjds7J5TPH+xOmatzU/RLUT5aBgxH5XHGxZ0 yy1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773388803; x=1773993603; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LbG/V1fCwBMOO8hBWAMC8TKdqf5heq4Y8lxPuKeBOwA=; b=G+dQl2uRU4uM/Rz622FRPEA28k9VwDOYhl3mHitWTD8E2NURtwQ7lgG0z5GYR1lo+Y oLzej+fhAKXfjSfEClWJyZ0dt9wEINGaGmSVzlg7zSVZzy3hurSRzlAneJi1PGABwm0Z o5f8xsGroyNE2ICpmPQKGZ7pTtAN0HqvMsSrFpepb7oomLBxHOauC49hwqJkfaz0V45N B1rVOQblC+7pcS8jvCS2lsgIkcPTfNfy17dttMjnP+bx2FFe8a4NjQHFZRcisc4I6q3t m1UAHeN5uWUxwwN9OuCfl4gaGLCQJAo+uuUn0GgRbU4IUMV2hve0ncromsdcbBA7lKpX ZZ6w== X-Forwarded-Encrypted: i=1; AJvYcCWk/D1qrqw277e8EGoKFjeMuVuh9qhOLW8mCmSYNezythIcO+gbCgbO9tXFqg2b6WF+C26+0dmYg8qagRAH@postgresql.org X-Gm-Message-State: AOJu0YxsUS3fM4iPfWUz+G492+8rzvJesq97pm6KWHWDqjPtckFWuiW6 YQNXaPaH0z/0/9KcQXQhvLdhY+9Zdgwwb4PfJ0L4ZLjPTdP511M4PpLx X-Gm-Gg: ATEYQzzaQ+D852UnvVyrSEVFuAGv6U8NiYgWJeJxn6HZViT2mvf7NcofGMPUFz1S7hN BcshgNaYC1oa+cBaV68VMnDms95R6ukUKkMSM1VdBhpIyi+J3uNN49UqYwDvh8OHR8eEue+ifR8 w1agW4RvRdq/10kfuiP+L9e6Is7vXvK5YFJlYFRw6jc+RoE6/datIyE5y3FBbe14xlcykuNODYI d8NW5spsJqegFnlULQNa0XNwkpLMWkhCikOkXJakfl3dRU7GHHUPZCfwGxu9wzOov/krDUFOPDo ba9A4YoPjX7yC++u6N5bdVFK96qpGNHQTHeJ2nXbZkIFPOohsOs5B7OMyIw8j/nqBr91EaW3HTC 97P30HaVoVlIdGXO5IkSZpBtGNrlUr4SWRb5YyZmbael8qzAD81qZgQZ4NI8LA17huULwofUEXT M2EpDEFPCHvTn7fTpPYslQ+0+q X-Received: by 2002:a05:600c:3489:b0:46e:32dd:1b1a with SMTP id 5b1f17b1804b1-485566ca8bbmr32021265e9.7.1773388802710; Fri, 13 Mar 2026 01:00:02 -0700 (PDT) Received: from [192.168.0.50] ([89.149.93.164]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854b5e912fsm511388485e9.2.2026.03.13.01.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Mar 2026 01:00:01 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------7yXTv4epqwG12mmLay0zxEYM" Message-ID: <52d064b8-63bd-45df-a405-b6017d49b300@gmail.com> Date: Fri, 13 Mar 2026 10:00:00 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Buffer locking is special (hints, checksums, AIO writes) To: Andres Freund , Noah Misch Cc: Heikki Linnakangas , Melanie Plageman , Kirill Reshke , Matthias van de Meent , pgsql-hackers@postgresql.org, Thomas Munro , Robert Haas , Michael Paquier References: <5dwlfu2jyzkyf3nrlzxxblxctb6xio5es73ptgsahjnmfu5miu@772rc764hfhi> <4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf> <5ubipyssiju5twkb7zgqwdr7q2vhpkpmuelxfpanetlk6ofnop@hvxb4g2amb2d> <68e89de8-5f6c-4eaf-a800-e16a5e487667@iki.fi> <20260215195239.ce.noahmisch@microsoft.com> Content-Language: en-US From: Alexander Lakhin In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------7yXTv4epqwG12mmLay0zxEYM Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hello Andres, 12.03.2026 00:40, Andres Freund wrote: > I pushed this and many of the later patches in the series. Here are updated > versions of the remaining changes. The last two previously were one commit > with "WIP" in the title. The first one has, I think, not had a lot of review - > but it's also not a complicated change. I've discovered that starting from 82467f627, the following query: SET cpu_operator_cost = 1000; CREATE TABLE t (i INT); INSERT INTO T SELECT 1 FROM generate_series(1, 1000) a; CREATE INDEX hi on t USING HASH (i); DELETE FROM t WHERE i = 1; DELETE FROM t WHERE i = 1; triggers TRAP: failed Assert("BufferIsValid(buffer)"), File: "bufmgr.c", Line: 497, PID: 3942058 #4  0x000079a60ae288ff in __GI_abort () at ./stdlib/abort.c:79 #5  0x00005a68d9343eef in ExceptionalCondition (conditionName=conditionName@entry=0x5a68d93ac27d "BufferIsValid(buffer)",     fileName=fileName@entry=0x5a68d93c99ef "bufmgr.c", lineNumber=lineNumber@entry=497) at assert.c:65 #6  0x00005a68d91a18eb in GetPrivateRefCountEntry (do_move=true, buffer=) at bufmgr.c:497 #7  SharedBufferBeginSetHintBits (lockstate=, buf_hdr=0x79e5febbbc40, buffer=)     at bufmgr.c:6830 #8  BufferBeginSetHintBits (buffer=) at bufmgr.c:6931 #9  0x00005a68d8e3c862 in _hash_kill_items (scan=) at hashutil.c:603 #10 0x00005a68d8e3b7c3 in _hash_next (scan=0x5a68e735f938, dir=) at hashsearch.c:69 #11 0x00005a68d8e616ce in index_getnext_tid (scan=scan@entry=0x5a68e735f938, direction=direction@entry=ForwardScanDirection)     at indexam.c:647 ... #25 0x00005a68d91eb4ad in exec_simple_query (query_string=0x5a68e7270120 "DELETE FROM t WHERE i = 1;") at postgres.c:1277 ... Could you please look at this? Best regards, Alexander --------------7yXTv4epqwG12mmLay0zxEYM Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
Hello Andres,

12.03.2026 00:40, Andres Freund wrote:
I pushed this and many of the later patches in the series.  Here are updated
versions of the remaining changes.  The last two previously were one commit
with "WIP" in the title. The first one has, I think, not had a lot of review -
but it's also not a complicated change.

I've discovered that starting from 82467f627, the following query:
SET cpu_operator_cost = 1000;
CREATE TABLE t (i INT);
INSERT INTO T SELECT 1 FROM generate_series(1, 1000) a;
CREATE INDEX hi on t USING HASH (i);
DELETE FROM t WHERE i = 1;
DELETE FROM t WHERE i = 1;

triggers
TRAP: failed Assert("BufferIsValid(buffer)"), File: "bufmgr.c", Line: 497, PID: 3942058

#4  0x000079a60ae288ff in __GI_abort () at ./stdlib/abort.c:79
#5  0x00005a68d9343eef in ExceptionalCondition (conditionName=conditionName@entry=0x5a68d93ac27d "BufferIsValid(buffer)",
    fileName=fileName@entry=0x5a68d93c99ef "bufmgr.c", lineNumber=lineNumber@entry=497) at assert.c:65
#6  0x00005a68d91a18eb in GetPrivateRefCountEntry (do_move=true, buffer=<optimized out>) at bufmgr.c:497
#7  SharedBufferBeginSetHintBits (lockstate=<synthetic pointer>, buf_hdr=0x79e5febbbc40, buffer=<optimized out>)
    at bufmgr.c:6830
#8  BufferBeginSetHintBits (buffer=<optimized out>) at bufmgr.c:6931
#9  0x00005a68d8e3c862 in _hash_kill_items (scan=<optimized out>) at hashutil.c:603
#10 0x00005a68d8e3b7c3 in _hash_next (scan=0x5a68e735f938, dir=<optimized out>) at hashsearch.c:69
#11 0x00005a68d8e616ce in index_getnext_tid (scan=scan@entry=0x5a68e735f938, direction=direction@entry=ForwardScanDirection)
    at indexam.c:647
...
#25 0x00005a68d91eb4ad in exec_simple_query (query_string=0x5a68e7270120 "DELETE FROM t WHERE i = 1;") at postgres.c:1277
...

Could you please look at this?

Best regards,
Alexander
--------------7yXTv4epqwG12mmLay0zxEYM--