-
Notifications
You must be signed in to change notification settings - Fork 180
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
Improve SQL queries and performance to check for PTF packages (bsc#1225619) #9065
Improve SQL queries and performance to check for PTF packages (bsc#1225619) #9065
Conversation
👋 Hello! Thanks for contributing to our project. If you are unsure the failing tests are related to your code, you can check the "reference jobs". These are jobs that run on a scheduled time with code from master. If they fail for the same reason as your build, it means the tests or the infrastructure are broken. If they do not fail, but yours do, it means it is related to your code. Reference tests: KNOWN ISSUES Sometimes the build can fail when pulling new jar files from download.opensuse.org . This is a known limitation. Given this happens rarely, when it does, all you need to do is rerun the test. Sorry for the inconvenience. For more tips on troubleshooting, see the troubleshooting guide. Happy hacking! |
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.
The change looks fine for me. Since the PR claims to improve performance, can you please provide data that backs the claim up? How much performance is gained?
Suggested tests to cover this Pull Request
|
688c961
to
9db26c4
Compare
Thanks for the review! During the investigations on this L3, customer confirmed that due
There was later a discussion with Ricardo and it was agreed to go with this proposed solution here (moving calculation of ptf to import package time and store it in DB) [2] [1] https://bugzilla.suse.com/show_bug.cgi?id=1225619#c26 |
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.
Thanks a lot for the fix, @meaksh. This saves us a huge sequential scan on rhnPackage
on every operation involving packages. The performance gain is obvious.
Thinking out loud here: Indexing on boolean fields where the values are roughly 50/50 is generally useless, but in our case, only a tiny fraction of the packages would be PTFs. In this case, we can further benefit from some partial indexing ( A possible solution could be to define partial indexes like below: CREATE INDEX idx1 ON rhnPackage(id) WHERE NOT is_ptf;
CREATE INDEX idx2 ON rhnPackage(id) WHERE NOT is_part_of_ptf; |
...-schema-5.0.8-to-susemanager-schema-5.0.9/300-replace-susePackageExcludingPartOfPtf-view.sql
Show resolved
Hide resolved
java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml
Outdated
Show resolved
Hide resolved
b4335f0
to
4b6e7cf
Compare
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.
The Git history could use some cleanup, there are commits that just fix earlier commits. I recommend squashing them together (without keeping messages like "Fix Python code formatting issues raised by black")
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.
LGTM
…25619) Do not export PTF flags as they are calculated at import time Make Hibernate aware of new attributes and fix junit tests Use boolean for storing PTF flags in the DB Add missing indexes to the rhnPackage schema definition Make 'package_retracted_and_ptf_details' query more efficient
a616b0d
to
954d1a4
Compare
FYI the current failure for |
What does this PR change?
This PR improves the performance to determine which packages are PTFs or part of a PTF, as in large environments with tons of packages, these SQL operations, and particularly the
susePackageExcludingPartOfPtf
SQL view can cause very huge delays in the context of Content Lifecycle Management (CLM) operations.In order to achieve a better performance, this PR is doing the following changes:
is_ptf
andis_part_of_ptf
torhnPackage
table.susePackageExcludingPartOfPtf
view and other SQL queries have been adapted to use the new attributes.GUI diff
No difference.
Documentation
No documentation needed: only internal and user invisible changes
DONE
Test coverage
No tests: already covered
DONE
Links
Issue(s): https://github.com/SUSE/spacewalk/issues/24426
Port(s): https://github.com/SUSE/spacewalk/pull/24882
Changelogs
Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository
If you don't need a changelog check, please mark this checkbox:
If you uncheck the checkbox after the PR is created, you will need to re-run
changelog_test
(see below)Re-run a test
If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:
Before you merge
Check How to branch and merge properly!