Skip to content

Update Redis::SharedState to be Cluster compatible

Gregorius Marco requested to merge sc1-redis-sharedstate-cluster-compat-1 into master

What does this MR do and why?

This MR updates Gitlab::Redis::SharedState callsites to be compatible with Redis Cluster.

Continuation from !124256 (closed)

Refer to gitlab-com/gl-infra/scalability#2193 (closed)

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

  1. Set up GDK on the master branch with config/redis.yml configured to use a Redis Cluster
➜  gitlab git:(master) ✗ cat ../gdk.yml
---
redis_cluster:
  enabled: true
➜  gitlab git:(sc1-deprecate-namespace) ✗ cat config/redis.yml
---
test:
  shared_state:
    cluster:
      - "redis://localhost:6003"
      - "redis://localhost:6004"
      - "redis://localhost:6005"
  1. Run some affected specs
bin/rspec spec/lib/gitlab/sidekiq_status_spec.rb

You should get errors like:

 Failure/Error: raise RedisClusterValidator::CrossSlotError, "Redis command #{result[:command_name]} arguments hash to different slots. See https://docs.gitlab.com/ee/development/redis.html#multi-key-commands"

     Gitlab::Instrumentation::RedisClusterValidator::CrossSlotError:
       Redis command MGET arguments hash to different slots. See https://docs.gitlab.com/ee/development/redis.html#multi-key-commands

Repeat the specs on this branch.

MR acceptance checklist

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

Edited by Sylvester Chin

Merge request reports