Skip to content

Reindex work_items to fix archived

Ravi Kumar requested to merge 418792-reindex-work_items into master

What does this MR do and why?

There was a bug when Elasticsearch data for work_items were not getting updated when the project gets archived/unarchived. The bug will be fixed here Maintain elasticsearch for work_items on Projec... (!127995 - merged), this migration will fix the archived value of the work_items documents.

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
  • Run the following curl command and ensure the count is non-zero. If it is zero then just create a work_item(task) and then check it again.
curl -XGET "http://localhost:9200/gitlab-development-issues/_count" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d'
{
  "query": {
    "bool": {
      "filter": [
        { "range": { "schema_version": { "lt": 2308 } } },
        { "term": { "type": "work_item" } }
      ]
    }
  }
}' | json_pp
  • Open the rails console
bundle exec rails c
  • Run the following command
Elastic::DataMigrationService[20230731225441].send(:migration).migrate
  • And then again run the above curl command and ensure the count is 0.

MR acceptance checklist

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

Runtime

~ 20 minutes

Related to #418792 (closed)

Related to #420307 (closed)

Edited by Ravi Kumar

Merge request reports