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 1sA6OW-007Ytt-Tt for pgsql-bugs@arkaria.postgresql.org; Thu, 23 May 2024 11:14:02 +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 1sA6OW-00B85Z-F6 for pgsql-bugs@arkaria.postgresql.org; Thu, 23 May 2024 11:14:00 +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.94.2) (envelope-from ) id 1sA6OW-00B85R-2B for pgsql-bugs@lists.postgresql.org; Thu, 23 May 2024 11:14:00 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sA6OS-000Mn0-W2 for pgsql-bugs@lists.postgresql.org; Thu, 23 May 2024 11:13:59 +0000 Received: from [192.168.1.115] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4VlQXf5dBZz49Pyk; Thu, 23 May 2024 14:13:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1716462835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2/ReIWNFvB6RpFOVUsyiDbDhb2TWp2gCLtPKodXSFak=; b=YGtGGPkTKDaHtPsLgIzwcNzuppKPRnQNvDXy2sRKpu9p/M603oxhPlYVqP2EFpSw/vKZ29 QQnI1NoHPBvowhBMUVZEFcHFxjed8bPU6INo822VaFUxu5OI7f/dKGDvYyZWrijvciwyAr WNYuXKiLt5XVFMA5hddHJPEwq/IEGqES1MSUBDxllXm8lUPGVHYSMJFydx8rCakSy9wtVi I2pmxv2eVgpXAC1RUMXPFHJctdVVNv1tQHyj9aoqA26IfOgDMmuPQmYviQqic+6wdJZyv/ 1VL7s03bQjZ3cDtPwv8WE2rqqC3kad5Q2i3BDgLJCloQ0xWceMGCk0nVz4do3g== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1716462835; a=rsa-sha256; cv=none; b=b7oxOtXeq3mGNn3AOz2tL4KY9i+Y8BacAQ5ouRY/9RfAgD5LNN1xXoFfDp8kYH1zsOEnGX redsBMfMnduO3M05Cgquo5d94XYMvR0er+lYF24tXRFAFVI11lhzRFj/EL0l9SM3SQzkhc T8xfqknfQ4k7TPEY8W2++W+tkrokZ8QDqp08m4so05940sF/7z5HO9QiNLNo6u5kB9dxKT cB/wXk5OvJCEsDD0Y5eLnp7hYWQxL2ZgD+tlEijyl+nnl6dwpayzOj13APyeTsA2smP7CN Szknxv4LwmFa3ZWHqJwhSM5JysY6WRsJ/iGQEX4G2WIR1YrSGydPaYbTcOLAUg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1716462835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2/ReIWNFvB6RpFOVUsyiDbDhb2TWp2gCLtPKodXSFak=; b=PLBbXn7BEz/pG+YjcdnrT+Nz+5Arbs+KhnMcGH0nM1rjUHVi3c4r+e33eES9Msph1kGmgx VCGdiVY0egPxuPt93/ceB+Rx/XhLZdEAhZbZvx2sWK+ii4icF/CIfn9DOTJlJrG8Tn38FH XxggcYMnzlE0zCiCuX782QIvT8OWgLACGpxAdtMmBCCIuv1XZHI2meMsumumYce3zyNdlL PMNnxy2CZAyE0ETKBEZ5xb3MjV105Fy8r7lWghx15hrwRrLV/3MwiK4ttl7ySuQqAXgIq6 3miK7aezP2B39VzeVxF2IcJ/jBRYIk0aaqHWTO4iCobp2aTjmVX/V1prTfVMNQ== Message-ID: <6abbe3cf-9763-4b9c-b3c7-0d0fc6e2c685@iki.fi> Date: Thu, 23 May 2024 14:13:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: issue: nbtpage.c,_bt_pagedel may get wrong result To: Pengfei Wang , pgsql-bugs@lists.postgresql.org References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 23/05/2024 13:06, Pengfei Wang wrote: > # issue > https://github.com/postgres/postgres/blob/da32f5c4bca7f3447b869de2afbbfa0b74443d45/src/backend/access/nbtree/nbtpage.c#L1943 > > /* > * To avoid deadlocks, we'd better drop the leaf page lock > * before going further. > */ > _bt_unlockbuf(rel, leafbuf); > > /* > * Check that the left sibling of leafbuf (if any) is not > * marked with INCOMPLETE_SPLIT flag before proceeding > */ > Assert(leafblkno == scanblkno); > if (_bt_leftsib_splitflag(rel, leftsib, leafblkno)) > { >     ReleaseBuffer(leafbuf); >     return; > } > > After unlocking leaf, but before call _bt_leftsib_splitflag, leftsib may > be already split, and leafbuf's current left sibling is in > INCOMPLETE_SPLIT status. In that case, there should be a downlink for 'leafbuf' in the parent, and we're good to proceed, right? See the comments in _bt_leftsib_splitflag(). -- Heikki Linnakangas Neon (https://neon.tech)