Skip to content

Add flag to disable partition check on startup

Andreas Brandl requested to merge ab/partitioning-startup-flag into master

What does this MR do?

This adds an environment variable DISABLE_POSTGRES_PARTITION_CREATION_ON_STARTUP to disable postgres partition creation on startup (huh!). That is, we have a couple of places where we check if dynamic partitions are missing and create them accordingly: On application startup (initializer), in a sidekiq cron and elsewhere.

Now in the case of GitLab.com, we typically deploy often and the fleet of instances is quite large. That means, on restart of the application, a lot of processes would run their initializers and execute the partition check/creation logic.

In most if not all cases, this is not needed at all since the sidekiq cron takes care of this anyways.

So in this change, we introduce an environment variable which allows us to disable triggering this logic on each application startup.

Once merged, I'll setup a production change to add the env flag to the GitLab.com environment.

Edited by Andreas Brandl

Merge request reports