diff options
author | Christopher Baines <mail@cbaines.net> | 2020-03-24 20:44:57 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-03-24 20:44:57 +0000 |
commit | ca0d3ee7543b64eca32422a8e29f5f853923750f (patch) | |
tree | 94f60c514b3f205cd859adc649f53525cf19cd45 /guix-data-service | |
parent | 102f7a0536b76f60c06aa42ef1677ca76a4b18a7 (diff) | |
download | data-service-ca0d3ee7543b64eca32422a8e29f5f853923750f.tar data-service-ca0d3ee7543b64eca32422a8e29f5f853923750f.tar.gz |
Stop using package_versions_by_guix_revision_range
It's been replaced by the package_derivations_by_guix_revision_range table.
Diffstat (limited to 'guix-data-service')
-rw-r--r-- | guix-data-service/data-deletion.scm | 3 | ||||
-rw-r--r-- | guix-data-service/jobs/load-new-guix-revision.scm | 63 |
2 files changed, 1 insertions, 65 deletions
diff --git a/guix-data-service/data-deletion.scm b/guix-data-service/data-deletion.scm index 1a20124..296e000 100644 --- a/guix-data-service/data-deletion.scm +++ b/guix-data-service/data-deletion.scm @@ -66,8 +66,7 @@ WHERE branch_name = $1 AND git_repository_id = $2" table) (list branch-name (number->string git-repository-id)))) - '("package_versions_by_guix_revision_range" - "package_derivations_by_guix_revision_range")) + '("package_derivations_by_guix_revision_range")) (for-each (lambda (table) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index d5a54f9..7781c76 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -1154,68 +1154,6 @@ WHERE job_id = $1" (prevent-inlining-for-tests extract-information-from) -(define (update-package-versions-table conn git-repository-id commit) - (with-time-logging "lock table: package_versions_by_guix_revision_range" - ;; Lock the table to wait for other transactions to commit before updating - ;; the table - (exec-query - conn - " -LOCK TABLE ONLY package_versions_by_guix_revision_range - IN SHARE ROW EXCLUSIVE MODE")) - - (for-each - (match-lambda - ((branch-name) - (with-time-logging - (simple-format #f "deleting package version entries for ~A" branch-name) - (exec-query - conn - " -DELETE FROM package_versions_by_guix_revision_range -WHERE git_repository_id = $1 AND branch_name = $2" - (list git-repository-id - branch-name))) - (with-time-logging - (simple-format #f "inserting package version entries for ~A" branch-name) - (exec-query - conn - " -INSERT INTO package_versions_by_guix_revision_range -SELECT DISTINCT - $1::integer AS git_repository_id, - $2 AS branch_name, - packages.name AS package_name, - packages.version AS package_version, - first_value(guix_revisions.id) - OVER package_version AS first_guix_revision_id, - last_value(guix_revisions.id) - OVER package_version AS last_guix_revision_id -FROM packages -INNER JOIN ( - SELECT DISTINCT package_derivations.package_id, - guix_revision_package_derivations.revision_id - FROM package_derivations - INNER JOIN guix_revision_package_derivations - ON package_derivations.id = guix_revision_package_derivations.package_derivation_id -) AS revision_packages ON packages.id = revision_packages.package_id -INNER JOIN guix_revisions ON revision_packages.revision_id = guix_revisions.id -INNER JOIN git_branches ON guix_revisions.commit = git_branches.commit -WHERE git_branches.name = $2 -WINDOW package_version AS ( - PARTITION BY packages.name, packages.version - ORDER BY git_branches.datetime - RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING -) -ORDER BY packages.name, packages.version" - (list git-repository-id branch-name))))) - (exec-query - conn - "SELECT name FROM git_branches WHERE commit = $1 AND git_repository_id = $2" - (list commit git-repository-id))) - - #t) - (define (load-new-guix-revision conn store git-repository-id commit) (let* ((channel-for-commit (channel (name 'guix) @@ -1262,7 +1200,6 @@ ORDER BY packages.name, packages.version" (simple-format #t "debug: importing channel news not supported\n") #t)) - (update-package-versions-table conn git-repository-id commit) (update-package-derivations-table conn git-repository-id guix-revision-id |