Skip to content

Rebalance partition_id for ci_pipelines

Ref: #387301 (closed)

What does this MR do and why?

Rebalance partition_id for ci_pipelines.

This MR updates all invalid records in production and sets the partition_id to 100.

Database

I choose a default batch size of 2_000 and a sub batch size of 200 as suggested by @krasio as we have 200K records to fix.

📝 This seems to be the query executed by our background migration and its associated query plan.

UPDATE ci_builds
SET partition_id = 100, lock_version = COALESCE(lock_version, 0) + 1
WHERE ci_builds.id BETWEEN 1 AND 2
AND ci_builds.partition_id = 101
AND ci_builds.id >= 2

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Max Orefice

Merge request reports