refactor ClmChannelDiff task to use a Queue (bsc#1273021) - #12525
Conversation
|
👋 Hello! Thanks for contributing to our project. You can see the progress at the end of this page and at https://github.com/uyuni-project/uyuni/pull/12525/checks 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.
Pull request overview
This PR refactors CLM channel diff generation from a single long-running task into a queued, worker-based model so work can be split per (project, environment, channel) and processed in smaller, parallelizable units. This aims to reduce long transactions/locks and avoid growing Hibernate session/cache during a full run.
Changes:
- Introduces a new DB queue table (
suseClmDiffQueue) and Taskomatic queries to drive/claim/dequeue CLM diff work items. - Adds a new Taskomatic queue job (
ClmDiff) with driver/worker implementation to process queued items concurrently (configurable worker count). - Refactors the existing
ClmChannelDiffjob to enqueue work items instead of computing diffs inline; updates schedules/templates/strings/config accordingly.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| schema/spacewalk/upgrade/susemanager-schema-5.3.1-to-susemanager-schema-5.3.2/401-add-tasko-clm-diff-bunch.sql | Upgrade script to add the new Taskomatic task/bunch/schedule/template for queued CLM diff processing. |
| schema/spacewalk/upgrade/susemanager-schema-5.3.1-to-susemanager-schema-5.3.2/400-add-suseClmDiffQueue.sql | Upgrade script creating the CLM diff queue table and indexes. |
| schema/spacewalk/susemanager-schema.changes.mcalmer.Manager-5.2.0-logging-clm-diff-task | Schema changelog entry for the new CLM diff queue table. |
| schema/spacewalk/common/tables/tables.deps | Declares table dependencies for suseClmDiffQueue. |
| schema/spacewalk/common/tables/suseClmDiffQueue.sql | Base schema definition for the new CLM diff queue table and indexes. |
| schema/spacewalk/common/data/rhnTaskoTemplate.sql | Adds the clm-diff task template to the base dataset. |
| schema/spacewalk/common/data/rhnTaskoTask.sql | Registers the new Taskomatic task clm-diff in base data. |
| schema/spacewalk/common/data/rhnTaskoSchedule.sql | Adds the default schedule for the new clm-diff bunch. |
| schema/spacewalk/common/data/rhnTaskoBunch.sql | Registers the new clm-diff-bunch in base data. |
| java/spacewalk-java.changes.mcalmer.Manager-5.2.0-logging-clm-diff-task | Java changelog entry describing the queue-based refactor. |
| java/core/src/main/resources/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | Adds UI/status strings for the new bunch and task status. |
| java/core/src/main/resources/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml | Adds CLM diff queue driver/worker SQL queries (select/mark/unmark/dequeue/insert). |
| java/core/src/main/java/com/redhat/rhn/taskomatic/task/TaskConstants.java | Adds constants for the new CLM diff Taskomatic query mode names. |
| java/core/src/main/java/com/redhat/rhn/taskomatic/task/clmdiff/ClmDiffWorker.java | Implements per-item worker that runs diffClmChannel and dequeues work. |
| java/core/src/main/java/com/redhat/rhn/taskomatic/task/clmdiff/ClmDiffDriver.java | Implements queue driver selecting candidates and resetting unfinished in-progress items. |
| java/core/src/main/java/com/redhat/rhn/taskomatic/task/ClmDiff.java | New Taskomatic queue job entry point wiring in the CLM diff queue driver. |
| java/core/src/main/java/com/redhat/rhn/taskomatic/task/ClmChannelDiff.java | Refactors legacy job to enqueue per-channel work items instead of running diffs directly. |
| java/core/src/main/java/com/redhat/rhn/manager/contentmgmt/ContentManager.java | Adds diffClmChannel and improves timing/logging around diff generation steps. |
| java/core/src/main/java/com/redhat/rhn/domain/contentmgmt/ContentProjectFactory.java | Adds lookup helper for projects by label used by queued execution. |
| java/core/src/main/java/com/redhat/rhn/domain/contentmgmt/ContentProject.java | Adds a stream-based environment iterator used by enqueue/diff logic. |
| java/core/src/main/java/com/redhat/rhn/common/util/TimeUtils.java | Enhances logTime to accept a throwing runnable and improves doc wording. |
| java/core/src/main/java/com/redhat/rhn/common/conf/ConfigDefaults.java | Adds a config default getter for CLM diff worker concurrency. |
| java/conf/rhn_java.conf | Adds the java.taskomatic_clmdiff_workers configuration knob. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
71193c4 to
44f2b32
Compare
44f2b32 to
e055d7b
Compare
What does this PR change?
The CLM Channel Diff is a expensive task which take a bit. In environments with a lot of projects and environments this task can block others as it iterate over all and commit only at the end. This may create also problems with the hibernate cache and locks which stay for the whole process.
This PR try to cut it into smaller pieces which can also be executed in parallel.
Every Channel of a CLM project and environment is added to a queue and a queue job is handling the queue.
With this also every channel is committed after it is finished and possible locks on the tables should be lifted.
End-User Impact & Release Notes
If this PR alters behavior for end-users (WebUI, API, CLI, configs), modifies container architecture, or affects existing migrations/upgrades, you must add release note details to the pull request and ping the release engineers.
Codespace
Check if you already have a running container clicking on
GUI diff
No difference.
Documentation
Describe new taskomatic tasks uyuni-docs#5282
DONE
Test coverage
No tests: already covered
DONE
Links
Port(s): https://github.com/SUSE/spacewalk/pull/31647
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!