Skip to content

Fix max number of slices

Dmitry Gruzd requested to merge 420895-fix-max-number-of-slices into master

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
}

#420895 (closed)

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

  1. Check out master
  2. Run curl -XDELETE 'http://localhost:9200/gitlab-development-migrations/_doc/20230530500000'
  3. Ensure that Elastic::DataMigrationService[20230530500000].send(:migration).migrate doesn't raise an exception
  4. Update the number of shards for your indices to 1
  5. Reindex your instance
  6. curl -XDELETE 'http://localhost:9200/gitlab-development-migrations/_doc/20230530500000'
  7. Ensure that Elastic::DataMigrationService[20230530500000].send(:migration).migrate raises an exception
  8. Checkout the branch of this MR
  9. Run curl -XDELETE 'http://localhost:9200/gitlab-development-migrations/_doc/20230530500000'
  10. 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.

Edited by Dmitry Gruzd

Merge request reports

Loading