GNU bug report logs - #51427
[PATCH] nix: libstore: Do not remove unused links when deleting specific items.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Keywords: patch; dated Wed, 27 Oct 2021 03:50:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 9 Nov 2021 04:11:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 08 23:11:34 2021
Received: from localhost ([127.0.0.1]:60238 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mkITu-0004ph-5R
	for submit <at> debbugs.gnu.org; Mon, 08 Nov 2021 23:11:34 -0500
Received: from mail-qk1-f182.google.com ([209.85.222.182]:45010)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1mkITs-0004pO-M0
 for 51427 <at> debbugs.gnu.org; Mon, 08 Nov 2021 23:11:33 -0500
Received: by mail-qk1-f182.google.com with SMTP id bj27so16003306qkb.11
 for <51427 <at> debbugs.gnu.org>; Mon, 08 Nov 2021 20:11:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=kLECGrFl2ZF+KKyKoR9Z1g+7lY0MK3HG1Htt0LGjF44=;
 b=jJjWWla3QSN0VxxI2EmfXpc+Sdlk3spcDX6WRhoBWsyDp+KF0e+daCgfFKc96QUmMy
 1GURApm32tSrdLy6Y1UpLeEjBFc8ZO0mG5udqfNgW1IpDDs8plAy/8udffulU35K8fGm
 bVhxBqsw7CClyCUK7bdtS20/kzTN0ryqlpUSbYdxn0zz1vV7SUCM0/1gSmTpblVLUQWz
 Ok6KN80wIM4iqyk+522yUAfm7XaGB68WkAHsTdfi2Pylohus4wFfspEaYO61N/HJ4PdE
 hEw4RfoYA4rbNHctD0V0uul4LUZ0qBXPhkvdsUQpI/GGgLuaSAWMgLKpgwv9G6+xNHko
 YmAQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=kLECGrFl2ZF+KKyKoR9Z1g+7lY0MK3HG1Htt0LGjF44=;
 b=LUVbZhB6e3boLZg+3ayWNf5fiXw45gYCyjN2hMpwXPpFinDX1tb3NoN5nDuHH5+VG+
 ds3AWhCFyIw9g1Oj26hMefeO02fwwH+BRuCIXMO9HO+2ejEtzyhtHsP1n/KR8l4qV/xy
 jGYwSPPHzgMjzbmaQ6IZgy1qPTzZI19ZXkal1BSOSC7w2IyQ1FdhtibcvkKMONQsWnJF
 /nCeqNxxAsIZjZUwy3OyqXcfH24w9Pl+UxzvDtD5IhWPGAjdvMw1MTPLmHjc+OCPEK6l
 lf5w+QFdwyPkYW/xJPdhgER7zXDyOU0Q1EJt8gNDzy94aGIEY5l4cJhneY+vbitG3502
 Npzw==
X-Gm-Message-State: AOAM531DcA1Dh0vFESEaHmIqc+2hcqL71vIxkZQg7wBUwTN1KiVReQGH
 3EqsZA2GGK4svTsWn8FgJa4f5YdseAU6Bg==
X-Google-Smtp-Source: ABdhPJxt6hJIZhrPAeuCxsi2vOtr0t0WV3ZUO4ZdmtozGrzRPf/lzx+vABCcs4j8sDoROTEgfE/ykA==
X-Received: by 2002:a37:b4b:: with SMTP id 72mr3473478qkl.79.1636431086096;
 Mon, 08 Nov 2021 20:11:26 -0800 (PST)
Received: from hurd (dsl-236-125-16.b2b2c.ca. [207.236.125.16])
 by smtp.gmail.com with ESMTPSA id h16sm897497qtx.20.2021.11.08.20.11.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 08 Nov 2021 20:11:25 -0800 (PST)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#51427: [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
 <87o8795j61.fsf@HIDDEN>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@HIDDEN>
 <87h7cxp9tl.fsf@HIDDEN> <87sfwg7w9z.fsf@HIDDEN>
 <87ee7tmdbd.fsf@HIDDEN>
Date: Mon, 08 Nov 2021 23:11:22 -0500
In-Reply-To: <87ee7tmdbd.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Sat, 06 Nov 2021 17:57:58 +0100")
Message-ID: <87k0hi0xzp.fsf@HIDDEN>
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-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hi Maxim and all,
>
> Maxim Cournoyer <maxim.cournoyer@HIDDEN> skribis:
>
>> Ludovic Court=C3=A8s <ludo@HIDDEN> writes:
>
> [...]
>
>>> You seem to be proposing to remove =E2=80=98-D=E2=80=99 altogether.  I =
agree 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 th=
e hash
> of the files being removed, which means reading them=E2=80=A6

Oops :-).

