Automatically index projects in Zoekt when namespace is enabled
What does this MR do and why?
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 (merged) 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.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #389756 (closed)