From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp1 ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id OLNDJly0hmF+PQAAgWs5BA
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 06 Nov 2021 17:59:08 +0100
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp1 with LMTPS
	id 6JbXIVy0hmHSDAAAbx9fmQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Sat, 06 Nov 2021 16:59:08 +0000
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 607FF345F6
	for <larch@yhetil.org>; Sat,  6 Nov 2021 17:59:08 +0100 (CET)
Received: from localhost ([::1]:40728 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	id 1mjP23-0001WI-KH
	for larch@yhetil.org; Sat, 06 Nov 2021 12:59:07 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57996)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1mjP1y-0001Vt-MH
 for guix-patches@gnu.org; Sat, 06 Nov 2021 12:59:02 -0400
Received: from debbugs.gnu.org ([209.51.188.43]:38786)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1mjP1y-0005T9-E5
 for guix-patches@gnu.org; Sat, 06 Nov 2021 12:59:02 -0400
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1mjP1y-0001mQ-3m
 for guix-patches@gnu.org; Sat, 06 Nov 2021 12:59:02 -0400
X-Loop: help-debbugs@gnu.org
Subject: [bug#51427] [PATCH] nix: libstore: Do not remove unused links when
 deleting specific items.
Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: guix-patches@gnu.org
Resent-Date: Sat, 06 Nov 2021 16:59:02 +0000
Resent-Message-ID: <handler.51427.B51427.16362178906774@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 51427
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 51427@debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@gmail.com>
Received: via spool by 51427-submit@debbugs.gnu.org id=B51427.16362178906774
 (code B ref 51427); Sat, 06 Nov 2021 16:59:02 +0000
Received: (at 51427) by debbugs.gnu.org; 6 Nov 2021 16:58:10 +0000
Received: from localhost ([127.0.0.1]:50332 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1mjP18-0001lC-Ep
 for submit@debbugs.gnu.org; Sat, 06 Nov 2021 12:58:10 -0400
Received: from eggs.gnu.org ([209.51.188.92]:60500)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@gnu.org>) id 1mjP15-0001ks-Hs
 for 51427@debbugs.gnu.org; Sat, 06 Nov 2021 12:58:08 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:48256)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@gnu.org>)
 id 1mjP10-00051x-5X; Sat, 06 Nov 2021 12:58:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=jbMs4djboZuqX00vdbhfXz8rynzURTtBKoaK3vkZk74=; b=A0GH6QTfRm5zaEc/UUVe
 zLrsSLmm4UkYOectXp/E3UIJ1m5X+yUOhHylULhgYHnrT8uJKA3yopkm/Y03uPy+eftdf7R4hSkrb
 hs0QJpU8sq5rjzlfRO8MZbNDvWCxDBVdYRpJzxwtfzLOjdPhMLM0vW7oA79ekJvjRheR5g3SuChht
 mtHvyFLPzBST4f6lueccmcS8foX4rPu1NcNYnbaMkKiZRyaforI73jgDwiNLU9AsVifASrL/hZbMy
 JqphHBVt8HwnayaNTR3AtLnyNM+E5MgcpdF6X92ihTBklgkM+P+MdFnEeqc/30O7hJRaqEkj+UGgs
 wbU/XgSklKO3Wg==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55518
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@gnu.org>)
 id 1mjP0y-0007uJ-RE; Sat, 06 Nov 2021 12:58:01 -0400
From: Ludovic =?UTF-8?Q?Court=C3=A8s?= <ludo@gnu.org>
References: <20211027034918.4591-1-maxim.cournoyer@gmail.com>
 <87o8795j61.fsf@gnu.org>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@gmail.com>
 <87h7cxp9tl.fsf@gnu.org> <87sfwg7w9z.fsf@gmail.com>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 16 Brumaire an 230 de la =?UTF-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Sat, 06 Nov 2021 17:57:58 +0100
In-Reply-To: <87sfwg7w9z.fsf@gmail.com> (Maxim Cournoyer's message of "Sun, 31
 Oct 2021 16:51:36 -0400")
Message-ID: <87ee7tmdbd.fsf@gnu.org>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: guix-patches@gnu.org
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-patches>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org
Sender: "Guix-patches" <guix-patches-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1636217948;
	h=from:from:sender:sender: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:resent-cc:
	 resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=jbMs4djboZuqX00vdbhfXz8rynzURTtBKoaK3vkZk74=;
	b=hWCT3wB9JXRIFrn9Q3X7XFYs1v7QBJp6QblK2MLYSniNexrt5NldZ7TGtFKzj4SuDhCONC
	lK2ShqBygLjDsZQk9AeMi6xppBH/ZdFwW6+VwSwUMNl7n55bFomhbxfWjRINg1mfhYCuTx
	RSoJHGsRKHfXAtULy8sl3SQNeXlQdxSdMFGWwLBEzesnnQBvlbg8NkjhANQupNSJ1E2SS2
	7nMBGISBUb6GZYZDSc6pApJYCKsonGiqmmcXsnLqyJOvXqAI8FxEeTFWplccr/qoVKtVnG
	9FTUwCe0t4wQ+xOQYtPu0cTFocEsM71M5Mo3N9LrqOvb8zaODp+rEiGZ1J6FRg==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1636217948; a=rsa-sha256; cv=none;
	b=umBZGubNcRGmHT6EvQqXg3Do9+CgZeqfI3OXUjn1Xaglt3jUCm4uKUrvodgOU15gZpT1kr
	5aP/9cGigcW4Bk9E6Fc66aqLBpAp1dEDg4lmAVjgW3Qb8sY87S59MQtBolmpztscdb2WSS
	A2/Id5ZeQxZqGJQMvduNPUqoUWI31q5EM6t/Bf+7BnIxEM+m8CHDJZuJinrk4UgmntPWY8
	HpOXNXGk2zMGvnbRK1TrKdx0aNbjMCGu0oHHDonBLgVrOu4qKuiJFFloA1uebwUwNV5A+P
	Of+2Ynwrg2ZwofwWsLbC4RmF2TLfm+M6zsAOwz4lIAzQ7dtea/zLTXIR3RlOxw==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=A0GH6QTf;
	dmarc=pass (policy=none) header.from=gnu.org;
	spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org
X-Migadu-Spam-Score: -2.92
Authentication-Results: aspmx1.migadu.com;
	dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=A0GH6QTf;
	dmarc=pass (policy=none) header.from=gnu.org;
	spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org
X-Migadu-Queue-Id: 607FF345F6
X-Spam-Score: -2.92
X-Migadu-Scanner: scn0.migadu.com
X-TUID: QUO0U6YAxVgY

Hi Maxim and all,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> Ludovic Court=C3=A8s <ludo@gnu.org> writes:

[...]

>> You seem to be proposing to remove =E2=80=98-D=E2=80=99 altogether.  I a=
gree it has the
>> shortcomings you write, but I think it=E2=80=99s occasionally useful
>> nonetheless.
>>
>> My proposal would be either the status quo, or removing just the one
>> link that matters from /gnu/store/.links upon =E2=80=98-D=E2=80=99.
>
> The second proposal makes sense.

Maybe that proposal is bogus though because you=E2=80=99d need to know the =
hash
of the files being removed, which means reading them=E2=80=A6

> I didn't care about freeing space, as my use case was getting around
> corrupting an item in my store due to
> https://issues.guix.gnu.org/51400, which the patch proposed here
> allowed me to do without wasting hours of cleaning up links (nearly 1
> GiB of store on spinning drives).

The ideal solution as zimoun writes would be to address
<https://issues.guix.gnu.org/24937>.

Perhaps that phase needs to be implemented using a different strategy,
say an sqlite database that records the current link count (hoping that
=E2=80=98SELECT * FROM links WHERE NLINKS =3D 1=E2=80=99 would be faster th=
an traversing
all of =E2=80=98.links=E2=80=99) as well as a mapping from store item to fi=
le hashes.

BTW, those using Btrfs can probably use =E2=80=98--disable-deduplication=E2=
=80=99 and be
done with it.

Thanks,
Ludo=E2=80=99.