Rake gitlab:db:reindex errors out when statement timeout present
When testing on staging, I ran into:
D, [2020-09-18T10:30:39.898954 #19560] DEBUG -- : dropping dangling index from previous run: tmp_reindex_index_snippets_on_updated_at
rake aborted!
ArgumentError: wrong number of arguments (given 1, expected 0)
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/concurrent_reindex.rb:22:in `execute'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:283:in `ensure in disable_statement_timeout'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:283:in `disable_statement_timeout'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/concurrent_reindex.rb:131:in `remove_replacement_index'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/concurrent_reindex.rb:28:in `execute'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:174:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Which is a manifestation of the statement_timeout
not being set in development or CI, but present in other environments.
So in this case, we run into a different code path: https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/database/migration_helpers.rb#L270