Bulk deletes should respect search_index_all_projects FF
What does this MR do and why?
slack thread (internal)
A namespace was recently removed from the index from #439769 (closed) and a customer reported they could not find their projects in search. The projects should not have been deleted (even after subscription expiration) because the search_index_all_projects
feature flag is 100% enabled on GitLab.com
This MR fixes the bulk deletes to include the delete_project
flag which tells the ElasticDeleteProjectWorker
worker whether the keep or delete the project documents. When the flag is enabled, project documents are only deleted when the record is deleted from the database.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
N/A
How to set up and validate locally
- enable elasticsearch on gdk and index everything
- choose a root level namespace, I used 107
- search for all projects in the root namespace, verify you get results back
curl --request GET --url 'http://gdk.test:3000/api/v4/groups/107/search?scope=projects&search=*' --header 'Private-Token: YOURTOKEN' | jq
- In rails console enable the flag
echo "::Feature.enable(:search_index_all_projects)" | gdk rails c
- run the worker
ElasticNamespaceIndexerWorker.new.perform(107, :delete)
- search for all projects in the root namespace, verify you get results back
curl --request GET --url 'http://gdk.test:3000/api/v4/groups/107/search?scope=projects&search=*' --header 'Private-Token: YOURTOKEN' | jq
- In rails console disable the flag
echo "::Feature.disable(:search_index_all_projects)" | gdk rails c
- run the worker
ElasticNamespaceIndexerWorker.new.perform(107, :delete)
- search for all projects in a root namespace, verify you get 0 results back
curl --request GET --url 'http://gdk.test:3000/api/v4/groups/107/search?scope=projects&search=*' --header 'Private-Token: YOURTOKEN' | jq