Backport of 'Coalesce concurrent security report ingestion per project' to 19.3

What does this MR do and why?

Backports !256533 (merged) fix into 19.3 stable release branch. It changes Security::StoreSecurityReportsByProjectWorker from deduplicate :until_executing to :until_executed, if_deduplicated: :reschedule_once.

until_executing releases the deduplication lock when the job starts, so a second job for the same project can execute alongside the first. Both then contend on the same (project_id, fingerprint) rows in vulnerability_identifiers — which is exactly where the statement timeouts in #629530 land. The contention is self-inflicted.

Why coalescing is safe here

perform resolves the latest pipeline from the Redis register at run time rather than taking a pipeline id, so a coalesced duplicate loses no work — the surviving job picks up whatever the latest state is. reschedule_once still re-runs the job after the in-flight one finishes, so the newest result is produced, just without the two overlapping.

This is one of several contention changes identified in the RCA. The companion one is adding a concurrency_limit to this worker. An earlier version of this description also named Security::Scans::IngestReportsWorker as writing the same rows; that was wrong — it only enqueues Security::StoreScansWorker and never reaches the ingestion slice transaction. The other writer of that transaction is PackageMetadata::GlobalAdvisoryScanWorker via CVS, which already has deduplication and a concurrency limit.

There is no feature flag: a deduplication strategy is a class-level DSL setting with no runtime toggle, so the rollback is a revert.

References

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

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:

Edited by Kate Grechishkina

Merge request reports

Loading
Loading