Wrap up CI partition management
Ref: #454978 (closed)
What does this MR do and why?
This MR hooks up the last pieces together in order to introduce our CI partition automation framework
.
Once we will enable our feature flag , this will create a new ci_partition
record and the associated database partitions for CI models if one given partition > 100 GB.
It will then switch the writes to this new partition when everything has been provisioned correctly.
This feature is behind a feature flag ci_partitioning_automation
.
How to test this locally?
1. Tweak Ci::Partition::MAX_PARTITION_SIZE = 1.byte
2. Enable those 3 FF
* Feature.enable(:ci_current_partition_value_102) # used to set up the current partition correctly
* Feature.enable(:ci_partitioning_first_records) # used to populate the first records
* Feature.enable(:ci_partitioning_automation) # used to create ci_partition dynamically
3. Run those 2 workers to simulate how the system will work on production
* Ci::PartitioningWorker.new.perform # this is executed once a day
* Gitlab::Database::Partitioning.sync_partitions # this is executed 4 times a day
How verify this locally?
1. Ci::Partition.all
2. Verify all new records are being created and updated successfully
gdk psql -d gitlabhq_development_ci
Verify all Ci partitioned tables have new partitions created successfully
\d+ p_ci_pipelines_variables
\d+ p_ci_builds_names
...
Edited by Max Orefice