Skip to content

Bulk deletes should respect search_index_all_projects FF

Terri Chu requested to merge tchu-fix-projects-deleted-from-index into master

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

  1. enable elasticsearch on gdk and index everything
  2. choose a root level namespace, I used 107
  3. 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
  4. In rails console enable the flag
    echo "::Feature.enable(:search_index_all_projects)" | gdk rails c
  5. run the worker
    ElasticNamespaceIndexerWorker.new.perform(107, :delete)
  6. 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
  7. In rails console disable the flag
    echo "::Feature.disable(:search_index_all_projects)" | gdk rails c
  8. run the worker
    ElasticNamespaceIndexerWorker.new.perform(107, :delete)
  9. 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
Edited by Terri Chu

Merge request reports