resume_indexing rake task missing preflight checks
The resume_indexing rake task does not perform the same validation checks as the web UI before allowing users to resume indexing. This could allow users to bypass important safeguards via the command line.
Current Behavior
The rake task in ee/app/services/search/rake_task_executor_service.rb:194-208 only checks whether indexing is currently paused before resuming it, without validating whether it's safe to do so.
Expected Behavior
The rake task should enforce the same constraints as the web UI (see ee/app/views/admin/application_settings/_elasticsearch_form.html.haml:44), which disables the "Resume indexing" option when:
-
Indexing is disabled (
!Gitlab::CurrentSettings.elasticsearch_indexing?) -
A migration requires paused indexing (a pending migration is running AND
pause_indexing?returns true) -
Reindexing is in progress (
Search::Elastic::ReindexingTaskhas an in-progress task)
Steps to Reproduce
- Start a reindexing task or have a pending migration that requires paused indexing
- Run
bundle exec rake gitlab:elastic:resume_indexing - The task resumes indexing despite the unsafe condition
Relevant Files
- Service:
ee/app/services/search/rake_task_executor_service.rb(lines 194-208) - Spec:
ee/spec/services/search/rake_task_executor_service_spec.rb(lines 207-239) - Web UI reference:
ee/app/views/admin/application_settings/_elasticsearch_form.html.haml(line 44 shows the correct checks)