Skip to content

refactor ClmChannelDiff task to use a Queue (bsc#1273021) - #12525

Merged
mcalmer merged 1 commit into
uyuni-project:masterfrom
mcalmer:logging-clm-diff-task
Sep 16, 2026
Merged

mcalmer merged 1 commit into
uyuni-project:masterfrom
mcalmer:logging-clm-diff-task

Conversation

@mcalmer

@mcalmer mcalmer commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

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.

  • DONE

Codespace

Check if you already have a running container clicking on Running CodeSpace

Create CodeSpace About billing for Github Codespaces CodeSpace Billing Summary CodeSpace Limit

GUI diff

No difference.

  • DONE

Documentation

Test coverage

  • No tests: already covered

  • DONE

Links

Port(s): https://github.com/SUSE/spacewalk/pull/31647

  • DONE

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:

  • No changelog needed

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:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "frontend_checks"
  • Re-run test "spacecmd_unittests"

Before you merge

Check How to branch and merge properly!

Copilot AI lite review requested due to automatic review settings August 29, 2026 09:42
@mcalmer
mcalmer requested review from a team as code owners August 29, 2026 09:42
@mcalmer
mcalmer requested review from nadvornik and removed request for a team August 29, 2026 09:42
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hello! Thanks for contributing to our project.
Acceptance tests will take some time (approx. 1h), please be patient ☕

You can see the progress at the end of this page and at https://github.com/uyuni-project/uyuni/pull/12525/checks
Once tests finish, if they fail, you can check 👀 the cucumber report. See the link at the output of the action.
You can also check the artifacts section, which contains the logs 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!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ClmChannelDiff job 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.

Comment thread schema/spacewalk/common/tables/suseClmDiffQueue.sql
Comment thread java/spacewalk-java.changes.mcalmer.Manager-5.2.0-logging-clm-diff-task Outdated
Comment thread java/core/src/main/java/com/redhat/rhn/taskomatic/task/ClmChannelDiff.java Outdated
@mcalmer
mcalmer force-pushed the logging-clm-diff-task branch from 71193c4 to 44f2b32 Compare August 29, 2026 11:39
@mcalmer
mcalmer force-pushed the logging-clm-diff-task branch from 44f2b32 to e055d7b Compare September 16, 2026 14:53
@mcalmer
mcalmer merged commit 01525cd into uyuni-project:master Sep 16, 2026
30 of 31 checks passed
@mcalmer
mcalmer deleted the logging-clm-diff-task branch September 16, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants