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
range of sequences to use from the Topology Service. This range is used to set
minval
, maxval
for all existing and newly created sequence IDs.
Topology service uses the logic explained in here to compute the sequence range.
Alternatives
Below are the different solutions considered for this problem.
- Solution 1: Global Service to claim sequences
- Solution 2: Converting all int IDs to bigint to generate uniq IDs
- Solution 3: Using composite primary key [(existing PKs), original cell ID]
- Solution 4: Use bigint IDs only for Cell
- Solution 5: Using Logical replication
Last modified February 5, 2025: Update Cell Database Sequence ID Docs (
172c7141
)