Add Redis Cluster validator
What does this MR do?
Add a check that we're using Redis-Cluster-compatible key names when we're making multi-key calls. For instance, MGET foo bar
would fail if we were using Redis Cluster, because 'foo' and 'bar' hash to different slots. MGET {user:1}:foo {user:1}:bar
would work, though: https://redis.io/topics/cluster-spec#keys-hash-tags
Gitlab::Redis::Cache.with { |redis| redis.mget('foo', 'bar') }
# Gitlab::Instrumentation::RedisClusterValidator::CrossSlotError: Redis command MGET arguments hash to different slots
# from /Users/seanmcgivern/Code/gdk/gitlab/lib/gitlab/instrumentation/redis_cluster_validator.rb:59:in `validate!'
Gitlab::Redis::Cache.with { |redis| redis.mget('{user:1}:foo', '{user:1}:bar') }
#=> [nil, nil]
Edited by Sean McGivern