Package: guix-patches;
Reported by: Efraim Flashner <efraim <at> flashner.co.il>
Date: Wed, 19 Oct 2022 09:31:02 UTC
Severity: normal
Tags: patch
Done: Efraim Flashner <efraim <at> flashner.co.il>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58624 in the body.
You can then email your comments to 58624 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
guix-patches <at> gnu.org
:bug#58624
; Package guix-patches
.
(Wed, 19 Oct 2022 09:31:02 GMT) Full text and rfc822 format available.Efraim Flashner <efraim <at> flashner.co.il>
:guix-patches <at> gnu.org
.
(Wed, 19 Oct 2022 09:31:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Efraim Flashner <efraim <at> flashner.co.il> To: guix-patches <at> gnu.org Cc: Efraim Flashner <efraim <at> flashner.co.il> Subject: [PATCH] guix gc: Add '--vacuum-store'. Date: Wed, 19 Oct 2022 12:26:20 +0300
* guix/scripts/gc.scm (show-help, %options): Add '--vacuum-store'. * guix/store/database.scm (vacuum-database): New procedure. * doc/guix.texi (Invoking guix gc): Document the option. --- doc/guix.texi | 11 +++++++++++ guix/scripts/gc.scm | 11 +++++++++++ guix/store/database.scm | 9 ++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3bf2dee752..89fd04415a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4531,6 +4531,17 @@ Invoking guix gc this option is primarily useful when the daemon was running with @option{--disable-deduplication}. +@item --vacuum-store +@cindex vacuum the store database +@comment Avoid words like 'repair,' 'compress,' and 'optimize.' +Guix uses an sqlite database to keep track of the items in (@pxref{The Store}). +Overtime it is possible that the database may grow to a large size and become +fragmented. As a result, one may wish to clear the freed space and join the +partially used pages in the database left behind from removed packages or after +running the garbage collector. Running @command{sudo guix gc --vacuum-store} +will lock the database and @code{VACUUM} the store, defragmenting the database +and purging freed pages, unlocking the database when it finishes.. + @end table @node Invoking guix pull diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 65cd4bdf8b..5e775c5cdb 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012-2013, 2015-2020, 2022 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> ;;; ;;; This file is part of GNU Guix. ;;; @@ -27,6 +28,7 @@ (define-module (guix scripts gc) generation-number) #:autoload (guix scripts package) (delete-generations) #:autoload (gnu home) (home-generation-base) + #:autoload (guix store database) (vacuum-database) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) @@ -86,6 +88,10 @@ (define (show-help) (display (G_ " --clear-failures remove PATHS from the set of cached failures")) (newline) + (display (G_ " + --vacuum-database repack the sqlite database tracking the store + using less space")) + (newline) (display (G_ " -h, --help display this help and exit")) (display (G_ " @@ -131,6 +137,11 @@ (define %options (lambda args (show-version-and-exit "guix gc"))) + (option '("vacuum-database") #f #f + (lambda args + (vacuum-database) + (exit 0))) + (option '(#\C "collect-garbage") #f #t (lambda (opt name arg result) (let ((result (alist-cons 'action 'collect-garbage diff --git a/guix/store/database.scm b/guix/store/database.scm index 8d08def833..e664015673 100644 --- a/guix/store/database.scm +++ b/guix/store/database.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017, 2019 Caleb Ristvedt <caleb.ristvedt <at> cune.org> ;;; Copyright © 2018, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> ;;; ;;; This file is part of GNU Guix. ;;; @@ -45,7 +46,8 @@ (define-module (guix store database) sqlite-register register-items %epoch - reset-timestamps)) + reset-timestamps + vacuum-database)) ;;; Code for working with the store database directly. @@ -438,3 +440,8 @@ (define* (register-items db items (register db item) (report)) items))))) + +(define (vacuum-database) + (let ((db (sqlite-open (store-database-file)))) + (sqlite-exec db "VACUUM;") + (sqlite-close db))) base-commit: 3bb145b6e2a8c84e7739ead9ae76dc4d42bb9850 -- 2.38.0
guix-patches <at> gnu.org
:bug#58624
; Package guix-patches
.
(Thu, 20 Oct 2022 18:52:01 GMT) Full text and rfc822 format available.Message #8 received at 58624 <at> debbugs.gnu.org (full text, mbox):
From: Liliana Marie Prikler <liliana.prikler <at> gmail.com> To: Efraim Flashner <efraim <at> flashner.co.il>, 58624 <at> debbugs.gnu.org Subject: Re: [PATCH] guix gc: Add '--vacuum-store'. Date: Thu, 20 Oct 2022 20:51:04 +0200
Am Mittwoch, dem 19.10.2022 um 12:26 +0300 schrieb Efraim Flashner: > * guix/scripts/gc.scm (show-help, %options): Add '--vacuum-store'. > * guix/store/database.scm (vacuum-database): New procedure. > * doc/guix.texi (Invoking guix gc): Document the option. > --- > doc/guix.texi | 11 +++++++++++ > guix/scripts/gc.scm | 11 +++++++++++ > guix/store/database.scm | 9 ++++++++- > 3 files changed, 30 insertions(+), 1 deletion(-) > > diff --git a/doc/guix.texi b/doc/guix.texi > index 3bf2dee752..89fd04415a 100644 > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -4531,6 +4531,17 @@ Invoking guix gc > this option is primarily useful when the daemon was running with > @option{--disable-deduplication}. > > +@item --vacuum-store > +@cindex vacuum the store database > +@comment Avoid words like 'repair,' 'compress,' and 'optimize.' > +Guix uses an sqlite database to keep track of the items in > (@pxref{The Store}). > +Overtime it is possible that the database may grow to a large size > and become > +fragmented. As a result, one may wish to clear the freed space and > join the > +partially used pages in the database left behind from removed > packages or after > +running the garbage collector. Running @command{sudo guix gc -- > vacuum-store} > +will lock the database and @code{VACUUM} the store, defragmenting > the database > +and purging freed pages, unlocking the database when it finishes.. You're using vacuum-store here... > @end table > > @node Invoking guix pull > diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm > index 65cd4bdf8b..5e775c5cdb 100644 > --- a/guix/scripts/gc.scm > +++ b/guix/scripts/gc.scm > @@ -1,5 +1,6 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2012-2013, 2015-2020, 2022 Ludovic Courtès > <ludo <at> gnu.org> > +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -27,6 +28,7 @@ (define-module (guix scripts gc) > generation-number) > #:autoload (guix scripts package) (delete-generations) > #:autoload (gnu home) (home-generation-base) > + #:autoload (guix store database) (vacuum-database) > #:use-module (ice-9 match) > #:use-module (ice-9 regex) > #:use-module (srfi srfi-1) > @@ -86,6 +88,10 @@ (define (show-help) > (display (G_ " > --clear-failures remove PATHS from the set of cached > failures")) > (newline) > + (display (G_ " > + --vacuum-database repack the sqlite database tracking the > store > + using less space")) > + (newline) > (display (G_ " > -h, --help display this help and exit")) > (display (G_ " > @@ -131,6 +137,11 @@ (define %options > (lambda args > (show-version-and-exit "guix gc"))) > > + (option '("vacuum-database") #f #f > + (lambda args > + (vacuum-database) > + (exit 0))) > + > (option '(#\C "collect-garbage") #f #t > (lambda (opt name arg result) > (let ((result (alist-cons 'action 'collect-garbage > diff --git a/guix/store/database.scm b/guix/store/database.scm > index 8d08def833..e664015673 100644 > --- a/guix/store/database.scm > +++ b/guix/store/database.scm > @@ -2,6 +2,7 @@ > ;;; Copyright © 2017, 2019 Caleb Ristvedt <caleb.ristvedt <at> cune.org> > ;;; Copyright © 2018, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org> > ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> > +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -45,7 +46,8 @@ (define-module (guix store database) > sqlite-register > register-items > %epoch > - reset-timestamps)) > + reset-timestamps > + vacuum-database)) > > ;;; Code for working with the store database directly. > > @@ -438,3 +440,8 @@ (define* (register-items db items > (register db item) > (report)) > items))))) > + > +(define (vacuum-database) > + (let ((db (sqlite-open (store-database-file)))) > + (sqlite-exec db "VACUUM;") > + (sqlite-close db))) ... but vacuum-database here. Since the database is just a part of the store, I think making it "vacuum-database" everywhere ought to make it both more consistent and more correct. Cheers
guix-patches <at> gnu.org
:bug#58624
; Package guix-patches
.
(Thu, 20 Oct 2022 19:24:02 GMT) Full text and rfc822 format available.Message #11 received at 58624 <at> debbugs.gnu.org (full text, mbox):
From: Efraim Flashner <efraim <at> flashner.co.il> To: Liliana Marie Prikler <liliana.prikler <at> gmail.com> Cc: 58624 <at> debbugs.gnu.org Subject: Re: [PATCH] guix gc: Add '--vacuum-store'. Date: Thu, 20 Oct 2022 22:22:52 +0300
[Message part 1 (text/plain, inline)]
On Thu, Oct 20, 2022 at 08:51:04PM +0200, Liliana Marie Prikler wrote: > Am Mittwoch, dem 19.10.2022 um 12:26 +0300 schrieb Efraim Flashner: > > * guix/scripts/gc.scm (show-help, %options): Add '--vacuum-store'. > > * guix/store/database.scm (vacuum-database): New procedure. > > * doc/guix.texi (Invoking guix gc): Document the option. > > --- > > doc/guix.texi | 11 +++++++++++ > > guix/scripts/gc.scm | 11 +++++++++++ > > guix/store/database.scm | 9 ++++++++- > > 3 files changed, 30 insertions(+), 1 deletion(-) > > > > diff --git a/doc/guix.texi b/doc/guix.texi > > index 3bf2dee752..89fd04415a 100644 > > --- a/doc/guix.texi > > +++ b/doc/guix.texi > > @@ -4531,6 +4531,17 @@ Invoking guix gc > > this option is primarily useful when the daemon was running with > > @option{--disable-deduplication}. > > > > +@item --vacuum-store > > +@cindex vacuum the store database > > +@comment Avoid words like 'repair,' 'compress,' and 'optimize.' > > +Guix uses an sqlite database to keep track of the items in > > (@pxref{The Store}). > > +Overtime it is possible that the database may grow to a large size > > and become > > +fragmented. As a result, one may wish to clear the freed space and > > join the > > +partially used pages in the database left behind from removed > > packages or after > > +running the garbage collector. Running @command{sudo guix gc -- > > vacuum-store} > > +will lock the database and @code{VACUUM} the store, defragmenting > > the database > > +and purging freed pages, unlocking the database when it finishes.. > You're using vacuum-store here... > > > @end table > > > > @node Invoking guix pull > > diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm > > index 65cd4bdf8b..5e775c5cdb 100644 > > --- a/guix/scripts/gc.scm > > +++ b/guix/scripts/gc.scm > > @@ -1,5 +1,6 @@ > > ;;; GNU Guix --- Functional package management for GNU > > ;;; Copyright © 2012-2013, 2015-2020, 2022 Ludovic Courtès > > <ludo <at> gnu.org> > > +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> > > ;;; > > ;;; This file is part of GNU Guix. > > ;;; > > @@ -27,6 +28,7 @@ (define-module (guix scripts gc) > > generation-number) > > #:autoload (guix scripts package) (delete-generations) > > #:autoload (gnu home) (home-generation-base) > > + #:autoload (guix store database) (vacuum-database) > > #:use-module (ice-9 match) > > #:use-module (ice-9 regex) > > #:use-module (srfi srfi-1) > > @@ -86,6 +88,10 @@ (define (show-help) > > (display (G_ " > > --clear-failures remove PATHS from the set of cached > > failures")) > > (newline) > > + (display (G_ " > > + --vacuum-database repack the sqlite database tracking the > > store > > + using less space")) > > + (newline) > > (display (G_ " > > -h, --help display this help and exit")) > > (display (G_ " > > @@ -131,6 +137,11 @@ (define %options > > (lambda args > > (show-version-and-exit "guix gc"))) > > > > + (option '("vacuum-database") #f #f > > + (lambda args > > + (vacuum-database) > > + (exit 0))) > > + > > (option '(#\C "collect-garbage") #f #t > > (lambda (opt name arg result) > > (let ((result (alist-cons 'action 'collect-garbage > > diff --git a/guix/store/database.scm b/guix/store/database.scm > > index 8d08def833..e664015673 100644 > > --- a/guix/store/database.scm > > +++ b/guix/store/database.scm > > @@ -2,6 +2,7 @@ > > ;;; Copyright © 2017, 2019 Caleb Ristvedt <caleb.ristvedt <at> cune.org> > > ;;; Copyright © 2018, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org> > > ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> > > +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> > > ;;; > > ;;; This file is part of GNU Guix. > > ;;; > > @@ -45,7 +46,8 @@ (define-module (guix store database) > > sqlite-register > > register-items > > %epoch > > - reset-timestamps)) > > + reset-timestamps > > + vacuum-database)) > > > > ;;; Code for working with the store database directly. > > > > @@ -438,3 +440,8 @@ (define* (register-items db items > > (register db item) > > (report)) > > items))))) > > + > > +(define (vacuum-database) > > + (let ((db (sqlite-open (store-database-file)))) > > + (sqlite-exec db "VACUUM;") > > + (sqlite-close db))) > ... but vacuum-database here. > > Since the database is just a part of the store, I think making it > "vacuum-database" everywhere ought to make it both more consistent and > more correct. Agreed. I even made sure it was --vacuum-database in the help menu from 'guix gc --help'. Truth is I wrote the code and then the next day I wrote the documentation, so figures I would document it wrong ... -- Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#58624
; Package guix-patches
.
(Thu, 20 Oct 2022 19:29:02 GMT) Full text and rfc822 format available.Message #14 received at 58624 <at> debbugs.gnu.org (full text, mbox):
From: Efraim Flashner <efraim <at> flashner.co.il> To: 58624 <at> debbugs.gnu.org Cc: Efraim Flashner <efraim <at> flashner.co.il> Subject: [PATCH v2] guix gc: Add '--vacuum-database'. Date: Thu, 20 Oct 2022 22:27:53 +0300
* guix/scripts/gc.scm (show-help, %options): Add '--vacuum-database'. * guix/store/database.scm (vacuum-database): New procedure. * doc/guix.texi (Invoking guix gc): Document the option. --- doc/guix.texi | 12 ++++++++++++ guix/scripts/gc.scm | 11 +++++++++++ guix/store/database.scm | 9 ++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index fd8b19fe46..1c13480cbc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4531,6 +4531,18 @@ Invoking guix gc this option is primarily useful when the daemon was running with @option{--disable-deduplication}. +@item --vacuum-database +@cindex vacuum the store database +@comment Avoid words like 'repair,' 'compress,' and 'optimize.' +Guix uses an sqlite database to keep track of the items in (@pxref{The Store}). +Overtime it is possible that the database may grow to a large size and become +fragmented. As a result, one may wish to clear the freed space and join the +partially used pages in the database left behind from removed packages or after +running the garbage collector. Running @command{sudo guix gc +--vacuum-database} will lock the database and @code{VACUUM} the store, +defragmenting the database and purging freed pages, unlocking the database when +it finishes.. + @end table @node Invoking guix pull diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 65cd4bdf8b..5e775c5cdb 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012-2013, 2015-2020, 2022 Ludovic Courtès <ludo <at> gnu.org> +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> ;;; ;;; This file is part of GNU Guix. ;;; @@ -27,6 +28,7 @@ (define-module (guix scripts gc) generation-number) #:autoload (guix scripts package) (delete-generations) #:autoload (gnu home) (home-generation-base) + #:autoload (guix store database) (vacuum-database) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) @@ -86,6 +88,10 @@ (define (show-help) (display (G_ " --clear-failures remove PATHS from the set of cached failures")) (newline) + (display (G_ " + --vacuum-database repack the sqlite database tracking the store + using less space")) + (newline) (display (G_ " -h, --help display this help and exit")) (display (G_ " @@ -131,6 +137,11 @@ (define %options (lambda args (show-version-and-exit "guix gc"))) + (option '("vacuum-database") #f #f + (lambda args + (vacuum-database) + (exit 0))) + (option '(#\C "collect-garbage") #f #t (lambda (opt name arg result) (let ((result (alist-cons 'action 'collect-garbage diff --git a/guix/store/database.scm b/guix/store/database.scm index 8d08def833..e664015673 100644 --- a/guix/store/database.scm +++ b/guix/store/database.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2017, 2019 Caleb Ristvedt <caleb.ristvedt <at> cune.org> ;;; Copyright © 2018, 2020, 2021 Ludovic Courtès <ludo <at> gnu.org> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke <at> gnu.org> +;;; Copyright © 2022 Efraim Flashner <efraim <at> flashner.co.il> ;;; ;;; This file is part of GNU Guix. ;;; @@ -45,7 +46,8 @@ (define-module (guix store database) sqlite-register register-items %epoch - reset-timestamps)) + reset-timestamps + vacuum-database)) ;;; Code for working with the store database directly. @@ -438,3 +440,8 @@ (define* (register-items db items (register db item) (report)) items))))) + +(define (vacuum-database) + (let ((db (sqlite-open (store-database-file)))) + (sqlite-exec db "VACUUM;") + (sqlite-close db))) base-commit: 00ff6f7c399670a76efffb91276dea2633cc130c -- 2.38.0
guix-patches <at> gnu.org
:bug#58624
; Package guix-patches
.
(Thu, 03 Nov 2022 16:21:01 GMT) Full text and rfc822 format available.Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Christopher Baines <mail <at> cbaines.net> To: Efraim Flashner <efraim <at> flashner.co.il> Cc: 58624 <at> debbugs.gnu.org, guix-patches <at> gnu.org Subject: Re: [bug#58624] [PATCH v2] guix gc: Add '--vacuum-database'. Date: Thu, 03 Nov 2022 17:20:24 +0100
[Message part 1 (text/plain, inline)]
Efraim Flashner <efraim <at> flashner.co.il> writes: > * guix/scripts/gc.scm (show-help, %options): Add '--vacuum-database'. > * guix/store/database.scm (vacuum-database): New procedure. > * doc/guix.texi (Invoking guix gc): Document the option. > --- > doc/guix.texi | 12 ++++++++++++ > guix/scripts/gc.scm | 11 +++++++++++ > guix/store/database.scm | 9 ++++++++- > 3 files changed, 31 insertions(+), 1 deletion(-) I haven't tried this out, but it sounds good to me +1. Chris
[signature.asc (application/pgp-signature, inline)]
guix-patches <at> gnu.org
:bug#58624
; Package guix-patches
.
(Thu, 03 Nov 2022 16:21:02 GMT) Full text and rfc822 format available.Efraim Flashner <efraim <at> flashner.co.il>
:Efraim Flashner <efraim <at> flashner.co.il>
:Message #25 received at 58624-done <at> debbugs.gnu.org (full text, mbox):
From: Efraim Flashner <efraim <at> flashner.co.il> To: Christopher Baines <mail <at> cbaines.net> Cc: 58624-done <at> debbugs.gnu.org Subject: Re: [bug#58624] [PATCH v2] guix gc: Add '--vacuum-database'. Date: Sun, 6 Nov 2022 14:04:14 +0200
[Message part 1 (text/plain, inline)]
On Thu, Nov 03, 2022 at 05:20:24PM +0100, Christopher Baines wrote: > > Efraim Flashner <efraim <at> flashner.co.il> writes: > > > * guix/scripts/gc.scm (show-help, %options): Add '--vacuum-database'. > > * guix/store/database.scm (vacuum-database): New procedure. > > * doc/guix.texi (Invoking guix gc): Document the option. > > --- > > doc/guix.texi | 12 ++++++++++++ > > guix/scripts/gc.scm | 11 +++++++++++ > > guix/store/database.scm | 9 ++++++++- > > 3 files changed, 31 insertions(+), 1 deletion(-) > > I haven't tried this out, but it sounds good to me +1. Thanks. In the documentation I used overtime vs 'over time' and I had a double period at the end of the last sentence, which I cleaned up before pushing. -- Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2022 12:24:04 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.