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 1wh9IF-0002JL-05 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 17:09:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wh9ID-001u1V-1V for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Jul 2026 17:09:10 +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 1wh9ID-001u1M-0D for pgsql-hackers@lists.postgresql.org; Tue, 07 Jul 2026 17:09:09 +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.98.2) (envelope-from ) id 1wh9IB-000000004Iz-03sN for pgsql-hackers@lists.postgresql.org; Tue, 07 Jul 2026 17:09:09 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (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 4gvnkh5s4hz49PxB; Tue, 07 Jul 2026 20:09:00 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783444141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yr6manD80TDU3UiRCKpDybNtnwrWKBZPYdhxwDQCz/Y=; b=jW3l7lEZXBexMY33K02sCUUd1inXnKkBaAYyEUVzi9+PnqGbRBOJDkAQNBwDvN/VGqhTnJ 0yyDXYtXhbwxaZLN4UsaSdRMzqRrUwYFubon/94ZJfuSBmqKluCupSD3wgJXkBC6J4mrOI rsIKeY06yFHpOnpkouryWYSnr1RMAs3CCnzhQwLfrmgBExGgjRRxyMsgBGVhJy83Lvy5hV CcWeTNodWW36kI14FEgLToq2eBed3kYVKsqgYyvJ2SKsl131MouQvj2/+iigeY1O8OUKsx KPbdhjA1NQrusRpoqPNkxxCgMwxz2zAQEApgaZxc1w6y3WPG8JhWzOKZhu0eJA== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1783444141; b=VbklwUhHRzSn3ToyNrR6/BpN5UJvDF5aqbgsgsHVLMzYM6NOb16UTU7ihoxt3SmdWz6aR7 1NVLJz3DVoGMpV2abx5HJjmsliLR91QQwkbtj/4/vv3BaSTtbOSRMCy7YASuKGnsJ9omv4 WiClDThKUv45z4MJTUUb1/r+EikuAhAIvIHeW/G25yW2at/JqHeuF22Z5ahVXJ5xsK1ldb imstZoooU8lfgZeygvD/dzlqa8DEaPnOuEJDzr+SVwhaK9fZJu5MFU5XznF8AuF6zQiGmD qqr/vsekgyc+hhRcQsEF4M7Rh1nNZ/E93DtGdXSPgpO6CyhNWwDrsooZRw+JLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1783444141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yr6manD80TDU3UiRCKpDybNtnwrWKBZPYdhxwDQCz/Y=; b=HbP9vIEDZ7x94uGa+Ua65jZasxnQYoEgRKTeMZDeuBQpubhhjwExHNO9WhaCd2YpPv6zDB cgdEiQDU3jKizbzSGQs2JOTb26HGqY4SwhM+q7tCoKQ4I1kx8SleBBOyUsPtwU/h5tmhVN UsVpSWK1vnsB7Ye0NKJo++SLcG8iS39Iu44FrzRDkS34DJszvknaxuAf6s7Ve9+UKGe6nx wNu3+Es1tL3kQ3Ln0JwwpNISm9A4bJsbfp5QfVvHP2SdhAkcyYGXE2V4wwkky6l5jM7P/F Rx+BqSMceIvdqFMO92/UidD8jm0x8/v+5wPY7k9kytnJ7XNyxhlAB0Fy4CAONw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: Date: Tue, 7 Jul 2026 20:08:59 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Bug: mdunlinkfiletag unlinks mainfork seg.0 instead of indicated fork+segment To: Matthias van de Meent , Thomas Munro Cc: PostgreSQL Hackers , Robert Haas , Dilip Kumar References: Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 21/12/2024 03:21, Matthias van de Meent wrote: > On Sat, 21 Dec 2024 at 01:05, Thomas Munro wrote: >> The patch does not seem unreasonable and I'd like to help tidy this >> up, but ... hmm, could we also consider going the other way? >> register_unlink_segment(), mdunlinkfiletag() and the macro that >> populates md.c's FileTag are internal to md.c, and we don't expect >> external code to be pushing md.c SYNC_UNLINK_REQUEST requests into the >> request queue (who would do that and what could the motivation >> possibly be?) Doesn't feel like a supported usage to me... So my >> question is: what bad thing would happen if we just renamed >> register_unlink_segment() to register_unlink_tombstone() without >> fork/seg arguments, to make it clear that it's not really a general >> purpose unreliable segment unlink mechanism that we want anyone to >> build more stuff on top of? > > I just noticed I misinterpreted the conditions in mdunlinkfork, so > that I thought it allowed a user to pass their own forknum into > register_unlink_segment (as that is called with the user-provided > forknum). Instead, that branch is only taken when forknum == > MAIN_FORKNUM, so I think you might be right that going in the other > direction is more desirable. > > In that case, something along the lines of the attached would then be > better - it removes the fork and segno from register_unlink_segment's > arguments (renamed to register_unlink_tombstone), and Asserts() that > mdunlinkfiletag only receives a FileTag that contains expected values. Renaming the function and the assertion makes sense to me. Committed to master, thanks! - Heikki