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.
This commit is contained in:
parent
27c34a9ca5
commit
9607bcedfe
2 changed files with 20 additions and 12 deletions
|
|
@ -1401,10 +1401,6 @@ WHERE job_id = $1")
|
|||
(inferior-data->package-derivation-ids
|
||||
conn inf inferior-package-id->package-database-id
|
||||
inferior-data-4-tuples))))
|
||||
(update-builds-derivation-output-details-set-id
|
||||
conn
|
||||
(map fourth inferior-data-4-tuples))
|
||||
|
||||
(insert-guix-revision-package-derivations conn
|
||||
guix-revision-id
|
||||
package-derivation-ids)
|
||||
|
|
@ -1513,7 +1509,11 @@ WHERE job_id = $1")
|
|||
(update-package-derivations-table conn
|
||||
git-repository-id
|
||||
guix-revision-id
|
||||
commit))
|
||||
commit)
|
||||
(with-time-logging "updating builds.derivation_output_details_set_id"
|
||||
(update-builds-derivation-output-details-set-id
|
||||
conn
|
||||
(string->number guix-revision-id))))
|
||||
(begin
|
||||
(simple-format #t "Failed to generate store item for ~A\n"
|
||||
commit)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue