-
- Downloads
Automatically index projects in Zoekt when namespace is enabled
Zoekt is a new code search database being gradually rolled out on GitLab.com . It is intended to replace Elasticsearch for code search. We use the `::Zoekt::IndexedNamespace` model as a way to keep track of namespaces that are enabled as part of our rollout of using Zoekt for code search. When we implemented this we did not automate the indexing of the projects when this was enabled and we had this as another manual step as part of the rollout. Now that we're building APIs to enable a namespace in !116650 we want this to also automatically index all the projects in the namespace when it is enabled. This MR just adds an after create hook on the model to trigger a Sidekiq worker which then loops through all projects in the namespace and triggers another Sidekiq worker to do the indexing. This is larger a copy of the way we do it with the `ElasticNamespaceIndexerWorker` and as such we have added a 2nd argument to the worker which will be used in the future to handle deletes. This change also required removing `sidekiq_inline` and tweaking some specs a little to avoiding the indexing requests being sent to Zoekt when creating a `::Zoekt::IndexedNamespace`. Changelog: added EE: true MR: !117634
parent
77df645e
No related branches found
No related tags found
Showing
- config/sidekiq_queues.yml 2 additions, 0 deletionsconfig/sidekiq_queues.yml
- ee/app/models/zoekt/indexed_namespace.rb 8 additions, 0 deletionsee/app/models/zoekt/indexed_namespace.rb
- ee/app/workers/all_queues.yml 9 additions, 0 deletionsee/app/workers/all_queues.yml
- ee/app/workers/search/zoekt/namespace_indexer_worker.rb 37 additions, 0 deletionsee/app/workers/search/zoekt/namespace_indexer_worker.rb
- ee/spec/lib/gitlab/zoekt/search_results_spec.rb 1 addition, 1 deletionee/spec/lib/gitlab/zoekt/search_results_spec.rb
- ee/spec/models/concerns/zoekt/searchable_repository_spec.rb 2 additions, 13 deletionsee/spec/models/concerns/zoekt/searchable_repository_spec.rb
- ee/spec/models/zoekt/indexed_namespace_spec.rb 11 additions, 0 deletionsee/spec/models/zoekt/indexed_namespace_spec.rb
- ee/spec/workers/search/zoekt/namespace_indexer_worker_spec.rb 51 additions, 0 deletions...pec/workers/search/zoekt/namespace_indexer_worker_spec.rb
Please register or sign in to comment