Skip to content

Fix variable passing in redis-hll migration spec

Sylvester Chin requested to merge sc1-fix-redis-hll-migration-spec-2 into master

What does this MR do and why?

This MR is a repeat of !140553 (merged) as the migration is being performed again with the similar specs.

This MR fixes how value is passed in to the set_redis_hll method in spec/migrations/20240116072014_change_i_code_review_create_mr_keys_from_hll_to_integer_spec.rb.rb. Currently, value: 7 would mean we pass {value: 7} to Gitlab::Redis::HLL.add(...). What the Redis server receives is PFADD <key> "{:value=>7}" instead of PFADD <key> 7.

Hashes are silently acceptable in redis v4.8.0 gem as .to_s is called on anything that is not an Array: https://github.com/redis/redis-rb/blob/v4.8.0/lib/redis/connection/command_helper.rb#L20

However, this will raise an error in in redis v5.x gem as seen in the failed job. See an example of a failed job in https://gitlab.com/gitlab-org/gitlab/-/jobs/5945638640

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

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

Edited by Sylvester Chin

Merge request reports

Loading