Migrate Redis hll values to integers for 'i_code_review_create_mr' keys
What does this MR do and why?
Adds a the a correct version of the migration that was removed in !140587 (merged)
The only difference is that scan_each
is called with count: 10_000
which overrides the default value of 10
. This change means that the migration will run in a few minutes
For context see #425302 (comment 1727550894)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
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
- Add some RedisHLL keys
gdk redis-cli pfadd '{hll_counters}_i_code_review_create_mr-2024-03' 1 2 3 gdk redis-cli pfadd '{hll_counters}_i_code_review_create_mr-2024-02' 4 5 6 gdk redis-cli pfadd '{hll_counters}_i_code_review_create_mr-2024-01' 7 8 gdk redis-cli pfadd '{hll_counters}_i_code_review_create_mr-2023-50' 9 10 gdk redis-cli pfadd '{hll_counters}_i_code_review_create_mr-2023-49' 11
- Get the values:
gdk redis-cli pfcount '{hll_counters}_i_code_review_create_mr-2024-03' gdk redis-cli pfcount '{hll_counters}_i_code_review_create_mr-2024-02' gdk redis-cli pfcount '{hll_counters}_i_code_review_create_mr-2024-01' gdk redis-cli pfcount '{hll_counters}_i_code_review_create_mr-2023-50' gdk redis-cli pfcount '{hll_counters}_i_code_review_create_mr-2023-49'
- Get the current
{event_counters}
values in case they were already used:gdk redis-cli get {event_counters}_i_code_review_user_create_mr-2024-03 gdk redis-cli get {event_counters}_i_code_review_user_create_mr-2024-02 gdk redis-cli get {event_counters}_i_code_review_user_create_mr-2024-01 gdk redis-cli get {event_counters}_i_code_review_user_create_mr-2023-50 gdk redis-cli get {event_counters}_i_code_review_user_create_mr-2023-49
- Run the migration
bundle exec rake db:migrate
- Verify that each of the
{event_counters}
values are the sum of the values you got in step2)
and3)
Related to #425302 (closed)
Edited by Jonas Larsen