S Add sharding key YAML config to ci_runner_machines
What we need to do
The ci_runner_machines has runner_id, so should ensure that ci_runner_machines uses the same sharding key as ci_runners.
How to do it
-
#497526 (closed): Add partitioning column runner_type.-
Backfill runner_type- Update the app to populate
runner_typefor new runner managers
- Update the app to populate
-
Post-backfill cleanup (Release N+1)
-
-
#497526 (closed): Add sharding_key_idcolumn toci_runnerstable-
Backfill sharding_key_id- Update the app to populate
sharding_key_idfor new runner managers
- Update the app to populate
-
!169964 (merged): Post-backfill cleanup (Release N+1) -
Optional if we take the approach of only copying valid records to the partitioned table.-
Delete invalid records. -
Validate sharding key constraints.
-
-
-
#497562 (closed): Create routing table and its 3 partitions: - Create
p_ci_runner_managersrouting table, and its 3 partitions:-
instance_type_ci_runner_managerswill be attached to partition 1, and will be exempt from sharding. -
group_type_ci_runner_managerswill be attached to partition 2, and will be sharded bynamespace: namespace_id. -
project_type_ci_runner_managerswill be attached to partition 3, and will be sharded byproject: project_id.
-
- Mimic LFK definitions from
ci_runner_machinesinconfig/gitlab_loose_foreign_keys.ymlfor the newp_ci_runner_machines. - Create triggers to keep
ci_runner_machinesand each of the partitioned tables in sync.
- Create
-
Copy data to partitioned table ( enqueue_partitioning_data_migration).-
Backfill ci_runner_machines_687967fa8a table (#502934 - closed). This is estimated to take less than half an hour on .com.
- after next required stop (%17.9):
-
-
Delete records on ci_runner_machines_687967fa8athat don't exist inci_runners_e59bb2812d, so we can validate thefk_rails_3f92913d27FK constraint. -
Recreate foreign key constraints from ci_runner... (#502403 - closed) (%17.8) -
#504965 (closed): Call replace_with_partitioned_tableand setCi::RunnerManager.primary_key = [:runner_type, :id]. -
Mark db/docs/ci_runner_machines.ymlasexempt_from_sharding: true. This will affect Org mover as it is planned to skipexempt_from_shardingtables from org mover. -
Delete DeleteOrphanedPartitionedCiRunnerMachine... (#504282 - closed), non-.com (%18.0) -
#516060 (closed): Once everything is verified to be running as expected, drop ci_runner_machinestable. -
#503749 (closed): Validate fk_rails_3f92913d27FK constraint (%18.3). -
Add organization_id column to runner tables (#523694 - closed) -
Add logic to validate organization_id field in ... (#548139 - closed) -
Finalize organization_id backfill migrations (#523850 - closed) -
Validate fk_rails_3f92913d27 FK constraint on c... (#503749 - closed) -
Finalize reintroduced BBM that deleted orphaned... (#530612 - closed) -
Add check_organization_id_nullness constraint c... (#523851 - closed) -
Validate check_organization_id_nullness constra... (#523852 - closed) -
Column organization_id on runner tables should ... (#525293 - closed) -
Ignore sharding_key_id column in runner models (#547654 - closed) -
Drop sharding_key_id column from runner tables (#547650 - closed) ...
Edited by Pedro Pombeiro