Create a migration to backfill the archived field in milestone
What does this MR do and why?
This migration will backfill the archived
value for the milestones
.
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
- Make sure the Elasticsearch is enabled.
- Open the rails console
bundle exec rails c
- Run the following commands in the console.
require_relative 'ee/elastic/migrate/20230831152648_backfill_archived_on_milestones.rb'
BackfillArchivedOnNotes.new(20230831152648).migrate
- Check on the elastic that all the notes must have the
archived
. To check that run the following curl command on the terminal and make sure the count is0
curl -XGET "http://localhost:9200/gitlab-development/_count" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d'
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": "archived"
}
},
"filter": {
"term": {
"type": "milestone"
}
}
}
}
}' | json_pp
Run time
~5 minutes
[1] pry(main)> batch_size = 9_000
=> 9000
[2] pry(main)> throttle_delay = 10.seconds
=> 10 seconds
[3] pry(main)> number_of_documents = 278_023
=> 278023
[4] pry(main)> (number_of_documents / batch_size) * throttle_delay
=> 300 seconds
=> ~ 5 minutes
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #421464 (closed)
Edited by Ravi Kumar