Add database reindexing cronjob
What does this MR do?
This change adds a cronjob to trigger database reindexing. See &3989 for background.
By default this is disabled, we can enable it once proven successful on GitLab.com. Furthermore, we target weekend hours by default since this is likely a low-traffic period (this is configurable).
The config looks like so:
default['gitlab']['gitlab-rails']['database_reindexing']['enable'] = false
default['gitlab']['gitlab-rails']['database_reindexing']['hour'] = '*'
default['gitlab']['gitlab-rails']['database_reindexing']['minute'] = 0
default['gitlab']['gitlab-rails']['database_reindexing']['day_of_week'] = '0,6'
Importantly, as discussed in gitlab#249662 (comment 415074743), this needs to run on a Rails node that connects directly to the database and does not go through pgbouncer (otherwise the reindexing will just fail).
On GitLab.com, this will be the "deploy" nodes. The idea for now is to provide this cookbook and include this in the runbooks for our deploy nodes. Later, we'll have to figure out how to do this for a standard installation.
This calls the reindexing rake task once per hour. The rake task is going to make sure there is only one instance at a time globally (in case things take longer than expected).
Related issues
Change for gstg: https://ops.gitlab.net/gitlab-cookbooks/chef-repo/-/merge_requests/4306
Checklist
See Definition of done.
For anything in this list which will not be completed, please provide a reason in the MR discussion
Required
-
Merge Request Title, and Description are up to date, accurate, and descriptive -
MR targeting the appropriate branch -
MR has a green pipeline on GitLab.com -
Pipeline is green on dev.gitlab.org if the change is touching anything besides documentation or internal cookbooks -
trigger-package
has a green pipeline running against latest commit
Expected (please provide an explanation if not completing)
-
Test plan indicating conditions for success has been posted and passes -
Documentation created/updated -
Tests added -
Integration tests added to GitLab QA -
Equivalent MR/issue for the GitLab Chart opened => gitlab-org/charts/gitlab#2330