From 4d04a7f47b7d180f5b4672c78aef2985e650cd16 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 8 Jul 2025 07:23:32 +0100 Subject: [PATCH] Stop sharing the derivation-ids-hash-table Since the derivations are independent between systems, and this is just a cache of the database ids. --- .../jobs/load-new-guix-revision.scm | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index 6ef6d63..98e4588 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -2406,7 +2406,6 @@ WHERE builder != 'builtin:download' guix-derivation call-with-utility-thread read-derivations/serialised - derivation-ids-hash-table #:key skip-system-tests? extra-inferior-environment-variables parallelism @@ -2647,7 +2646,7 @@ WHERE builder != 'builtin:download' postgresql-connection-pool call-with-utility-thread read-derivations/serialised - derivation-ids-hash-table + (make-hash-table) derivations-vector #:log-tag (simple-format #f "~A:~A" system target))))) (guix-revision-id @@ -2748,7 +2747,7 @@ WHERE builder != 'builtin:download' postgresql-connection-pool call-with-utility-thread read-derivations/serialised - derivation-ids-hash-table + (make-hash-table) (list->vector (map cdr derivation-file-names-by-system)) #:log-tag "channel-instances")))) @@ -2781,7 +2780,6 @@ WHERE builder != 'builtin:download' (define (load-channel-instances call-with-utility-thread read-derivations/serialised - derivation-ids-hash-table git-repository-id commit channel-derivations-by-system) ;; Load the channel instances in a different transaction, so that this can @@ -2824,19 +2822,24 @@ WHERE builder != 'builtin:download' (lambda (drv) (cons system drv))))) channel-derivations-by-system)) - (derivation-ids - (derivation-file-names->derivation-ids - postgresql-connection-pool - call-with-utility-thread - read-derivations/serialised - derivation-ids-hash-table - (list->vector (map cdr derivations-by-system))))) + (derivation-ids-by-system + (fibers-map + (match-lambda + ((system . drv) + (cons system + (vector-ref + (derivation-file-names->derivation-ids + postgresql-connection-pool + call-with-utility-thread + read-derivations/serialised + (make-hash-table) + (vector drv)) + 0)))) + derivations-by-system))) (insert-channel-instances channel-instances-conn guix-revision-id - (map cons - (map car derivations-by-system) - (vector->list derivation-ids)))) + derivation-ids-by-system)) (simple-format (current-error-port) "guix-data-service: saved the channel instance derivations to the database\n")) @@ -2881,9 +2884,6 @@ WHERE builder != 'builtin:download' read-derivations/parallelism-limiter (apply read-derivations args))) - (define derivation-ids-hash-table - (make-hash-table)) - (let* ((git-repository-fields (select-git-repository conn git-repository-id)) (git-repository-url @@ -2920,7 +2920,6 @@ WHERE builder != 'builtin:download' (fibers-force channel-derivations-by-system-promise))) (load-channel-instances call-with-utility-thread read-derivations/serialised - derivation-ids-hash-table git-repository-id commit channel-derivations-by-system))) #:on-exception @@ -2947,7 +2946,6 @@ WHERE builder != 'builtin:download' guix-derivation call-with-utility-thread read-derivations/serialised - derivation-ids-hash-table #:skip-system-tests? skip-system-tests? #:extra-inferior-environment-variables