Commit 02eccd42 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'remove-ci_pipelines_for_merge_request_finder_new_cte-feature-flag' into 'master'

Remove ci_pipelines_for_merge_request_finder_new_cte feature flag

See merge request gitlab-org/gitlab!50818
parents b5c6a168 1fccaf9c
...@@ -34,11 +34,7 @@ module Ci ...@@ -34,11 +34,7 @@ module Ci
pipelines = pipelines =
if merge_request.persisted? if merge_request.persisted?
if Feature.enabled?(:ci_pipelines_for_merge_request_finder_new_cte, target_project) pipelines_using_cte
pipelines_using_cte
else
pipelines_using_legacy_cte
end
else else
triggered_for_branch.for_sha(commit_shas) triggered_for_branch.for_sha(commit_shas)
end end
...@@ -49,18 +45,6 @@ module Ci ...@@ -49,18 +45,6 @@ module Ci
private private
def pipelines_using_legacy_cte
cte = Gitlab::SQL::CTE.new(:shas, merge_request.all_commits.select(:sha))
source_sha_join = cte.table[:sha].eq(Ci::Pipeline.arel_table[:source_sha])
merged_result_pipelines = filter_by(triggered_by_merge_request, cte, source_sha_join)
detached_merge_request_pipelines = filter_by_sha(triggered_by_merge_request, cte)
pipelines_for_branch = filter_by_sha(triggered_for_branch, cte)
Ci::Pipeline.with(cte.to_arel) # rubocop: disable CodeReuse/ActiveRecord
.from_union([merged_result_pipelines, detached_merge_request_pipelines, pipelines_for_branch])
end
def pipelines_using_cte def pipelines_using_cte
cte = Gitlab::SQL::CTE.new(:shas, merge_request.all_commits.select(:sha)) cte = Gitlab::SQL::CTE.new(:shas, merge_request.all_commits.select(:sha))
......
---
title: Improve the database query performance on the pipeline loading in merge requests
merge_request: 50818
author:
type: performance
---
name: ci_pipelines_for_merge_request_finder_new_cte
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/49083
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/291006
milestone: '13.7'
type: development
group: group::continuous integration
default_enabled: false
...@@ -225,24 +225,6 @@ RSpec.describe Ci::PipelinesForMergeRequestFinder do ...@@ -225,24 +225,6 @@ RSpec.describe Ci::PipelinesForMergeRequestFinder do
branch_pipeline_2, branch_pipeline_2,
branch_pipeline]) branch_pipeline])
end end
context 'when ci_pipelines_for_merge_request_finder_new_cte feature flag is disabled' do
before do
stub_feature_flags(ci_pipelines_for_merge_request_finder_new_cte: false)
end
it 'returns only related merge request pipelines' do
expect(subject.all)
.to eq([detached_merge_request_pipeline,
branch_pipeline_2,
branch_pipeline])
expect(described_class.new(merge_request_2, nil).all)
.to eq([detached_merge_request_pipeline_2,
branch_pipeline_2,
branch_pipeline])
end
end
end end
context 'when detached merge request pipeline is run on head ref of the merge request' do context 'when detached merge request pipeline is run on head ref of the merge request' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment