Skip to content

Advanced Search: Adapt reindexing to multiple indices support

What does this MR do?

This MR is based on work from !48334 (merged) and adds support for Zero-downtime reindexing feature with multiple indices.

  • we create a new table elastic_reindexing_subtasks and migrate current tasks into this table
  • Elastic::ClusterReindexingService is updated to support multiple indices for 1 migration task
  • Elasticsearch zero-downtime reindexing section is updated to show progress for each index.

#290956 (closed)

DB Migration

Production database has 0 records in elastic_reindexing_tasks. For self-managed instances I'd expect < 10 records.

output
❯ VERSION=20201217132603 rake db:migrate:up
== 20201217132603 CreateElasticReindexingSubtasks: migrating ==================
-- create_table(:elastic_reindexing_subtasks)
   -> 0.0137s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0001s
-- execute("ALTER TABLE elastic_reindexing_subtasks\nADD CONSTRAINT check_a1fbd9faa9\nCHECK ( char_length(index_name_from) <= 255 )\nNOT VALID;\n")
   -> 0.0003s
-- current_schema()
   -> 0.0001s
-- execute("SET statement_timeout TO 0")
   -> 0.0001s
-- execute("ALTER TABLE elastic_reindexing_subtasks VALIDATE CONSTRAINT check_a1fbd9faa9;")
   -> 0.0007s
-- execute("RESET ALL")
   -> 0.0001s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_subtasks\nADD CONSTRAINT check_f456494bd8\nCHECK ( char_length(index_name_to) <= 255 )\nNOT VALID;\n")
   -> 0.0003s
-- current_schema()
   -> 0.0001s
-- execute("ALTER TABLE elastic_reindexing_subtasks VALIDATE CONSTRAINT check_f456494bd8;")
   -> 0.0006s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_subtasks\nADD CONSTRAINT check_4910adc798\nCHECK ( char_length(elastic_task) <= 255 )\nNOT VALID;\n")
   -> 0.0003s
-- current_schema()
   -> 0.0001s
-- execute("ALTER TABLE elastic_reindexing_subtasks VALIDATE CONSTRAINT check_4910adc798;")
   -> 0.0007s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_subtasks\nADD CONSTRAINT check_88f56216a4\nCHECK ( char_length(alias_name) <= 255 )\nNOT VALID;\n")
   -> 0.0004s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE elastic_reindexing_subtasks VALIDATE CONSTRAINT check_88f56216a4;")
   -> 0.0007s
== 20201217132603 CreateElasticReindexingSubtasks: migrated (0.0547s) =========

❯ VERSION=20201217132603 rake db:migrate:down
== 20201217132603 CreateElasticReindexingSubtasks: reverting ==================
-- drop_table(:elastic_reindexing_subtasks)
   -> 0.0075s
== 20201217132603 CreateElasticReindexingSubtasks: reverted (0.0075s) =========

Screenshots (strongly suggested)

Screenshot_2020-12-22_at_16.04.29

image

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #290956 (closed)

Edited by Terri Chu

Merge request reports