Prevents `alter_cell_sequences_range` rake to alters cell sequences for legacy cell

What does this MR do and why?

It prevents invoking alter_cell_sequences_range rake for Legacy Cell

  • Adds a new attribute to cells config to identify if the cell is a legacy.
  • It doesn't alter cell sequences when invoking alter_cell_sequences_range rake if the cell is marked as a legacy.

How to set up and validate locally

  1. Follow steps described in !170613 (merged). You should get the sequences range updated.

  2. Change your gitlab.yml. Update the first cell legacy to true

  cell:
    id: 0
    name: cell-0
    skip_sequence_alteration: true
  1. Run bin/rails gitlab:db:configure or bundle exec rake "gitlab:db:alter_cell_sequences_range[0,1000]".

  2. Check that sequences were not changed

gdk-psql

gitlabhq_development=# SELECT DISTINCT(min_value, max_value) FROM pg_sequences WHERE schemaname = 'public';
    row
------------
 (1,750000)
  1. Now, change your gitlab.yml again. Update the first cell skip_sequence_alteration to false

  2. Run bin/rails gitlab:db:configure or bundle exec rake "gitlab:db:alter_cell_sequences_range[0,1000]".

  3. Sequences now were changed

gdk-psql

gitlabhq_development=# SELECT DISTINCT(min_value, max_value) FROM pg_sequences WHERE schemaname = 'public';
   row
----------
 (0,1000)
(1 row)

Related to #500855 (closed)

Edited by Leonardo da Rosa

Merge request reports

Loading