Return false for pending_migrations? if indexing disabled

What does this MR do and why?

This MR changes the behavior of Elastic::DataMigrationService.pending_migrations? to return false if elasticsearch_indexing application setting is false.

That method is called in a few places so specs that cover those areas have been updated.

Additionally, this MR updates cron workers and services used by zero downtime redindexing to return early if indexing is disabled. Zero downtime reindexing is used to prevent data loss when moving indexed data from one index to another. If indexing is disabled in the instance, data loss will occur because newly indexed data won't be tracked and indexed once zero downtime reindexing is done.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

❯      bundle exec rake gitlab:elastic:reindex_cluster

DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/terrichu/projects/gitlab-development-kit/gitlab/config/environment.rb:7)
WARNING: Setting `elasticsearch_indexing` is disabled. This setting must be enabled to perform `reindex_cluster`.

How to set up and validate locally

  1. setup gdk for elasticsearch
  2. disable advanced search indexing, from rails console:
      ApplicationSetting.last.update!(elasticsearch_indexing: false)
  3. run the reindex rake task
      bundle exec rake gitlab:elastic:reindex_cluster
  4. verify that you get a warning back that elasticsearch_indexing is disabled
  5. from the admin UI, run a reindex operation
  6. run this in rails console to kick the process of
      ::Search::Elastic::ClusterReindexingService.new.execute
  7. verify an error is shown for the status

image

Edited by Terri Chu

Merge request reports

Loading