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 ...@@ -763,9 +763,7 @@ module Ci
def any_runners_available? def any_runners_available?
cache_for_available_runners do 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?
project.active_runners.exists?
end
end end
end end
......
...@@ -141,16 +141,9 @@ module Ci ...@@ -141,16 +141,9 @@ module Ci
project_groups = ::Group.joins(:projects).where(projects: { id: project_id }) 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))
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 scope :owned_or_instance_wide, -> (project_id) do
from_union( from_union(
[ [
...@@ -159,7 +152,7 @@ module Ci ...@@ -159,7 +152,7 @@ module Ci
instance_type instance_type
], ],
remove_duplicates: false remove_duplicates: false
).allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/336433') )
end end
scope :assignable_for, ->(project) do scope :assignable_for, ->(project) do
......
...@@ -1775,17 +1775,12 @@ class Project < ApplicationRecord ...@@ -1775,17 +1775,12 @@ class Project < ApplicationRecord
def all_runners def all_runners
Ci::Runner.from_union([runners, group_runners, shared_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 end
def all_available_runners def all_available_runners
Ci::Runner.from_union([runners, group_runners, available_shared_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 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 def active_runners
strong_memoize(:active_runners) do strong_memoize(:active_runners) do
all_available_runners.active all_available_runners.active
...@@ -1793,9 +1788,7 @@ class Project < ApplicationRecord ...@@ -1793,9 +1788,7 @@ class Project < ApplicationRecord
end end
def any_online_runners?(&block) 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)
online_runners_with_tags.any?(&block)
end
end end
def valid_runners_token?(token) def valid_runners_token?(token)
......
...@@ -99,17 +99,15 @@ module Ci ...@@ -99,17 +99,15 @@ module Ci
private private
def tick_for(build, runners) 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_recent_runner_queue runners = runners.with_tags if Feature.enabled?(:ci_preload_runner_tags, default_enabled: :yaml)
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| runners.each do |runner|
metrics.increment_runner_tick(runner) metrics.increment_runner_tick(runner)
runner.pick_build!(build) runner.pick_build!(build)
end
end end
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 ...@@ -239,44 +239,20 @@ RSpec.describe Ci::Runner do
end end
end end
context 'when ci_decompose_belonging_to_parent_group_of_project_query is enabled' do context 'when use_traversal_ids* are enabled' do
context 'when use_traversal_ids* are enabled' do it_behaves_like '.belonging_to_parent_group_of_project'
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 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 before do
stub_feature_flags(ci_decompose_belonging_to_parent_group_of_project_query: false) stub_feature_flags(
end use_traversal_ids: false,
use_traversal_ids_for_ancestors: false,
context 'when use_traversal_ids* are enabled' do use_traversal_ids_for_ancestor_scopes: false
it_behaves_like '.belonging_to_parent_group_of_project' )
end end
context 'when use_traversal_ids* are disabled' do it_behaves_like '.belonging_to_parent_group_of_project'
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 end
describe '.owned_or_instance_wide' do 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