Skip to content

Add Redis Cluster validator

Sean McGivern requested to merge redis-cluster-validator into master

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]

For gitlab-com/gl-infra/scalability#305 (closed).

Edited by Sean McGivern

Merge request reports