Skip to content

Use upsert for MR metrics

Adam Hegyi requested to merge upsert_mr_metrics into master

What does this MR do?

This MR changes the ensure_metrics method for MergeRequest to use an UPSERT query. The main goal is to avoid the subtransaction described by #338960 (closed)..

The upsert query is behind a FF: use_upsert_query_for_mr_metrics

The enesure_metrics is thoroughly tested at: https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/models/merge_request_spec.rb#L272

How to setup and validate locally (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #338960 (closed)

Edited by Dan Jensen

Merge request reports