Skip to content

Resolve "Introduce rake task to bump IDs of cell-local tables"

What does this MR do and why?

For #421902 (closed):

This MR introduces a rake task

rake gitlab:db:cells:bump_cell_sequences\[number\]

that increments the ID sequence of all tables belonging to the gitlab_main_cell schema.

We need this rake task so that we can bump the IDs of cell-local tables, across different cells so as to avoid collissions when these IDs are used to create associated records in the clusterwide tables.

We intend to use this only in local development environments, as described in gitlab-development-kit!3317 (merged)

Before:

gitlabhq_development=# select last_value from namespaces_id_seq;
 last_value
------------
       1005
(1 row)

gitlabhq_development=# select last_value from users_id_seq;
 last_value
------------
          1
(1 row)

After running rake task as:

rake gitlab:db:cells:bump_cell_sequences\[2000\]
gitlabhq_development=# select last_value from namespaces_id_seq;
 last_value
------------
       3006
(1 row)

gitlabhq_development=# select last_value from users_id_seq;
 last_value
------------
          1
(1 row)

/* users is not a cell-local table, so it's ID is not bumped. */

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Related to #421902 (closed)

Edited by Manoj M J

Merge request reports

Loading