summaryrefslogtreecommitdiff
path: root/guix/store/database.scm
AgeCommit message (Collapse)Author
2020-04-11database: 'reset-timestamps' can optionally preserve permissions.Ludovic Courtès
* guix/store/database.scm (reset-timestamps): Add #:preserve-permissions? and honor it.
2019-03-07database: Make 'register-items' transactional.Caleb Ristvedt
* guix/store/database.scm (SQLITE_BUSY, register-output-sql): New variables. (add-references): Don't try finalizing after each use, only after all the uses (otherwise a finalized statement would be used if #:cache? was #f). (call-with-transaction): New procedure. (register-items): Use call-with-transaction to prevent broken intermediate states from being visible. * .dir-locals.el (call-with-transaction): indent it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2018-12-21database: Use "write-ahead log" mode and set a long "busy timeout".Ludovic Courtès
This should avoid "database is locked" errors when there's a lot of concurrency, for instance when offloading simultaneously a lot of builds. * guix/store/database.scm (call-with-database): Add two 'sqlite-exec' calls to set 'journal_mode' and 'busy_timeout'.
2018-11-23Update Guile-SQLite3 URL everywhere.Ludovic Courtès
* README: Update Guile-SQLite3 URL. * doc/guix.texi (Requirements): Likewise. * guix/store/database.scm (sqlite-exec): Likewise. * m4/guix.m4 (GUIX_CHECK_GUILE_SQLITE3): Likewise.
2018-11-13nar: Access the database instead of connecting to the daemon.Ludovic Courtès
* guix/store/database.scm (%default-database-file): New variable. (path-id): Export. * guix/nar.scm (finalize-store-file): Use 'with-database' instead of 'with-store', and use 'path-id' instead of 'valid-path?'.
2018-09-23database: Register each store item only once.Ludovic Courtès
Fixes <https://bugs.gnu.org/32600>. Reported by Leo Famulari. * guix/store/database.scm (register-items): Check whether TO-REGISTER is in DB by calling 'path-id', and skip the reset-timestamps, registration, and deduplication phases when it is.
2018-09-23database: 'register-items' shows a progress bar.Ludovic Courtès
* guix/store/database.scm (register-items): Add #:log-port. Use 'progress-reporter/bar' to show a progress report. (register-path): Pass #:log-port to 'register-items'.
2018-07-20database: Reset timestamps to one second after the Epoch.Ludovic Courtès
Previously, store items registered in the database by this code (for instance, store items retrieved by 'guix offload' and passed to 'restore-file-set') would have an mtime of 0 instead of 1. This would cause problems for things like .go files: Guile would consider them to be older than the corresponding .scm file, and consequently it would ignore them and possibly use another (incorrect) .go file. Reported by Ricardo Wurmus. * guix/store/database.scm (reset-timestamps): Pass 1, not 0, to 'utime'. * tests/store-database.scm ("register-path"): Check the mtime of FILE and REF.
2018-07-03database: 'reset-timestamps' now correctly handles symlinks.Ludovic Courtès
* guix/store/database.scm (reset-timestamps): Use 'utime' with AT_SYMLINK_NOFOLLOW for symlinks.
2018-06-14database: Allow for deterministic database construction.Ludovic Courtès
Fixes <https://bugs.gnu.org/21073>. * guix/store/database.scm (sqlite-register): Add #:time. (%epoch): New variable. (register-items): Add #:registration-time. Pass #:time to 'sqlite-register'. * gnu/build/install.scm (register-closure): Pass #:registration-time.
2018-06-14install: Use 'reset-timestamps' from (guix store database).Ludovic Courtès
* gnu/build/install.scm (reset-timestamps): Remove. * gnu/build/vm.scm: Use 'reset-timestamps' from (guix store database).
2018-06-14database: Add 'register-items'.Ludovic Courtès
* guix/build/store-copy.scm (store-info): Export. * guix/store/database.scm (register-items): New procedure. (register-path): Implement in terms of 'register-items'. * gnu/build/install.scm (register-closure): Use 'register-items' instead of 'for-each' and 'register-path'.
2018-06-14database: 'sqlite-register' takes a database, not a file name.Ludovic Courtès
* guix/store/database.scm (sqlite-register): Remove #:db-file and add 'db' parameter. Remove #:schema and 'parameterize'. (register-path): Wrap 'sqlite-register' call in 'with-database' and in 'parameterize'. * tests/store-database.scm ("new database") ("register-path with unregistered references"): Adjust accordingly.
2018-06-14database: 'reset-timestamps' sets file permissions as well.Ludovic Courtès
* guix/store/database.scm (reset-timestamps): Add 'chmod' calls.
2018-06-14database: Replace existing entries in Refs.Ludovic Courtès
* guix/store/database.scm (add-reference-sql): Add "OR REPLACE".
2018-06-14database: Add #:reset-timestamps? to 'register-path'.Ludovic Courtès
* guix/store/database.scm (register-path): Add #:reset-timestamps? and honor it.
2018-06-14database: Remove extra SQL parameter in 'update-or-insert'.Ludovic Courtès
* guix/store/database.scm (update-or-insert): Remove extra #:path parameter.
2018-06-14database: 'register-path' creates the database directory if needed.Ludovic Courtès
* guix/store/database.scm (register-path): Call 'mkdir-p'.
2018-06-14database: Provide a way to specify the schema location.Ludovic Courtès
* guix/store/database.scm (sqlite-register): Add #:schema. Parameterize 'sql-schema' based on this. (register-path): Add #:schema and pass it to 'sqlite-register'.
2018-06-14database: Fail registration when encountering unregistered references.Ludovic Courtès
* guix/store/database.scm (add-reference-sql): Remove nested SELECT. (add-references): Expect REFERENCES to be a list of ids. (sqlite-register): Call 'path-id' for each of REFERENCES and pass it to 'add-references'. * tests/store-database.scm ("register-path with unregistered references"): New test.
2018-06-14database: 'with-database' can now initialize new databases.Ludovic Courtès
* nix/libstore/schema.sql: Rename to... * guix/store/schema.sql: ... this. * Makefile.am (nobase_dist_guilemodule_DATA): Add it. * nix/local.mk (%D%/libstore/schema.sql.hh): Adjust accordingly. * guix/store/database.scm (sql-schema): New variable. (sqlite-exec, initialize-database, call-with-database): New procedures. (with-database): Rewrite in terms of 'call-with-database'. * tests/store-database.scm ("new database"): New test. * guix/self.scm (compiled-guix)[*core-modules*]: Add 'schema.sql' to #:extra-files.
2018-06-01Add (guix store deduplication).Caleb Ristvedt
* guix/store/database.scm (register-path): Add #:deduplicate? and call 'deduplicate' when it's true. (counting-wrapper-port, nar-sha256): Move to... * guix/store/deduplication.scm: ... here. New file. * tests/store-deduplication.scm: New file. * Makefile.am (STORE_MODULES): Add deduplication.scm. (SCM_TESTS) [HAVE_GUILE_SQLITE3]: Add store-deduplication.scm. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2018-06-01database: 'register-path' resets timestamps.Ludovic Courtès
* guix/store/database.scm (reset-timestamps): New procedure. (register-path): Use it.
2018-06-01Add (gnu store database).Caleb Ristvedt
* guix/config.scm.in (%store-database-directory): New variable. * guix/store/database.scm: New file. * tests/store-database.scm: New file. * Makefile.am (STORE_MODULES): New variable. (MODULES, MODULES_NOT_COMPILED): Adjust accordingly. (SCM_TESTS) [HAVE_GUILE_SQLITE3]: Add tests/store-database.scm. Co-authored-by: Ludovic Courtès <ludo@gnu.org>