Commit ca7fc5f7 authored by Terri Chu's avatar Terri Chu Committed by Mark Chao

Remove ElasticIndexerWorker in major release [RUN AS-IF-FOSS]

parent 23f945c4
...@@ -2507,7 +2507,6 @@ Gitlab/NamespacedClass: ...@@ -2507,7 +2507,6 @@ Gitlab/NamespacedClass:
- 'ee/app/workers/elastic_full_index_worker.rb' - 'ee/app/workers/elastic_full_index_worker.rb'
- 'ee/app/workers/elastic_index_bulk_cron_worker.rb' - 'ee/app/workers/elastic_index_bulk_cron_worker.rb'
- 'ee/app/workers/elastic_index_initial_bulk_cron_worker.rb' - 'ee/app/workers/elastic_index_initial_bulk_cron_worker.rb'
- 'ee/app/workers/elastic_indexer_worker.rb'
- 'ee/app/workers/elastic_indexing_control_worker.rb' - 'ee/app/workers/elastic_indexing_control_worker.rb'
- 'ee/app/workers/elastic_namespace_indexer_worker.rb' - 'ee/app/workers/elastic_namespace_indexer_worker.rb'
- 'ee/app/workers/elastic_namespace_rollout_worker.rb' - 'ee/app/workers/elastic_namespace_rollout_worker.rb'
......
...@@ -120,8 +120,6 @@ ...@@ -120,8 +120,6 @@
- 1 - 1
- - elastic_full_index - - elastic_full_index
- 1 - 1
- - elastic_indexer
- 1
- - elastic_indexing_control - - elastic_indexing_control
- 1 - 1
- - elastic_namespace_indexer - - elastic_namespace_indexer
......
...@@ -38,11 +38,11 @@ To start multiple processes: ...@@ -38,11 +38,11 @@ To start multiple processes:
process, and values in each item determine the queues it works on. process, and values in each item determine the queues it works on.
For example, the following setting creates three Sidekiq processes, one to run on For example, the following setting creates three Sidekiq processes, one to run on
`elastic_indexer`, one to run on `mailers`, and one process running on all queues: `elastic_commit_indexer`, one to run on `mailers`, and one process running on all queues:
```ruby ```ruby
sidekiq['queue_groups'] = [ sidekiq['queue_groups'] = [
"elastic_indexer", "elastic_commit_indexer",
"mailers", "mailers",
"*" "*"
] ]
...@@ -53,7 +53,7 @@ To start multiple processes: ...@@ -53,7 +53,7 @@ To start multiple processes:
```ruby ```ruby
sidekiq['queue_groups'] = [ sidekiq['queue_groups'] = [
"elastic_indexer, elastic_commit_indexer", "elastic_commit_indexer, elastic_association_indexer",
"mailers", "mailers",
"*" "*"
] ]
......
...@@ -26,7 +26,7 @@ you want using steps 1 and 2 from the GitLab downloads page. ...@@ -26,7 +26,7 @@ you want using steps 1 and 2 from the GitLab downloads page.
## Optional: Enable extra Sidekiq processes ## Optional: Enable extra Sidekiq processes
sidekiq_cluster['enable'] = true sidekiq_cluster['enable'] = true
sidekiq['queue_groups'] = [ sidekiq['queue_groups'] = [
"elastic_indexer", "elastic_commit_indexer",
"*" "*"
] ]
``` ```
......
...@@ -622,7 +622,7 @@ Sidekiq processes](../administration/operations/extra_sidekiq_processes.md). ...@@ -622,7 +622,7 @@ Sidekiq processes](../administration/operations/extra_sidekiq_processes.md).
This enqueues a Sidekiq job for each project that needs to be indexed. This enqueues a Sidekiq job for each project that needs to be indexed.
You can view the jobs in **Admin Area > Monitoring > Background Jobs > Queues Tab** You can view the jobs in **Admin Area > Monitoring > Background Jobs > Queues Tab**
and click `elastic_indexer`, or you can query indexing status using a Rake task: and click `elastic_commit_indexer`, or you can query indexing status using a Rake task:
```shell ```shell
# Omnibus installations # Omnibus installations
......
...@@ -941,15 +941,6 @@ ...@@ -941,15 +941,6 @@
:weight: 1 :weight: 1
:idempotent: :idempotent:
:tags: [] :tags: []
- :name: elastic_indexer
:worker_name: ElasticIndexerWorker
:feature_category: :global_search
:has_external_dependencies:
:urgency: :throttled
:resource_boundary: :unknown
:weight: 1
:idempotent:
:tags: []
- :name: elastic_indexing_control - :name: elastic_indexing_control
:worker_name: ElasticIndexingControlWorker :worker_name: ElasticIndexingControlWorker
:feature_category: :global_search :feature_category: :global_search
......
# frozen_string_literal: true
# Usage of this worker is deprecated, please remove it in the next major version
class ElasticIndexerWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: 2
feature_category :global_search
urgency :throttled
loggable_arguments 0, 1, 4
def perform(operation, class_name, record_id, es_id, options = {})
return true unless Gitlab::CurrentSettings.elasticsearch_indexing?
klass = class_name.constantize
record = klass.find(record_id)
case operation.to_s
when /index/
record.maintain_elasticsearch_create
when /update/
record.maintain_elasticsearch_update
when /delete/
record.maintain_elasticsearch_destroy
end
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ElasticIndexerWorker do
subject { described_class.new }
describe '#perform' do
context 'indexing is enabled' do
using RSpec::Parameterized::TableSyntax
let(:project) { instance_double(Project, id: 1, es_id: 1) }
before do
stub_ee_application_setting(elasticsearch_indexing: true)
expect(Project).to receive(:find).and_return(project)
end
where(:operation, :method) do
'index' | 'maintain_elasticsearch_create'
'update' | 'maintain_elasticsearch_update'
'delete' | 'maintain_elasticsearch_destroy'
end
with_them do
it 'calls respective methods' do
expect(project).to receive(method.to_sym)
subject.perform(operation, 'Project', project.id, project.es_id)
end
end
end
context 'indexing is disabled' do
before do
stub_ee_application_setting(elasticsearch_indexing: false)
end
it 'returns true if ES disabled' do
expect(Milestone).not_to receive(:find).with(1)
expect(subject.perform('index', 'Milestone', 1, 1)).to be_truthy
end
end
end
end
...@@ -212,7 +212,6 @@ RSpec.describe 'Every Sidekiq worker' do ...@@ -212,7 +212,6 @@ RSpec.describe 'Every Sidekiq worker' do
'ElasticCommitIndexerWorker' => 2, 'ElasticCommitIndexerWorker' => 2,
'ElasticDeleteProjectWorker' => 2, 'ElasticDeleteProjectWorker' => 2,
'ElasticFullIndexWorker' => 2, 'ElasticFullIndexWorker' => 2,
'ElasticIndexerWorker' => 2,
'ElasticIndexingControlWorker' => 3, 'ElasticIndexingControlWorker' => 3,
'ElasticNamespaceIndexerWorker' => 2, 'ElasticNamespaceIndexerWorker' => 2,
'ElasticNamespaceRolloutWorker' => 2, 'ElasticNamespaceRolloutWorker' => 2,
......
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