Advanced Search migration not handling indexing already paused
Summary
Advanced Search migrations have the option to pause_indexing!
or not. If the migration does not pause indexing AND indexing is already paused through the Admin UI (or rails console), the migration will not work and the user is prevented from un-pausing indexing in the UI because pending migrations exist.
Steps to reproduce
- Pause indexing in the Admin UI
- Create a test migration that kicks off indexing for a record, make sure the completed? method always returns false.
- Kick off indexing worker via the rails console:
Elastic::MigrationWorker.perform_async
- monitor the
elasticsearch.log
file to see that no indexing is taking place and items are just being queued
What is the current bug behavior?
The ElasitcCommitIndexerWorker will not run the perform method if indexing is paused (see ee/app/workers/concerns/elastic/indexing_control.rb). Users cannot unpause via the UI and the migration will run forever because it never completes.
What is the expected correct behavior?
Migrations should run and complete.
Relevant logs and/or screenshots
Slack discussion: https://gitlab.slack.com/archives/C3TMLK465/p1622724442135800
Zendesk ticket: https://gitlab.zendesk.com/agent/tickets/216116
Possible fixes
The Migration Worker should check if indexing is paused regardless of whether the migration file utilizes pause_indexing!
or not and store that value in the migration. If indexing is paused AND the migration does not require indexing to be paused, we should unpause it and reset it back once the migration is completed.