Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database: reduce InsertPackages transaction. #4

Merged
merged 1 commit into from
Nov 13, 2015

Conversation

Quentin-M
Copy link
Contributor

Could possibly create deadlock transactions on PostgreSQL.

@@ -115,6 +113,10 @@ func InsertPackages(packageParameters []*Package) error {
return nil
}

// Sort the packages that will be inserted to ensure that locks will be acquired in the same
// a deterministic order.
sort.Sort(ByVersion(packageParameters))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to sort by os and package name to ensure the locks are taken in order.

Inserting packages in a single transaction does not actually buy us anything as we often delete quads during an insertion and thus, Cayley could not use COPY and do a single round-trip. Inserting multiple packages in a single transaction actually creates deadlocks when a transaction tries to insert (A,B) and another one tries to insert (B,A).
@jakedt
Copy link

jakedt commented Nov 13, 2015

LGTM

Quentin-M pushed a commit that referenced this pull request Nov 13, 2015
database: reduce InsertPackages transaction and ensure locking order.
@Quentin-M Quentin-M merged commit 8bb6c50 into quay:master Nov 13, 2015
@Quentin-M Quentin-M deleted the reduce_tx branch November 13, 2015 23:11
@Quentin-M Quentin-M changed the title database: reduce InsertPackages transaction and ensure locking order. database: reduce InsertPackages transaction. Nov 15, 2015
Quentin-M pushed a commit that referenced this pull request Feb 24, 2016
api/database: add the layer name that add each feature in getLayer
@jzelinskie jzelinskie added area/performance related to improving application performance reviewed/lgtm labels Mar 12, 2016
Allda added a commit to Allda/clair that referenced this pull request Apr 3, 2019
Filter out duplicated affected packages
hyy0322 pushed a commit to hyy0322/clair that referenced this pull request Feb 20, 2020
* feat: make updater configurable

* feat: rewrite Dockerfile to use dumb-init

* fix: stop schedule when update settings
hyy0322 added a commit to hyy0322/clair that referenced this pull request May 14, 2020
* feat: make updater configurable

* feat: rewrite Dockerfile to use dumb-init

* fix: stop schedule when update settings
hyy0322 added a commit to hyy0322/clair that referenced this pull request May 14, 2020
* feat: make updater configurable

* feat: rewrite Dockerfile to use dumb-init

* fix: stop schedule when update settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance related to improving application performance
Development

Successfully merging this pull request may close these issues.

None yet

3 participants