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 secondary 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 primary cell's sequence to have a maxval
, it will be a minimum possible range to make sure it
won't collide with any secondary 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
secondary cells to the primary), we need all integer IDs in the primary 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.