Skip to content

Update Import/Export ObjectBuilder for merge requests

What does this MR do and why?

Related to https://gitlab.com/gitlab-org/manage/import/support/-/issues/7#note_836688337

This MR adds target_project_id to the select query in order to speed up project merge requests lookup when importing CI pipelines that reference existing merge requests.

Before this change the following SQL query was fired:

SELECT "merge_requests".* FROM "merge_requests" WHERE "merge_requests"."title" = $1 AND "merge_requests"."iid" = $2 LIMIT $3

As you can see it's not scoped to a specific project which can cause performance issues.

Query after the change:

SELECT "merge_requests".* FROM "merge_requests" WHERE "merge_requests"."title" = 'MergeRequest' AND "merge_requests"."target_project_id" = 119 LIMIT 1 

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Edited by George Koltsov

Merge request reports