Backport of 'Cap the commit page pipelines badge count at 1,000+' into 19.5

What does this MR do and why?

Backport of !264101 (merged) into 19.5. Cherry-pick of b048b21801ede975a9dc8bf3df526d1fcedc75a8.

A commit can collect tens of thousands of pipelines, for example on a project that triggers pipelines for other projects through schedules. On those commits the Pipelines tab badge on the commit page runs an unbounded COUNT(*) over every pipeline of the sha, which costs as much as the unbounded newest-pipeline lookup.

This change switches the badge to limited_counter_with_delimiter, which wraps the count in LIMIT 1001 and shows 1,000+ above the cap.

Two files. No migration, no schema change, no new query shape. The only user-visible difference is that a commit with more than 1,000 pipelines shows 1,000+ on the badge.

Why backport

Reported by a GitLab Dedicated customer whose commit pages return 500 on an affected project. The tenant runs 19.4.3 today, so !267754 (merged) backports this into 19.4. This MR covers 19.5, which the tenant moves to under the Dedicated N-1 schedule, so the fix is not lost when they step up a minor version.

  • Zendesk 752368
  • gitlab-com/request-for-help#5424

Cherry-pick notes

Applied cleanly. Both files are byte-identical to master on this branch apart from this change.

Squash is disabled so the Changelog: performance trailer and the (cherry picked from commit ...) line survive the merge.

Scope

This caps the badge count only. The commit page's main pipeline lookup, Ci::CommitWithPipeline#last_pipeline, is still unbounded and sits in the draft !263784, so this change on its own does not make the commit page load for the reporting customer. It removes one of the two expensive queries on that page.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
  • The MR that fixed the bug on the default branch has been deployed to GitLab.com (not applicable for documentation or spec changes).
  • The MR title is descriptive (e.g. "Backport of 'title of default branch MR'"). This is important, since the title will be copied to the patch blog post.
  • Required labels have been applied to this merge request
  • This MR has been approved by a maintainer (only one approval is required).
  • Ensure the E2E Omnibus GitLab EE pipeline (triggered by thee2e:test-on-omnibus-ee job) has succeeded. If it has failed (or shows warnings), investigate the failures. If you determine the failures are unrelated, you may proceed. If you need assistance investigating, request help in the #s_developer_experience Slack channel to confirm the failures are unrelated to the merge request.

Note to the merge request author and maintainer

If you have questions about the patch release process, please:

cc @tigerwnz

Edited by Anthony Suchodolski

Merge request reports

Loading
Loading