Commit e7abe1bd authored by Furkan Ayhan's avatar Furkan Ayhan

Merge branch 'mo-remove-ci-decompose-belonging-parent-group-ff' into 'master'

Remove ci_decompose_belonging_to_parent_group feature flag

See merge request gitlab-org/gitlab!77944
parents 4e93c679 c6926279
......@@ -763,9 +763,7 @@ 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
project.active_runners.exists?
end
end
......
......@@ -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
belonging_to_group(project_groups.self_and_ancestors.pluck(:id))
}
# 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,9 +1788,7 @@ 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
online_runners_with_tags.any?(&block)
end
def valid_runners_token?(token)
......
......@@ -99,17 +99,15 @@ 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)
runners = runners.with_recent_runner_queue
runners = runners.with_tags if Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml)
metrics.observe_active_runners(-> { runners.to_a.size })
metrics.observe_active_runners(-> { runners.to_a.size })
runners.each do |runner|
metrics.increment_runner_tick(runner)
runners.each do |runner|
metrics.increment_runner_tick(runner)
runner.pick_build!(build)
end
runner.pick_build!(build)
end
end
......
---
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,44 +239,20 @@ 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
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
context 'when use_traversal_ids* are enabled' do
it_behaves_like '.belonging_to_parent_group_of_project'
end
context 'when ci_decompose_belonging_to_parent_group_of_project_query is disabled' do
context 'when use_traversal_ids* are 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'
stub_feature_flags(
use_traversal_ids: false,
use_traversal_ids_for_ancestors: false,
use_traversal_ids_for_ancestor_scopes: false
)
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
it_behaves_like '.belonging_to_parent_group_of_project'
end
describe '.owned_or_instance_wide' 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