Fixes bug in db:increase_sequences_range
What does this MR do and why?
There was an event trigger (alter_new_sequences_range) created to apply the initial sequence_range given for the cell for all newly created sequences.
It had the below snippet, the condition (current_minval != #{minval} OR current_maxval != #{maxval}) will also be true while bumping the sequence range from gitlab:db:increase_sequences_range, so it ended up reverting back to the initial sequence_range assigned to the cell.
SELECT min_value, max_value INTO current_minval, current_maxval FROM pg_sequences
WHERE sequencename = sequence_name;
IF current_minval != #{minval} OR current_maxval != #{maxval} THEN
RAISE NOTICE 'Altering sequence "%" with range [%, %]', sequence_name, #{minval}, #{maxval};
EXECUTE FORMAT('ALTER SEQUENCE %I START %s RESTART %s MINVALUE %s MAXVALUE %s',
sequence_name,
#{minval},
#{minval},
#{minval},
#{maxval}
);
END IF;
Fix:
This MR updates the condition to not update while bumping the sequence range.
References
gitlab-com/gl-infra/tenant-scale/cells-infrastructure/team#404 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.