Skip to content

Refactor async index creation tasks

Marius Bobin requested to merge 389638-mb-async-index-improvements into master

What does this MR do and why?

Related to #389638

It adds two new rake tasks for handling async index execution, one for each database(the end goal is to use these tasks in production to create the indexes):

bin/rake gitlab:db:execute_async_index_operations:ci
bin/rake gitlab:db:execute_async_index_operations:ci[3] # optional param for how many instruction to execute per invocation, default 2
bin/rake gitlab:db:execute_async_index_operations:main
bin/rake gitlab:db:execute_async_index_operations:main[4]

It also adds new columns to the pending indexes table to skip indexes that fail creation and saves the error for later(> 1 week) debugging.

And one more task for ease of development:

bin/rake gitlab:db:execute_async_index_operations:all

invokes the tasks on each database, with a default pick of 1000. This should be used mostly for development to test the async index creation for migrations and it's using a large pick number because there might be other entries in the queue.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports