aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-04-16 18:47:54 +0100
committerChristopher Baines <mail@cbaines.net>2022-04-16 18:47:54 +0100
commit9607bcedfe810681ea3fc76ceef4244583213b9b (patch)
treeaeeace5e0ddbabfba32c4c6d71dea4135959fdf4 /guix-data-service/model
parent27c34a9ca5ea010f207a4acad597ce98e84d3567 (diff)
downloaddata-service-9607bcedfe810681ea3fc76ceef4244583213b9b.tar
data-service-9607bcedfe810681ea3fc76ceef4244583213b9b.tar.gz
Move the builds.derivation_output_details_set_id update
To the end of the main revision processing transaction. Currently, I think there are issues when this query does update some builds, as those rows in the build table remain locked until the end of the transaction. This then causes build event submission to hang. Moving this part of the revision loading process to the end of the transaction should help to mitigate this.
Diffstat (limited to 'guix-data-service/model')
-rw-r--r--guix-data-service/model/build.scm22
1 files changed, 15 insertions, 7 deletions
diff --git a/guix-data-service/model/build.scm b/guix-data-service/model/build.scm
index 30196eb..d6f911b 100644
--- a/guix-data-service/model/build.scm
+++ b/guix-data-service/model/build.scm
@@ -428,11 +428,10 @@ WHERE build_server_id = $1 AND build_server_build_id = $2")
(_
#f)))
-(define (update-builds-derivation-output-details-set-id conn derivation-file-names)
+(define (update-builds-derivation-output-details-set-id conn revision-id)
(exec-query
conn
- (string-append
- "
+ "
UPDATE builds SET derivation_output_details_set_id = (
SELECT derivations_by_output_details_set.derivation_output_details_set_id
FROM derivations_by_output_details_set
@@ -440,10 +439,19 @@ UPDATE builds SET derivation_output_details_set_id = (
ON derivations.file_name = builds.derivation_file_name
WHERE derivations_by_output_details_set.derivation_id = derivations.id
) WHERE builds.derivation_output_details_set_id IS NULL AND
- builds.derivation_file_name IN ("
- (string-join (map quote-string derivation-file-names)
- ",")
- ")")))
+ builds.derivation_file_name IN (
+ SELECT derivations.file_name
+ FROM derivations
+ INNER JOIN package_derivations
+ ON derivations.id = package_derivations.derivation_id
+ INNER JOIN guix_revision_package_derivations
+ ON package_derivations.id =
+ guix_revision_package_derivations.package_derivation_id
+ WHERE revision_id = $1
+)"
+ (list (number->string revision-id)))
+
+ #t)
(define (select-derivations-by-output-details-set-id-by-derivation-file-name
conn