Skip to content

Force reindexing of wikis does not delete the existing documents

What does this MR do and why?

Disable the routing when the wiki gets force reindexed:

ee/lib/elastic/latest/git_instance_proxy.rb: Return nil when is_wiki is true

Add optional argument options = {} in the workers ElasticDeleteGroupWikiWorker and ElasticDeleteProjectWorker. With options, we can send namespace_routing_id to direct the deletion in the specific namespace routing

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  • Ensure Elasticsearch is enabled
  • Create a project wiki.
  • Ensure the document gets indexed on Elastic. You can use the following curl command by replacing the project_id in which you have created the wiki
curl -XGET "http://localhost:9200/gitlab-development-wikis/_search" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d'
{
  "query": {
    "bool": {
      "filter": [
        { "term": { "rid": "wiki_project_#{project_id}" } }
      ]
    }
  }
}' | json_pp
  • Now move the project to a different namespace
  • And again run the above curl command. Verify that the count of documents is still the same. And the id in _routing is the new namespace id of the project.

Perform the above same test for group wiki by creating a group wiki and moving to a different namespace. The curl command for the group wiki is the following

curl -XGET "http://localhost:9200/gitlab-development-wikis/_search" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d'
{
  "query": {
    "bool": {
      "filter": [
        { "term": { "rid": "wiki_group_#{group_id}" } }
      ]
    }
  }
}' | json_pp

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #422693 (closed)

Edited by Ravi Kumar

Merge request reports