Insert guix_revision_package_derivation_distribution_counts later
As this should speed up processing revisions.
This commit is contained in:
parent
620ac16e26
commit
64aeeffd8e
2 changed files with 49 additions and 12 deletions
|
|
@ -53,6 +53,7 @@
|
|||
#:use-module (guix build utils)
|
||||
#:use-module ((guix build syscalls)
|
||||
#:select (set-thread-name free-disk-space))
|
||||
#:use-module (guix-data-service jobs)
|
||||
#:use-module (guix-data-service config)
|
||||
#:use-module (guix-data-service database)
|
||||
#:use-module (guix-data-service utils)
|
||||
|
|
@ -2109,18 +2110,6 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
|
|||
2000
|
||||
package-derivation-ids)))
|
||||
|
||||
(with-resource-from-pool postgresql-connection-pool conn
|
||||
(with-time-logging
|
||||
(simple-format
|
||||
#f "insert-guix-revision-package-derivation-distribution-counts (~A ~A)"
|
||||
system target)
|
||||
(insert-guix-revision-package-derivation-distribution-counts
|
||||
conn
|
||||
(fibers-force guix-revision-id-promise)
|
||||
(number->string
|
||||
(system->system-id conn system))
|
||||
(or target ""))))
|
||||
|
||||
'finished)
|
||||
|
||||
(let ((get-derivations/fiberized
|
||||
|
|
@ -2876,6 +2865,39 @@ SKIP LOCKED")
|
|||
|
||||
(when result
|
||||
(parallel-via-fibers
|
||||
(with-postgresql-connection
|
||||
(simple-format #f "post load-new-guix-revision ~A counts" id)
|
||||
(lambda (conn)
|
||||
(let ((revision-id
|
||||
(guix-revision-id-for-job conn id)))
|
||||
(with-time-logging
|
||||
(simple-format
|
||||
#f "inserting guix_revision_package_derivation_distribution_counts for revision ~A"
|
||||
revision-id)
|
||||
(let ((system-ids-and-targets
|
||||
(exec-query
|
||||
conn
|
||||
"
|
||||
SELECT DISTINCT system_id, target
|
||||
FROM package_derivations
|
||||
INNER JOIN guix_revision_package_derivations
|
||||
ON package_derivations.id = guix_revision_package_derivations.package_derivation_id
|
||||
WHERE revision_id = $1"
|
||||
(list revision-id))))
|
||||
|
||||
(with-postgresql-transaction
|
||||
conn
|
||||
(lambda (conn)
|
||||
(for-each
|
||||
(match-lambda
|
||||
((system-id target)
|
||||
(insert-guix-revision-package-derivation-distribution-counts
|
||||
conn
|
||||
revision-id
|
||||
system-id
|
||||
target)))
|
||||
system-ids-and-targets))))))))
|
||||
|
||||
(with-postgresql-connection
|
||||
(simple-format #f "post load-new-guix-revision ~A" id)
|
||||
(lambda (conn)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue