Replace ci_runners with partitioned table

Once all the data is in place, we need to follow the last step in the process and call replace_with_partitioned_table and set Ci::Runner.primary_key = [:id, :runner_type] so that all future data is read/written to the partitioned table.

  • Adapt FKs:
    • ci_running_builds.runner_id will need to point to ci_runners_e59bb2812d
    • Instance runners:
      • Make ci_cost_settings's fk_rails_6a70651f75 reference instance_type_ci_runners_e59bb2812d table, since this table only applies to instance runners.
    • Group runners:
      • Add an LFK pointing to namespaces.
      • Make ci_runner_namespaces's fk_rails_8767676b7a reference group_type_ci_runners_e59bb2812d table, since this table only applies to group runners.
    • Project runners:
      • Add an LFK pointing to projects.
      • ci_runner_projects doesn't have a FK pointing to ci_runners. We can add a new FK pointing to project_type_ci_runners_e59bb2812d, after ensuring that no records exist that point to missing project runners.

Links

Spike MR demonstrating process: Draft: Spike for replacement of partitioned run... (!179605 - closed)

Edited by Pedro Pombeiro