Add zoekt:reindex_failed_projects Rake task
What does this MR do and why?
Implements #550345 (closed).
Adds a Rake task gitlab:zoekt:reindex_failed_projects that allows admins to retry indexing of failed zoekt_repository records. Indexing can fail for various reasons (e.g., a repository with too many files). Over time, the number of files may be reduced, so a mechanism to retry is needed.
How it works
The task moves all failed zoekt_repository records to pending state with retries_left set to 1, so they are picked up by the next indexing cycle.
An optional comma-separated list of project IDs can be passed to limit which failed repositories are retried.
Usage
Retry all failed repositories:
gitlab-rake gitlab:zoekt:reindex_failed_projectsRetry only specific projects:
gitlab-rake "gitlab:zoekt:reindex_failed_projects[1,2,3]"MR acceptance checklist
- This MR follows the GitLab Contributing Guidelines
- I have performed a self-review of this MR
- I have added tests for this change
- I have added documentation for this change
Changes
ee/app/services/search/zoekt/indexing_settings_service.rb: Addreindex_failed_projectsmethod that processes failed repositories in batchesee/app/services/search/zoekt/rake_task_executor_service.rb: Registerreindex_failed_projectstask and delegate toIndexingSettingsServiceee/lib/search/rake_task/zoekt.rb: Addreindex_failed_projectsclass methodee/lib/tasks/gitlab/zoekt.rake: Add Rake task definition with optionalproject_idsargumentdoc/integration/zoekt/_index.md: Document the new Rake task- Specs for all new code
Query report
Worst-case scenario
https://console.postgres.ai/gitlab/gitlab-production-main/sessions/52445/commands/153920
Edited by Ravi Kumar