Skip to content
代码片段 群组 项目
未验证 提交 bc7c7f98 编辑于 作者: Terri Chu's avatar Terri Chu 提交者: GitLab
浏览文件

Merge branch '434580-remove-elastic_index_use_trigger_indexing-ff' into 'master'

Remove elastic_index_use_trigger_indexing FF

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/159435



Merged-by: default avatarTerri Chu <tchu@gitlab.com>
Approved-by: default avatarmo khan <mo@mokhan.ca>
Approved-by: default avatarRutger Wessels <rwessels@gitlab.com>
Reviewed-by: default avatarmo khan <mo@mokhan.ca>
No related branches found
No related tags found
无相关合并请求
...@@ -771,7 +771,7 @@ The following are some available Rake tasks: ...@@ -771,7 +771,7 @@ The following are some available Rake tasks:
| Task | Description | | Task | Description |
|:--------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |:--------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`sudo gitlab-rake gitlab:elastic:info`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Outputs debugging information for the advanced search integration. | | [`sudo gitlab-rake gitlab:elastic:info`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Outputs debugging information for the advanced search integration. |
| [`sudo gitlab-rake gitlab:elastic:index`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | In GitLab 17.0 and earlier, enables Elasticsearch indexing and runs `gitlab:elastic:recreate_index`, `gitlab:elastic:clear_index_status`, `gitlab:elastic:index_group_entities`, `gitlab:elastic:index_projects`, `gitlab:elastic:index_snippets`, and `gitlab:elastic:index_users`.<br>In GitLab 17.1 and later, queues a Sidekiq job in the background. First, the job enables Elasticsearch indexing and pauses indexing to ensure all indices are created. Then, the job re-creates all indices, clears indexing status, and queues additional Sidekiq jobs to index project and group data, snippets, and users. Finally, Elasticsearch indexing is resumed to complete. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/421298) in GitLab 17.1 [with a flag](../../administration/feature_flags.md) named `elastic_index_use_trigger_indexing`. Enabled by default. | | [`sudo gitlab-rake gitlab:elastic:index`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | In GitLab 17.0 and earlier, enables Elasticsearch indexing and runs `gitlab:elastic:recreate_index`, `gitlab:elastic:clear_index_status`, `gitlab:elastic:index_group_entities`, `gitlab:elastic:index_projects`, `gitlab:elastic:index_snippets`, and `gitlab:elastic:index_users`.<br>In GitLab 17.1 and later, queues a Sidekiq job in the background. First, the job enables Elasticsearch indexing and pauses indexing to ensure all indices are created. Then, the job re-creates all indices, clears indexing status, and queues additional Sidekiq jobs to index project and group data, snippets, and users. Finally, Elasticsearch indexing is resumed to complete. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/421298) in GitLab 17.1 [with a flag](../../administration/feature_flags.md) named `elastic_index_use_trigger_indexing`. Enabled by default. [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/434580) in GitLab 17.3. Feature flag `elastic_index_use_trigger_indexing` removed. |
| [`sudo gitlab-rake gitlab:elastic:pause_indexing`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Pauses Elasticsearch indexing. Changes are still tracked. Useful for cluster/index migrations. | | [`sudo gitlab-rake gitlab:elastic:pause_indexing`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Pauses Elasticsearch indexing. Changes are still tracked. Useful for cluster/index migrations. |
| [`sudo gitlab-rake gitlab:elastic:resume_indexing`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Resumes Elasticsearch indexing. | | [`sudo gitlab-rake gitlab:elastic:resume_indexing`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Resumes Elasticsearch indexing. |
| [`sudo gitlab-rake gitlab:elastic:index_projects`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Iterates over all projects, and queues Sidekiq jobs to index them in the background. It can only be used after the index is created. | | [`sudo gitlab-rake gitlab:elastic:index_projects`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/lib/tasks/gitlab/elastic.rake) | Iterates over all projects, and queues Sidekiq jobs to index them in the background. It can only be used after the index is created. |
......
---
name: elastic_index_use_trigger_indexing
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/434590
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139300
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/434580
milestone: '16.8'
group: group::global search
type: beta
default_enabled: false
...@@ -6,50 +6,23 @@ namespace :gitlab do ...@@ -6,50 +6,23 @@ namespace :gitlab do
task index: :environment do task index: :environment do
raise 'This task cannot be run on GitLab.com' if ::Gitlab::Saas.feature_available?(:advanced_search) raise 'This task cannot be run on GitLab.com' if ::Gitlab::Saas.feature_available?(:advanced_search)
if Feature.enabled?(:elastic_index_use_trigger_indexing) # rubocop:disable Gitlab/FeatureFlagWithoutActor -- this ff cannot have an actor if ::Gitlab::CurrentSettings.elasticsearch_pause_indexing?
if ::Gitlab::CurrentSettings.elasticsearch_pause_indexing? stdout_logger.warn('WARNING: `elasticsearch_pause_indexing` is enabled. ' \
stdout_logger.warn('WARNING: `elasticsearch_pause_indexing` is enabled. ' \ 'This setting will be disabled to complete indexing'.color(:yellow))
'This setting will be disabled to complete indexing'.color(:yellow)) end
end
unless Gitlab::CurrentSettings.elasticsearch_indexing?
stdout_logger.warn('Setting `elasticsearch_indexing` is disabled. ' \
'This setting will been enabled to complete indexing.'.color(:yellow))
end
stdout_logger.info('Scheduling indexing with TriggerIndexingWorker')
# skip projects, all namespace and project data is handled by `namespaces` task
Search::Elastic::TriggerIndexingWorker.perform_in(1.minute,
Search::Elastic::TriggerIndexingWorker::INITIAL_TASK, { 'skip' => 'projects' })
stdout_logger.info("Scheduling indexing with TriggerIndexingWorker... #{'done'.color(:green)}")
else
# enable `elasticsearch_indexing` if it isn't
unless Gitlab::CurrentSettings.elasticsearch_indexing?
ApplicationSettings::UpdateService.new(
Gitlab::CurrentSettings.current_application_settings,
nil,
{ elasticsearch_indexing: true }
).execute
stdout_logger.info('Setting `elasticsearch_indexing` has been enabled.') unless Gitlab::CurrentSettings.elasticsearch_indexing?
end stdout_logger.warn('Setting `elasticsearch_indexing` is disabled. ' \
'This setting will been enabled to complete indexing.'.color(:yellow))
end
if ::Gitlab::CurrentSettings.elasticsearch_pause_indexing? stdout_logger.info('Scheduling indexing with TriggerIndexingWorker')
stdout_logger.warn('WARNING: `elasticsearch_pause_indexing` is enabled. ' \
'Disable this setting by running `rake gitlab:elastic:resume_indexing` ' \
'to complete indexing.'.color(:yellow))
end
Rake::Task['gitlab:elastic:recreate_index'].invoke # skip projects, all namespace and project data is handled by `namespaces` task
Rake::Task['gitlab:elastic:clear_index_status'].invoke Search::Elastic::TriggerIndexingWorker.perform_in(1.minute,
Search::Elastic::TriggerIndexingWorker::INITIAL_TASK, { 'skip' => 'projects' })
Rake::Task['gitlab:elastic:index_group_entities'].invoke stdout_logger.info("Scheduling indexing with TriggerIndexingWorker... #{'done'.color(:green)}")
Rake::Task['gitlab:elastic:index_projects'].invoke
Rake::Task['gitlab:elastic:index_snippets'].invoke
Rake::Task['gitlab:elastic:index_users'].invoke
end
end end
desc 'GitLab | Elasticsearch | Index Group entities' desc 'GitLab | Elasticsearch | Index Group entities'
......
...@@ -116,28 +116,10 @@ ...@@ -116,28 +116,10 @@
end end
context 'with elasticsearch_indexing is disabled' do context 'with elasticsearch_indexing is disabled' do
context 'when elastic_index_use_trigger_indexing is enabled' do it 'does not enable `elasticsearch_indexing`' do
before do expect { run_rake_task 'gitlab:elastic:index' }.not_to change {
stub_feature_flags(elastic_index_use_trigger_indexing: true) Gitlab::CurrentSettings.elasticsearch_indexing?
end }
it 'does not enable `elasticsearch_indexing`' do
expect { run_rake_task 'gitlab:elastic:index' }.not_to change {
Gitlab::CurrentSettings.elasticsearch_indexing?
}
end
end
context 'when elastic_index_use_trigger_indexing is disabled' do
before do
stub_feature_flags(elastic_index_use_trigger_indexing: false)
end
it 'enables `elasticsearch_indexing`' do
expect { run_rake_task 'gitlab:elastic:index' }.to change {
Gitlab::CurrentSettings.elasticsearch_indexing?
}.from(false).to(true)
end
end end
end end
...@@ -168,37 +150,6 @@ ...@@ -168,37 +150,6 @@
task task
end end
context 'when elastic_index_use_trigger_indexing is disabled' do
before do
stub_feature_flags(elastic_index_use_trigger_indexing: false)
end
it 'calls all indexing tasks in order' do
expect(Rake::Task['gitlab:elastic:recreate_index']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:clear_index_status']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_group_entities']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_projects']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_snippets']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_users']).to receive(:invoke).ordered
task
end
it 'outputs warning if indexing is paused and still runs all indexing tasks in order' do
stub_ee_application_setting(elasticsearch_pause_indexing: true)
expect(Rake::Task['gitlab:elastic:recreate_index']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:clear_index_status']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_group_entities']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_projects']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_snippets']).to receive(:invoke).ordered
expect(Rake::Task['gitlab:elastic:index_users']).to receive(:invoke).ordered
expect(logger).to receive(:warn).with(/WARNING: `elasticsearch_pause_indexing` is enabled/)
task
end
end
end end
end end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册