>> 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>.

Seems there's some improvement ready, but which needs more
testing/measurements?  I'd suggest simply invoking GNU sort; if it has
many pages of program for doing what it does, it's probably doing
something fancier/faster than we can (are ready to) emulate -- for free!

> 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 =
than traversing
> all of =E2=80=98.links=E2=80=99) as well as a mapping from store item to =
file hashes.

Hmm.  I'll need to dive in the problem a bit more before I can comment
on this.

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

I erroneously used to think that Btrfs could do live deduplication, but
it doesn't.  There are external tools to do out of band / batch
deduplication though [0]; so if they perform better than the guix daemon's
own dedup, perhaps we could document this way out for our Btrfs users.

[0]  https://btrfs.wiki.kernel.org/index.php/Deduplication

Thank you,

Maxim




Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 6 Nov 2021 16:58:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 06 12:58:10 2021
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 <at> debbugs.gnu.org>)
	id 1mjP18-0001lC-Ep
	for submit <at> 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@HIDDEN>) id 1mjP15-0001ks-Hs
 for 51427 <at> 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@HIDDEN>)
 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@HIDDEN>)
 id 1mjP0y-0007uJ-RE; Sat, 06 Nov 2021 12:58:01 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: bug#51427: [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
 <87o8795j61.fsf@HIDDEN>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@HIDDEN>
 <87h7cxp9tl.fsf@HIDDEN> <87sfwg7w9z.fsf@HIDDEN>
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@HIDDEN> (Maxim Cournoyer's message of "Sun, 31
 Oct 2021 16:51:36 -0400")
Message-ID: <87ee7tmdbd.fsf@HIDDEN>
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-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Maxim and all,

Maxim Cournoyer <maxim.cournoyer@HIDDEN> skribis:

> Ludovic Court=C3=A8s <ludo@HIDDEN> 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.




Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 3 Nov 2021 10:45:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 03 06:45:57 2021
Received: from localhost ([127.0.0.1]:39162 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1miDmH-0001x7-Gv
	for submit <at> debbugs.gnu.org; Wed, 03 Nov 2021 06:45:57 -0400
Received: from mail-qt1-f174.google.com ([209.85.160.174]:39935)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1miDmF-0001wu-IB
 for 51427 <at> debbugs.gnu.org; Wed, 03 Nov 2021 06:45:55 -0400
Received: by mail-qt1-f174.google.com with SMTP id x10so65538qta.6
 for <51427 <at> debbugs.gnu.org>; Wed, 03 Nov 2021 03:45:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc:content-transfer-encoding;
 bh=pbolAUOeDapWsysQBp2EKyUNiY/24M0/tTBAMTPTsYs=;
 b=J1kppa/DVhbUVBLVMIblWces6LQI7etfz78EpPYeN+6gzUjW+KVK0inWialfss70bg
 gHq85ffPgdN2zp0/kf5HV+hkeNXsZK+2pdsX/D/4lI6V4xF1X4YetJlzvGqhEQFQfRqW
 YsqSkTcMSWJYN6j9kw42xs+75ON9F/Xd70Iib9jTuf/yeRnN4B+4KtznpaepWo0ktHck
 mONdHIIvVxchsEWL9aAxksmF2GDYRfWhjbfQjbW/mXO64Mibz0qp7rZTVNKSYR1RvoPL
 04d8F5Sn4td9hDS1rbf1WayHBduB5ynKQdrk1ND/rJLbG+D3/Sia9KqZK5BESEeQ0sx8
 x10A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=pbolAUOeDapWsysQBp2EKyUNiY/24M0/tTBAMTPTsYs=;
 b=ueiSvj4MRrMN0SDZORJDVx6hAk2IWEBdYF0oDFBj3hL2o8IpryXMF4J1VY+DpMkEDz
 gKDzz1bio9dVsEs1i8MP2v+6WPvKIpwbIXPucHDYPE0ilMZX2gvJ0KxdxVoeA8kG5W4T
 sp7/s0pbOj4xHmCyIKs9m5bBXUfzwJ22FdEX0RRUFEBZVLzYQjTmVrpPOFZkl7I/6LAk
 RGSiGbB6qTiNX/8jqZmbUQ+KzFe8CHadbD8NeI1Yan3AZVyQ0i9e4vQNkNAiZIGmyEym
 S5AlECerScHIkl/i/30ufHfAl9I/CGnGklPCinPm5U1BnE+qbO+Frdt3SRCno6eBk1xI
 XS8w==
X-Gm-Message-State: AOAM533Porl6V1KLWZTC1z1disexZzABPofTuOPy6sPuTalVbxW802O6
 EL4SRj7v5nzxPCl15MadFfH/tzYbNVtuZR7gntE=
X-Google-Smtp-Source: ABdhPJy6npCzdgT+H20xxwZkoFxJp5LhysiXgaOvEWq5DbeiAIGPlqPQOyBMzeGKWLLGpfmIwII8JzBQdUchUOpC+8s=
X-Received: by 2002:a05:622a:58e:: with SMTP id
 c14mr41100617qtb.225.1635936349983; 
 Wed, 03 Nov 2021 03:45:49 -0700 (PDT)
MIME-Version: 1.0
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
 <87o8795j61.fsf@HIDDEN>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@HIDDEN>
 <87h7cxp9tl.fsf@HIDDEN> <87sfwg7w9z.fsf@HIDDEN>
In-Reply-To: <87sfwg7w9z.fsf@HIDDEN>
From: zimoun <zimon.toutoune@HIDDEN>
Date: Wed, 3 Nov 2021 11:45:39 +0100
Message-ID: <CAJ3okZ1=0MZpUq7jk3F46mWfikNa1snj+uERXGgVMRWKviSmhA@HIDDEN>
Subject: Re: [bug#51427] [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org, =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>,
 Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

On Sun, 31 Oct 2021 at 21:53, Maxim Cournoyer <maxim.cournoyer@HIDDEN> w=
rote:

> > 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.  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).

I often use "guix gc -D" for being able to launch again a command and
then check against SWH or other upstream.  Because the "deleting
links" is too much long, I am doing ^C at this step.  Therefore, be
able to skip this step when running "guix gc -D" appears to me the
thing to do.  Well, if "guix gc -D" is not doing it, then I am forcing
it by interrupting it; which appears to me worse than status quo.
BTW, if I need space, then I do not use "guix gc -D" on few items but
instead I use the options -F or -d or -C; here I am fine it takes the
time it takes. :-)

Well, =C2=AB"deleting unused links" GC phase is too slow=C2=BB is not new
because it is bug#24937 [1].  Therefore, status quo is really annoying
and I would prefer to skip this GC phase when using option -D although
it is not optimal.  Or remove just the one link that matters.

1: <http://issues.guix.gnu.org/issue/24937>


Cheers,
simon




Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 31 Oct 2021 20:51:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 31 16:51:45 2021
Received: from localhost ([127.0.0.1]:33175 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mhHnt-0003Xw-H4
	for submit <at> debbugs.gnu.org; Sun, 31 Oct 2021 16:51:45 -0400
Received: from mail-qk1-f170.google.com ([209.85.222.170]:33313)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1mhHnr-0003Xh-CH
 for 51427 <at> debbugs.gnu.org; Sun, 31 Oct 2021 16:51:43 -0400
Received: by mail-qk1-f170.google.com with SMTP id a132so13747627qkg.0
 for <51427 <at> debbugs.gnu.org>; Sun, 31 Oct 2021 13:51:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=Ko6H/BV6WE/WlkVC1GO1AiW9LXIPfe5A07BwQ9NXRIE=;
 b=QATU9+qXOR/E20yiHOkIn0t3QCv2cUfYpiRmTr4WAjd+fyhgebK6MRi2x90ycNOeGE
 GvVzOjrT/hivkjEth4UJbqOnIZbmBwjq2SrugHngF0xgI32UNaN4p9Pf8PByHPn1GN7L
 E13rpqiqSEeHDlo7P50mFMaGydgJcCut58Xw69jjaTOz2GXLWwQmTX8prGchXGGZHuzk
 m3p/VfhAkR2wlb2hxoNTKIuaOWUx7SFAXcr2xChHtHVPL+9C/D8J9chrzsnVtjIRdqp5
 VamVl4A0fShRDkFv2N8qD3laBp+q4sa4GJ0Hk+B6NDDZ6baqGoFm1UwwtORQUESLCmxM
 R8dw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=Ko6H/BV6WE/WlkVC1GO1AiW9LXIPfe5A07BwQ9NXRIE=;
 b=er9eHTwmhwgr7Ln6Rz6aRyHocCZ+uMfuPa5kr6ZEzY3bRH7IoS1YPl22aEJcyDkMfV
 v9oGAXkBRAWxsV7aB8F6pQwEyZGRfSd6bJz3Np/pxisrUpb7JL+Xaw7mI+1vP5zUz4xj
 OGthbmz9YR9ZsmcxmbDL67L39uQf/Z6xT9cONG+ReYTmPDUENecWYyKPn1ib8DSRUJgE
 /me3qSKhg6oIgmut53eTR+nCB5juyTy/R8RZ6ZSuF+XwlbhUw/FziTLy2VY8Fd+1AuFN
 mXEoAE/Yc/pm5JkpWtjQtmwALKBgWMI71HtbF0GGpD6GFBniByKPmGBhD9o/BSWfSN4O
 HKnw==
X-Gm-Message-State: AOAM531QKBJkc7ZZuwE0vMmbsOlaeHylo50MS3wpBsTNWMVVtN6VA2m7
 rP6TRmVicm4/JNQA7iValDU2PN+XM6k=
X-Google-Smtp-Source: ABdhPJxb5+AXAuk/CspT199mBdNuTTl2Sh4pIu578vkUnE2uI+oOEDxUgWO9YyD2dMnm8lniO3QbBg==
X-Received: by 2002:a05:620a:178b:: with SMTP id
 ay11mr20500299qkb.287.1635713497455; 
 Sun, 31 Oct 2021 13:51:37 -0700 (PDT)
Received: from hurd (dsl-153-210.b2b2c.ca. [66.158.153.210])
 by smtp.gmail.com with ESMTPSA id e18sm6132720qtw.12.2021.10.31.13.51.36
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 31 Oct 2021 13:51:37 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#51427: [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
 <87o8795j61.fsf@HIDDEN>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@HIDDEN>
 <87h7cxp9tl.fsf@HIDDEN>
Date: Sun, 31 Oct 2021 16:51:36 -0400
In-Reply-To: <87h7cxp9tl.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Sun, 31 Oct 2021 15:07:02 +0100")
Message-ID: <87sfwg7w9z.fsf@HIDDEN>
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-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hi,
>
> Liliana Marie Prikler <liliana.prikler@HIDDEN> skribis:
>
>> Am Donnerstag, den 28.10.2021, 16:16 +0200 schrieb Ludovic Court=C3=A8s:
>>> Hi,
>>>=20
>>> Maxim Cournoyer <maxim.cournoyer@HIDDEN> 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-d=
isk-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.  Fortun=
ately 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 ag=
ree 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.  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).

Thanks,

Maxim




Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 31 Oct 2021 14:39:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 31 10:39:14 2021
Received: from localhost ([127.0.0.1]:32785 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mhBzN-0004b5-Ol
	for submit <at> debbugs.gnu.org; Sun, 31 Oct 2021 10:39:14 -0400
Received: from mail-wr1-f67.google.com ([209.85.221.67]:44808)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1mhBzL-0004at-Tb
 for 51427 <at> debbugs.gnu.org; Sun, 31 Oct 2021 10:39:12 -0400
Received: by mail-wr1-f67.google.com with SMTP id d13so24408018wrf.11
 for <51427 <at> debbugs.gnu.org>; Sun, 31 Oct 2021 07:39:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=message-id:subject:from:to:cc:date:in-reply-to:references
 :user-agent:mime-version:content-transfer-encoding;
 bh=F2Dxl6lA7AbP8VyW0XTsyRAmV50iMNc9ISlG/Fh8gEA=;
 b=LDsR3QEcuOflCoO4xuVmzD/+Ahtwrcamt9Zs0PGegEtGUmmWI0BEgyEvR05ave3uJe
 /ZvEnHoYQC6yhJQYrUapp1ALt1g/6nrpxt6qpjGpi/fP6FTB7tVmChOOlohL5QZtma3o
 2fhnRgmUzkzgSYyC/pl368QS6U6FiW8Z9L9v1VjLaU+WvLaBaykGFxh3ghuFkjLrPxz3
 gakTr8w0FRBUltezkfU+AxdJq8ZuLgj6Onz4YPxn6hqat4ci4WW8m1FKC+O9WbFUkcNH
 u3hFLy9BCCDePSiZrOUqUrEl640Pns60By7EQ6ntFX/tIY/300iVSrJmQ/4eULTvuw3p
 p5ug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to
 :references:user-agent:mime-version:content-transfer-encoding;
 bh=F2Dxl6lA7AbP8VyW0XTsyRAmV50iMNc9ISlG/Fh8gEA=;
 b=s0luqigOGYRwU8NDVfRIp1xx9F3OVpqv+0UG4O8Jml7EDnCuJEChxUb8LBhLI4gUD6
 phw3+LolXCqQdxWWvrgmbRwLDkdgGGNXRizxI+m/W1UhATITi5wUe4Nj7ThBQZCpT04d
 H4D4VHYjgYe7CaOBqBallR0dDxZcZnDPhQjV9GkN49D+PQX+TjJ+W/FWmjiirVBVUMu2
 s8rWjwTZN0I6Lg/8Kn7ideVRdvzZscwcsXj6rJZndaXHvYzHyclFUDdg+FrMctfuSg5x
 CUemvG8RUn7oU+DT3oMOZTh3NTmWbgDpHi+p592ao6I66WZ0ytkzluwuSZ/N7WcYCibN
 fY4Q==
X-Gm-Message-State: AOAM530ut9XM/SSSfUx1zWw1pY4IJIsWr+xasTZewYExvOP+8eyyIHRV
 KPXtUW0hemxOAi0II/T0Zhg=
X-Google-Smtp-Source: ABdhPJyGMjbXEhmUBYyGWO76D4vLcyxVOiaJ2xVF9qKvzg6bOoS12ja2bPxlolH+uUep2zakh+Unaw==
X-Received: by 2002:adf:9bdb:: with SMTP id e27mr28279411wrc.417.1635691146044; 
 Sun, 31 Oct 2021 07:39:06 -0700 (PDT)
Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at.
 [85.127.52.93])
 by smtp.gmail.com with ESMTPSA id y6sm11372365wrh.18.2021.10.31.07.39.05
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 31 Oct 2021 07:39:05 -0700 (PDT)
Message-ID: <9f9a708f8ecbb49464e3d939be89638a53dc0d30.camel@HIDDEN>
Subject: Re: bug#51427: [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>
Date: Sun, 31 Oct 2021 15:39:04 +0100
In-Reply-To: <87h7cxp9tl.fsf@HIDDEN>
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
 <87o8795j61.fsf@HIDDEN>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@HIDDEN>
 <87h7cxp9tl.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Am Sonntag, den 31.10.2021, 15:07 +0100 schrieb Ludovic Courtès:
> What do you mean?  When doing VM testing, I regularly do ‘guix gc -D
> /gnu/store/…-disk-image’ precisely to save space.  Fortunately it
> does have the intended effect of freeing a bunch of GiBs.
Fair enough, different strokes and all.

> > 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’s annoying, but it’s 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 ‘-D’ altogether.  
I wrote no such thing.  Obviously there needs to be a way of removing
single items from the store, but what else to do is not so clear.  It
is only obvious that traversing all of .links is too expensive.

> I agree it has the shortcomings you write, but I think it’s
> occasionally useful nonetheless.
> 
> My proposal would be either the status quo, or removing just the one
> link that matters from /gnu/store/.links upon ‘-D’.
> 
> Thoughts?
There isn't "just the one link that matters" when it comes to removing
multiple items -- heck, even if tasked to free up just 5MB rather than
all of the garbage, traversing all .links is probably too expensive.

Accepting that we might want to always delete links at the end, I think
`guix gc' needs a way to record which links had their count go to 1
during garbage deletion, so that when it comes to deleting links only
those are tried (and of course checked again to make sure their count
is indeed still 1).  This should be the preferred mode if less than
some arbitrary large number of store items are affected (let's say 1024
or some multiple of it) or a total cleaning of .links has been forced.

Though perhaps there's a way to do this without manual recording. 
Let's say we notice a link count going to one as we clear the trash. 
We could just add the link behind it to the trash right away to ensure
that it is not reused by something else and then clean the trash a
second time (we would have to check for potential race conditions in
this case).

WDYT?

Liliana





Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 31 Oct 2021 14:07:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 31 10:07:11 2021
Received: from localhost ([127.0.0.1]:60970 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mhBUN-0001bg-H9
	for submit <at> 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 <ludo@HIDDEN>) id 1mhBUM-0001bT-25
 for 51427 <at> 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 <ludo@HIDDEN>)
 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 <ludo@HIDDEN>)
 id 1mhBUF-0007JE-Km; Sun, 31 Oct 2021 10:07:03 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Liliana Marie Prikler <liliana.prikler@HIDDEN>
Subject: Re: bug#51427: [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
 <87o8795j61.fsf@HIDDEN>
 <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@HIDDEN>
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@HIDDEN>
 (Liliana Marie Prikler's message of "Sun, 31 Oct 2021 09:50:15 +0100")
Message-ID: <87h7cxp9tl.fsf@HIDDEN>
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-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org, Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Liliana Marie Prikler <liliana.prikler@HIDDEN> skribis:

> Am Donnerstag, den 28.10.2021, 16:16 +0200 schrieb Ludovic Court=C3=A8s:
>> Hi,
>>=20
>> Maxim Cournoyer <maxim.cournoyer@HIDDEN> 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.




Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 31 Oct 2021 08:50:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 31 04:50:25 2021
Received: from localhost ([127.0.0.1]:58941 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mh6Xp-0007lu-7p
	for submit <at> debbugs.gnu.org; Sun, 31 Oct 2021 04:50:25 -0400
Received: from mail-wr1-f67.google.com ([209.85.221.67]:35782)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <liliana.prikler@HIDDEN>) id 1mh6Xm-0007le-VR
 for 51427 <at> debbugs.gnu.org; Sun, 31 Oct 2021 04:50:23 -0400
Received: by mail-wr1-f67.google.com with SMTP id i5so15944787wrb.2
 for <51427 <at> debbugs.gnu.org>; Sun, 31 Oct 2021 01:50:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=message-id:subject:from:to:cc:date:in-reply-to:references
 :user-agent:mime-version:content-transfer-encoding;
 bh=x6DMZ0vYqLdsWqSNytgshtEZMdz0DaxdFAkpwKVaiTs=;
 b=RQCuHlPRDBw48s79kjeS62/4AE3h2Q0rqc5cebuEA8/pEcN40jahX+5cJ/mlZNtkFY
 BFjLXC2aF+UzDhPVNnfpzeZ0AHwG/Pp5Cp1+ActnkaED4aApny81rSKNAcyYsItGd+H4
 mtmAMjzsdkiaACIaIBiu4l2oBC+cOEsiU3ZIsCJYHOyOYi0KRQKvX10BTm6B2p+fviQ6
 bGKnIgne1z9LrZaA+pzvif2kVG3LUQvWVPMgCkelPecZdyOVAOkWvwZKuJc09+/AT+Zs
 emzlQ7+uO8betxayIInUoosuRSfHiphtoaKQSh9YJkw3pLvWhFwEFMqATzeJlP+Ion/q
 0M2A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to
 :references:user-agent:mime-version:content-transfer-encoding;
 bh=x6DMZ0vYqLdsWqSNytgshtEZMdz0DaxdFAkpwKVaiTs=;
 b=nrwT8eMhYrwgf5WITKqYSAgxKTTi+kA3/mWCUOqbtNhiRowAb7MS3bxJktM0dly0ZX
 kvu5rfl98lBaA7FEgiePLUnTFCj47YTaYopAN8Us5S5dEEgGn/0MCT3vVW/EPpnuxgym
 EVbO5Hrz0DS5y1IbrI7WCtYjgx793p4rrxnmFKWrqDDmnX+x1BMAjKg40QZyo3R1E72q
 ihnAW+/PBVCEhlYtepHpd6EMaxwR1iyQJoo5loJPaFgIC+oNxWim/FkSUUoo+GCWjBSp
 PMgXXL2e0BmBo17425Q57gRlgFlZcKOxJeDaVuMO/8m9eF1Mu2jKvcHN/OnFW5W1O+Ie
 ZPOA==
X-Gm-Message-State: AOAM533qKTY+dKBVcDX6QVhTusAxMEWz1uMRznD/XHeXxv2ri4DufV7J
 ZM829IsDDB6awEcgR5I+34c=
X-Google-Smtp-Source: ABdhPJywHONltLbg5zbHgqBjRVMh29TqGskGxaJMglftCOnQTmjuiqA+5J0DFYUefv2+VbPdGW/Cqw==
X-Received: by 2002:adf:a30c:: with SMTP id c12mr29310988wrb.366.1635670216941; 
 Sun, 31 Oct 2021 01:50:16 -0700 (PDT)
Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at.
 [85.127.52.93])
 by smtp.gmail.com with ESMTPSA id v4sm10310463wrs.86.2021.10.31.01.50.16
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 31 Oct 2021 01:50:16 -0700 (PDT)
Message-ID: <5c2dd60acfaa7d74b7554babb3e223bc855bac8a.camel@HIDDEN>
Subject: Re: bug#51427: [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Ludovic =?ISO-8859-1?Q?Court=E8s?= <ludo@HIDDEN>, Maxim Cournoyer
 <maxim.cournoyer@HIDDEN>
Date: Sun, 31 Oct 2021 09:50:15 +0100
In-Reply-To: <87o8795j61.fsf@HIDDEN>
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
 <87o8795j61.fsf@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Am Donnerstag, den 28.10.2021, 16:16 +0200 schrieb Ludovic Courtès:
> Hi,
> 
> Maxim Cournoyer <maxim.cournoyer@HIDDEN> skribis:
> 
> > 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.
> > 
> > * 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(-)
> > 
> > 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);
> >  
> >      /* Clean up the links directory. */
> > -    if (options.action == GCOptions::gcDeleteDead ||
> > options.action == GCOptions::gcDeleteSpecific) {
> > +    if (options.action == GCOptions::gcDeleteDead) {
> 
> I believe the effect is that ‘guix gc -D /gnu/store/…-disk-image’
> would remove nothing: /gnu/store/.links would still contain a copy of
> that big disk image, so as a result, you’ve freed zero bytes.
> 
> 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.  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.

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. ...

WDYT?





Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at 51427 <at> debbugs.gnu.org:


Received: (at 51427) by debbugs.gnu.org; 28 Oct 2021 14:16:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 28 10:16:33 2021
Received: from localhost ([127.0.0.1]:52878 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mg6Cm-0002Ju-Vj
	for submit <at> debbugs.gnu.org; Thu, 28 Oct 2021 10:16:33 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57746)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1mg6Cl-0002Jh-Hr
 for 51427 <at> debbugs.gnu.org; Thu, 28 Oct 2021 10:16:32 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:51254)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1mg6Cf-0003K0-VJ; Thu, 28 Oct 2021 10:16:26 -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=kw7IzbQ1HNvuYJ5k6sz5WTp6sxI5tcSt0+Cm6WlRw7Y=; b=rIbUGGqlIOonBDinCxCS
 aowVF0+8VA+W0bVwX+moS9D/UfshnucOMEA+M6S6y2EtyRzOD5TVCduQ3kAsWy2HahgnydIktnJ7/
 VAcDMWY919yJ3XfPKQG1baTiB+SRumeI5sDb8btrfQnCsT+pHSNt+Eu32SqrkbawLuh8xND/N+xYF
 /d32cEUKJFAUrDXlItwu3fdOgqdcvC1MOCgOZtwUDeIh9bCpADhxmPel4wv9vbfoqswLDmMMZbLxR
 OY058EXoVK1K7rmu1PEsIInAGQ6hSl+vtR6crLrsJW9iqCYtDNZGvOBtnja1cxGG/Gr+jrV8lmSsu
 4SKcJTq6sVFcOQ==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:54824
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1mg6Cf-0006k0-8y; Thu, 28 Oct 2021 10:16:25 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: bug#51427: [PATCH] nix: libstore: Do not remove unused links
 when deleting specific items.
References: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
Date: Thu, 28 Oct 2021 16:16:22 +0200
In-Reply-To: <20211027034918.4591-1-maxim.cournoyer@HIDDEN> (Maxim
 Cournoyer's message of "Tue, 26 Oct 2021 23:49:18 -0400")
Message-ID: <87o8795j61.fsf@HIDDEN>
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-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 51427
Cc: 51427 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Maxim Cournoyer <maxim.cournoyer@HIDDEN> skribis:

> Deleting unused links can be a very costly operation, especially on rotat=
ive
> hard drives.  As removing single store items is often used for experiment=
ation
> rather than for cleaning purposes, this change allows it to run without t=
he
> links cleanup.
>
> * 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(-)
>
> 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 & opt=
ions, 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) {

I believe the effect is that =E2=80=98guix gc -D /gnu/store/=E2=80=A6-disk-=
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.

Am I right?

Perhaps what we could do is, upon =E2=80=98gcDeleteSpecific=E2=80=99, only =
look at the
relevant entry in .links instead of traversing all of them.

WDYT?

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Oct 2021 03:49:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 26 23:49:36 2021
Received: from localhost ([127.0.0.1]:48053 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mfZwW-0003FF-8W
	for submit <at> debbugs.gnu.org; Tue, 26 Oct 2021 23:49:36 -0400
Received: from lists.gnu.org ([209.51.188.17]:45178)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1mfZwU-0003F5-7K
 for submit <at> debbugs.gnu.org; Tue, 26 Oct 2021 23:49:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40372)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1mfZwT-0005tm-Vi
 for guix-patches@HIDDEN; Tue, 26 Oct 2021 23:49:33 -0400
Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]:36748)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1mfZwQ-0004tn-9B
 for guix-patches@HIDDEN; Tue, 26 Oct 2021 23:49:32 -0400
Received: by mail-qv1-xf2b.google.com with SMTP id d6so969218qvb.3
 for <guix-patches@HIDDEN>; Tue, 26 Oct 2021 20:49:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=USc2GRKlyZftlRGTlOFFKvKPqCXluZ/pmB5TfjQX7WE=;
 b=bCDR8WY99Pou8uT3lDKvjBN5u/6W4B3lk4G7ZlbYFqBexSkLpEeXC6KRk21Aq7kSPd
 PtCwgAU4m+YWqbyL6xqwaamG9eabHAJjiWLWlZ8SlO+UopxijpvuVEvVrfMxbQ62ciaP
 d4iERC6+DJ9eynJeKukWD/WKN+htz67CdkBgbY753KdKtL60F8EuC5gkayUxa+KgTJq5
 fsbq9ZQV94Csyn9mHjUicV3DWNe0jk/W9IfmyTsmX3mRj13WkWOfUVWmPzT+ONWDHhQn
 qt483AKIEoSrog5L/WtwaY592ULL5oqhVn5xXyiae0genWL12kgqYIxHjLELTGx5c+1e
 JRGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=USc2GRKlyZftlRGTlOFFKvKPqCXluZ/pmB5TfjQX7WE=;
 b=IZKDac5J/NNhQjbFMQrxCj9ykKxlfr2mMtyBQ1UumXb7aZ40iv/+/T17oQdO4OvIqx
 /cX0K9vUBnGBRbExdNr77e9lDGnNvuiKhYZAZZHQD0TxJCelDDNGPmOs7UF3y+iewPzY
 Imn70GlLLklCqLWTS9JjK1fJDHsIfQcu5qk++UXqr0hhr9HmTlzKKBd1d4dL3WtwnhtX
 e4JOSgKhRfpEO05haQlgSiwy1gNyk0u24L0hM1IRfjiWxeh1xKBX5ByP7/WkSrQlCWWw
 gCVKWKOhXEjOX/DhMb7VqRR58jkZ869lTzk2G4KUgCne5ItvuMECls+EXAtyJvj7mhqN
 bt2w==
X-Gm-Message-State: AOAM533UnQGt6thXSrBRj+Q6po16cQTj+9QYMZmKQPQgRMret+ouQnoY
 DOR7KMe5nQaye9fFAjYfX1d0yzeZvOk=
X-Google-Smtp-Source: ABdhPJxeScrHBJgPbN4GobvrNZtvlJjPcqjZBcaqt4818K90bM6ysGTOUp9xZZ6v+a1P3arUXZZAtg==
X-Received: by 2002:a05:6214:80f:: with SMTP id
 df15mr4159708qvb.37.1635306568933; 
 Tue, 26 Oct 2021 20:49:28 -0700 (PDT)
Received: from localhost.localdomain (dsl-10-133-98.b2b2c.ca. [72.10.133.98])
 by smtp.gmail.com with ESMTPSA id
 e4sm12715171qty.59.2021.10.26.20.49.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 26 Oct 2021 20:49:28 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] nix: libstore: Do not remove unused links when deleting
 specific items.
Date: Tue, 26 Oct 2021 23:49:18 -0400
Message-Id: <20211027034918.4591-1-maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.33.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::f2b;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-qv1-xf2b.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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.

* 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(-)

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);
 
     /* Clean up the links directory. */
-    if (options.action == GCOptions::gcDeleteDead || options.action == GCOptions::gcDeleteSpecific) {
+    if (options.action == GCOptions::gcDeleteDead) {
         printMsg(lvlError, format("deleting unused links..."));
         removeUnusedLinks(state);
     }
-- 
2.33.1





Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#51427; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 9 Nov 2021 04:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.