Skip to content

Fix the indexing when project_feature get changes

What does this MR do and why?

  • For maintaining the elasticsearch index, we checked the repository_access_level changes on the project object, which is wrong. It should be checked on the project_feature object. In addition, I am also adding check for wiki_access_level.
  • Implemented the force option in ElasticWikiIndexerWorker. Sending force: true when the project needs backfilling. Whenever we change anything on the project level like visibility levels or move the project from one namespace to another then we must do the force reindexing of the whole repository
  • Then Bumped the GITLAB_ELASTICSEARCH_INDEXER_VERSION. In the new version, I am updating the SCHEMA_VERSION of the wiki_blobs. Means all the wikis which will be indexed from now will have correct values and a new SCHEMA_VERSIOn. Later on, I will write a migration to update all the wikis which have the old SCHEMA_VERSION(old SCHEMA_VERSION means they have the wrong values).

How to set up and validate locally

  1. Make sure the elasticsearch is enabled. Navigate to the elasticsearch settings and make sure the two checkboxes Elasticsearch indexing and Search with Elasticsearch enabled under the Advanced Search are enabled.
  2. Update the visibility level of a project with the wiki.
  3. Ensure on the elasticsearch that visibility_level for the wiki and commits index gets updated correctly
curl -XGET "http://localhost:9200/gitlab-development-wikis/_search" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d' | json_pp
curl -XGET "http://localhost:9200/gitlab-development-commits/_search" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d' | json_pp
  1. Update the wiki visibility of a project with the wiki.
  2. Ensure on the elasticsearch that the wiki_access_level for the wiki index gets updated correctly.
curl -XGET "http://localhost:9200/gitlab-development-wikis/_search" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d' | 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 #410777

Edited by Ravi Kumar

Merge request reports

Loading