Skip to content

Fix single-index invocation

Andreas Brandl requested to merge ab/reindex-single into master

What does this MR do?

This fixes a bug with reindexing a single specific index, which runs into the following exception:

rake aborted!
NoMethodError: undefined method `not_recently_reindexed' for #<Array:0x00007f7ff144be20>
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/reindexing/index_selection.rb:31:in `filter_candidates'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/reindexing/index_selection.rb:27:in `indexes'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/reindexing/index_selection.rb:9:in `each'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/reindexing.rb:11:in `take'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/reindexing.rb:11:in `perform'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:201:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:db:reindex
(See full trace by running task with --trace)

Later, we may not want to have index-selection on the specific index - so this is really just fixing the error.

Additionally, we allow to set an env variable here to log any SQL queries to console. This has been helpful today - later, we may want to log this into a defined file.

Does this MR meet the acceptance criteria?

Conformity

Edited by Andreas Brandl

Merge request reports