Commit c6926279 authored by Maxime Orefice's avatar Maxime Orefice Committed by Furkan Ayhan

Remove ci_decompose_belonging_to_parent_group feature flag

Changelog: performance
parent fe881e80
......@@ -763,11 +763,9 @@ module Ci
def any_runners_available?
cache_for_available_runners do
::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339937') do
project.active_runners.exists?
end
end
end
def stuck?
pending? && !any_runners_online?
......
......@@ -141,16 +141,9 @@ module Ci
project_groups = ::Group.joins(:projects).where(projects: { id: project_id })
if Feature.enabled?(:ci_decompose_belonging_to_parent_group_of_project_query, default_enabled: :yaml)
belonging_to_group(project_groups.self_and_ancestors.pluck(:id))
else
joins(:groups)
.where(namespaces: { id: project_groups.self_and_ancestors.as_ids })
.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336433')
end
}
# deprecated
scope :owned_or_instance_wide, -> (project_id) do
from_union(
[
......@@ -159,7 +152,7 @@ module Ci
instance_type
],
remove_duplicates: false
).allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336433')
)
end
scope :assignable_for, ->(project) do
......
......@@ -1775,17 +1775,12 @@ class Project < ApplicationRecord
def all_runners
Ci::Runner.from_union([runners, group_runners, shared_runners])
.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339937')
end
def all_available_runners
Ci::Runner.from_union([runners, group_runners, available_shared_runners])
.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339937')
end
# Once issue 339937 is fixed, please search for all mentioned of
# https://gitlab.com/gitlab-org/gitlab/-/issues/339937,
# and remove the allow_cross_joins_across_databases.
def active_runners
strong_memoize(:active_runners) do
all_available_runners.active
......@@ -1793,10 +1788,8 @@ class Project < ApplicationRecord
end
def any_online_runners?(&block)
::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339937') do
online_runners_with_tags.any?(&block)
end
end
def valid_runners_token?(token)
self.runners_token && ActiveSupport::SecurityUtils.secure_compare(token, self.runners_token)
......
......@@ -99,7 +99,6 @@ module Ci
private
def tick_for(build, runners)
::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/339937') do
runners = runners.with_recent_runner_queue
runners = runners.with_tags if Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml)
......@@ -111,7 +110,6 @@ module Ci
runner.pick_build!(build)
end
end
end
def maintain_pending_builds_queue?
::Ci::PendingBuild.maintain_denormalized_data?
......
---
name: ci_decompose_belonging_to_parent_group_of_project_query
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/76454
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/348560
milestone: '14.7'
type: development
group: group::pipeline execution
default_enabled: false
......@@ -239,7 +239,6 @@ RSpec.describe Ci::Runner do
end
end
context 'when ci_decompose_belonging_to_parent_group_of_project_query is enabled' do
context 'when use_traversal_ids* are enabled' do
it_behaves_like '.belonging_to_parent_group_of_project'
end
......@@ -255,29 +254,6 @@ RSpec.describe Ci::Runner do
it_behaves_like '.belonging_to_parent_group_of_project'
end
end
context 'when ci_decompose_belonging_to_parent_group_of_project_query is disabled' do
before do
stub_feature_flags(ci_decompose_belonging_to_parent_group_of_project_query: false)
end
context 'when use_traversal_ids* are enabled' do
it_behaves_like '.belonging_to_parent_group_of_project'
end
context 'when use_traversal_ids* are disabled' do
before do
stub_feature_flags(
use_traversal_ids: false,
use_traversal_ids_for_ancestors: false,
use_traversal_ids_for_ancestor_scopes: false
)
end
it_behaves_like '.belonging_to_parent_group_of_project'
end
end
describe '.owned_or_instance_wide' do
it 'returns a globally shared, a project specific and a group specific runner' 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