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:
Christopher Baines 2022-04-16 18:47:54 +01:00
parent 27c34a9ca5
commit 9607bcedfe
2 changed files with 20 additions and 12 deletions

View file

@ -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)