Cells ADR 008: Cluster wide unique database sequences

Context

Having non-overlapping unique sequences across the cluster is necessary for moving organizations between cells, this was highlighted in core-platform-section/-/epics/3 and different solutions were discussed in https://gitlab.com/gitlab-org/core-platform-section/data-stores/-/issues/102.

Decision

All Cells will have bigint IDs on creation. While provisioning, each of them will get a large range of sequences to use from the Topology Service. On decommissioning the cell, these ranges will be returned back to the topology service. If the returned range is large enough for another cell, it could be handed out to them so that the short-lived cells won’t exhaust large parts of the key range.

We will update the Legacy Cell’s sequence to have a maxval, it will be a minimum possible range to make sure it won’t collide with any Cells.

Consequences

The above decision will support till Cells 1.5 but not Cells 2.0.

To support Cells 2.0 (i.e: allow moving organizations from Cells to the Legacy Cell), we need all integer IDs in the Legacy Cell to be converted to bigint. Which is an ongoing effort as part of core-platform-section/data-stores/-/issues/111 and it is estimated to take around 12 months.

Alternatives

In addition to the earliest proposal, we evaluated below solutions before making the final decision.

Last modified September 2, 2024: Rename Primary Cells and Secondary Cells (cffb2d17)