-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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)) |
There was a problem hiding this comment.
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).
LGTM |
Quentin-M
pushed a commit
that referenced
this pull request
Nov 13, 2015
database: reduce InsertPackages transaction and ensure locking order.
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Could possibly create deadlock transactions on PostgreSQL.