Skip to content

fix(stats): prevent package download totals from resetting during aggregation - #666

Open
andrii-suse wants to merge 1 commit into
masterfrom
fix-pkg-agg-total
Open

fix(stats): prevent package download totals from resetting during aggregation#666
andrii-suse wants to merge 1 commit into
masterfrom
fix-pkg-agg-total

Conversation

@andrii-suse

Copy link
Copy Markdown
Collaborator

The daily stat aggregator _agg_total was joining previous cumulative totals using the global maximum 'total' date instead of the package-specific latest 'total' date. If a package was not downloaded on the exact day of the last global run, it had no total record for that date. This resulted in a failed join, wiping out its entire historical statistics and resetting the cumulative count.

This fix:

  1. Refactors _agg_total to join previous totals on a package-specific basis using an optimized subquery.
  2. Scopes WebAPI queries cnt_total and cnt_today to the requested package ID to correctly show cumulative totals even during inactive days.
  3. Adds a time-boundary-immune integration test in 20-report-download.sh that freezes time relative to a single point to verify the fixes and prevent regressions.

…regation

The daily stat aggregator `_agg_total` was joining previous cumulative
totals using the global maximum `'total'` date instead of the package-specific
latest `'total'` date. If a package was not downloaded on the exact day of
the last global run, it had no total record for that date. This resulted in
a failed join, wiping out its entire historical statistics and resetting the
cumulative count.

This fix:
1. Refactors `_agg_total` to join previous totals on a package-specific
   basis using an optimized subquery.
2. Scopes WebAPI queries `cnt_total` and `cnt_today` to the requested
   package ID to correctly show cumulative totals even during inactive days.
3. Adds a time-boundary-immune integration test in `20-report-download.sh`
   that freezes time relative to a single point to verify the fixes and
   prevent regressions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant