Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-26453

Update Content Counts task does not scale at all

XMLWordPrintable

    • Sprint 136, Sprint 137, Sprint 138
    • Moderate
    • Automated
    • No

      Description of problem:
      After a successful Capsule sync, Update Content Counts task is triggered. It updates content statistics of each and every repository on the Capsule.

      That does not scale at all. If one promotes a small CV to a LE, a new Capsule Sync is triggered (by default) which sycnhronizes to the Capsule just the repos from the CV/LE. But content stats of all repos are updated.

      Version-Release number of selected component (if applicable):
      Sat 6.15

      How reproducible:
      100%

      Steps to Reproduce:
      1. Have multiple CVs promoted to an LV associated to a Capsule
      2. Have the Capsule fully synchronized
      3. Promote a new CV to the LE and let automatically sync the content to the Capsule
      4. See duration of the "Update Content Counts" task.
      5. Run Complete Capsule Sync, just for the sake of comparing the time of "Update Content Counts" task duration.
      6. Optionally, add to app/models/katello/concerns/smart_proxy_extensions.rb one extra log (at the beginning of whole reproducer):

      def update_content_counts!

      1. {:content_view_versions=>{87=>{:repositories=>{1=>{:metadata=>{},:counts=>{:rpms=>98, :module_streams=>9898}}}}}
        new_content_counts = { content_view_versions: {} }
        smart_proxy_helper = ::Katello::SmartProxyHelper.new(self)
        repos = smart_proxy_helper.repositories_available_to_capsule
        Rails.logger.info("XXX update_content_counts for Capsule #{self}: repos:#{repos.pluck(:id)}")

      Actual results:
      Duration of "Update Content Counts" task is the same in cases 4. and 5 (and is linear to # repos on Capsule, not # of repos newly synced).

      Optional step 6 shows that despite Capsule Sync updated just one repo, all repos are recalculated.

      Expected results:
      "Update Content Counts" task duration relevant to the size of repos just synced to the Capsule.

      Additional info:

      required fix:
      1) app/lib/actions/katello/capsule_content/sync_capsule.rb :
      execution_plan_hooks.use :update_content_counts, :on => :success

      needs some enhancement to pass "repos = repos_to_sync(..) list from planning step as an argument

      2) That argument needs to pass via app/lib/actions/katello/capsule_content/update_content_counts.rb task to app/models/katello/concerns/smart_proxy_extensions.rb, method update_content_counts!

          There are no Sub-Tasks for this issue.

              rhn-engineering-sajha Samir Jha
              rhn-support-pmoravec Pavel Moravec
              Vladimír Sedmík Vladimír Sedmík
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: