From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id qMeOJEejfmFekwAAgWs5BA (envelope-from ) for ; Sun, 31 Oct 2021 15:08:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id mBBBIEejfmEhFgAA1q6Kng (envelope-from ) for ; Sun, 31 Oct 2021 14:08:07 +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 3D75529A1A for ; Sun, 31 Oct 2021 15:08:07 +0100 (CET) Received: from localhost ([::1]:37072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhBVG-0000sA-CS for larch@yhetil.org; Sun, 31 Oct 2021 10:08:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhBVC-0000rw-Ue for guix-patches@gnu.org; Sun, 31 Oct 2021 10:08:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhBVC-00045G-MU for guix-patches@gnu.org; Sun, 31 Oct 2021 10:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mhBVC-0001cj-F4 for guix-patches@gnu.org; Sun, 31 Oct 2021 10:08: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?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 31 Oct 2021 14:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51427 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 51427@debbugs.gnu.org, Maxim Cournoyer Received: via spool by 51427-submit@debbugs.gnu.org id=B51427.16356892316186 (code B ref 51427); Sun, 31 Oct 2021 14:08:02 +0000 Received: (at 51427) by debbugs.gnu.org; 31 Oct 2021 14:07:11 +0000 Received: from localhost ([127.0.0.1]:60970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhBUN-0001bg-H9 for submit@debbugs.gnu.org; Sun, 31 Oct 2021 10:07:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhBUM-0001bT-25 for 51427@debbugs.gnu.org; Sun, 31 Oct 2021 10:07:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:54444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhBUG-00041f-HE; Sun, 31 Oct 2021 10:07:04 -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=q3EJYPRgyPjTdmktdbM/sebDxQ0SXOpf+TfNHW5he8w=; b=LwwYCthlVC3YExgjMVmI 2vuSCTkxcrhw9pOXaCGCM2H9hYfHOwZSJtsVDxalaHhJfJF7zr+VpdKWv2vq9zch5azajw6mdaLL3 I+1vu2+dX0/7/LgwSXogY9Q78zI5a1AaFgAx1uvelaCDNoDLrq45V73WK81FhxkUdnPgsOVEoS54h 66Xy1bgrJQo8mpHyovfiyH5WmG/EuTRm7dBLhJGit/jGCjkl8tgC1BzERtxkzNwYDf8afpxG93iNh Ll3DnT3TPhlqyRM6gEwj5iKRbLxICJNONlJbETmGTsP4CN0XZcABgR419k+6Jfkm0+dLayj/qUNud rerGbuGp4JwWOQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55508 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhBUF-0007JE-Km; Sun, 31 Oct 2021 10:07:03 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20211027034918.4591-1-maxim.cournoyer@gmail.com> <87o8795j61.fsf@gnu.org> <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 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: Sun, 31 Oct 2021 15:07:02 +0100 In-Reply-To: <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@gmail.com> (Liliana Marie Prikler's message of "Sun, 31 Oct 2021 09:50:15 +0100") Message-ID: <87h7cxp9tl.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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635689287; 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=q3EJYPRgyPjTdmktdbM/sebDxQ0SXOpf+TfNHW5he8w=; b=IfXJ2tDELipfwFN6SdfnGHNGpgO87iclFqvf5n9wAPhWBiXPZ9bDLvPr4vt4lLXJ1VWufy A/sQXAxlETUFv8L9InGa/gSP7qGx1kZWfxP0e9AcXwuyxpMKq4rZhFMQRuXDZuIYKFtD7O zGVcvWSUysPXsmi+ENLKv7CcXVnq679eakAWV1HuU5TB/+IkD41ra4DMBQ1Qwi/y5v8kmm Ob7RGL26/9KOvLJg8AWSEa/uFSQtEVbPi3qNWc8WT9OCS8AUR05XNeDQq1KMDS1VfBW5yN 1fwCO5Ajzad5kGBRnoWBe/xPxA93ouTBmg0GZUDrjCEfHUoLGc2U0Zdkju86zw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635689287; a=rsa-sha256; cv=none; b=kCzviehQJA7q2mzdGkGEyWImu7GmSsq/w1LG5P14BLk4rSV3vA+qdbnyzETvQKdeskadBA DI0sqk7HTurx8NNU/hmxqC6UsX/Slm83/cbQPqWzqdRcwmW7HgxfhG2FOuW0hKiW8wzuZN 1uSqQUiBNdBkcrm14Wsid57el2hi51LMuBY97WCAvzwOl1LvBEGTRWLDZLm1re3YqRILn5 qKgy7mbzuAdBxCuqGTR1neGWSk4INSnQyFQZvQWstJnLh6S82Q+nnT25AYsJ1DU5aESoEm KKa5+UXkAWZcYJ4KBmc20BygbtnWg+GoxxzHC20jQej13htxmUt6hScnJr8zkQ== 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=LwwYCthl; 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: -1.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=LwwYCthl; 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: 3D75529A1A X-Spam-Score: -1.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: jpKDdj0sY93c Hi, Liliana Marie Prikler skribis: > Am Donnerstag, den 28.10.2021, 16:16 +0200 schrieb Ludovic Court=C3=A8s: >> Hi, >>=20 >> Maxim Cournoyer skribis: >>=20 >> > Deleting unused links can be a very costly operation, especially on >> > rotative hard drives. As removing single store items is often used >> > for experimentation rather than for cleaning purposes, this change >> > allows it to run without the links cleanup. >> >=20 >> > * nix/libstore/gc.cc (LocalStore::collectGarbage): Do not clean up >> > links when >> > the specified action is GCOptions::gcDeleteSpecific. >> > --- >> > nix/libstore/gc.cc | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> >=20 >> > diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc >> > index e1d0765154..7d872d8cc1 100644 >> > --- a/nix/libstore/gc.cc >> > +++ b/nix/libstore/gc.cc >> > @@ -771,7 +771,7 @@ void LocalStore::collectGarbage(const GCOptions >> > & options, GCResults & results) >> > deleteGarbage(state, state.trashDir); >> >=20=20 >> > /* Clean up the links directory. */ >> > - if (options.action =3D=3D GCOptions::gcDeleteDead || >> > options.action =3D=3D GCOptions::gcDeleteSpecific) { >> > + if (options.action =3D=3D GCOptions::gcDeleteDead) { >>=20 >> I believe the effect is that =E2=80=98guix gc -D /gnu/store/=E2=80=A6-di= sk-image=E2=80=99 >> would remove nothing: /gnu/store/.links would still contain a copy of >> that big disk image, so as a result, you=E2=80=99ve freed zero bytes. >>=20 >> Am I right? > I think that might be the point. As Maxim said, single items are > (likely) not removed for cleaning purposes, so freeing the disk image > has little effect. What do you mean? When doing VM testing, I regularly do =E2=80=98guix gc -D /gnu/store/=E2=80=A6-disk-image=E2=80=99 precisely to save space. Fortunat= ely it does have the intended effect of freeing a bunch of GiBs. > Plus, you could invoke it like > > guix gc -D dead-item dead-item live-item dead-item > > It would fail at live-item and then not continue to free the links of > the two dead items prior. Yes, and that=E2=80=99s annoying, but it=E2=80=99s unrelated. :-) > So there's a few things we could do here: > > 1. simply fail and have the user deal with it (including the option of > doing a normal `guix gc' or `guix gc -C 1') > 2. remember which paths were live and dead and always clean up the > links, only reporting errors afterwards > 3. add an option to explicitly check the .links directory (which > defaults to true for the current things, but could also be used to > clean links after a liveness check or after a do-nothing `guix gc -F'). > 4. ... You seem to be proposing to remove =E2=80=98-D=E2=80=99 altogether. I agre= e 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. Thoughts? Ludo=E2=80=99.