Fix max number of slices
What does this MR do and why?
It turns out that a few of our migrations weren't handling indices with 1 shard correctly. This MR fixes it.
Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"x_content_parse_exception","reason":"[1:17] [slice] failed to parse field [max]"}],"type":"x_content_parse_exception","reason":"[1:351] [reindex] failed to parse field [source]","caused_by":{"type":"x_content_parse_exception","reason":"[1:17] [slice] failed to parse field [max]","caused_by":{"type":"illegal_argument_exception","reason":"max must be greater than 1"}}},"status":400
}
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
It's a bit tricky to test, but the closest test, which will break your project index, is
- Check out
master
- Run
curl -XDELETE 'http://localhost:9200/gitlab-development-migrations/_doc/20230530500000'
- Ensure that
Elastic::DataMigrationService[20230530500000].send(:migration).migrate
doesn't raise an exception - Update the number of shards for your indices to 1
- Reindex your instance
curl -XDELETE 'http://localhost:9200/gitlab-development-migrations/_doc/20230530500000'
- Ensure that
Elastic::DataMigrationService[20230530500000].send(:migration).migrate
raises an exception - Checkout the branch of this MR
- Run
curl -XDELETE 'http://localhost:9200/gitlab-development-migrations/_doc/20230530500000'
- Ensure that
Elastic::DataMigrationService[20230530500000].send(:migration).migrate
works correctly now
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.
Edited by Dmitry Gruzd