Menu

1 / 2

Cross-slot by default: moving Redis Cluster permission into ClusterUtil.batch

DEV Community: ruby·Priyanshu Jha·2 days ago
#j5A7cCwx
#devtoruby#devto#dev#gitlab#redis
Reading 0:00
15s threshold

Redis Cluster does not let you run a multi-key command unless every key hashes to the same slot. That's a good default. It's also easy to forget, which is why GitLab has a validator that raises if you pipeline keys across slots, and a helper to allow it when you mean to.

This is the story of gitlab-org/gitlab!265488 . It moves that permission into Gitlab::Redis::ClusterUtil.batch , so the methods that already batch across slots don't make every caller opt in. I'll cover the issue, the change I shipped, the wrappers I deliberately left alone, and the review that kept the parent issue open.

The issue: a permission every caller had to remember

The issue was gitlab-org/gitlab#474372 , opened by Sylvester Chin. It started as a suggestion on an earlier MR, !159542 : if ClusterUtil is the place that pipelines keys, ClusterUtil should be the place that allows cross-slot commands.

Gitlab::Redis::ClusterUtil.batch is used by batch_get , batch_del , and batch_unlink .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.