RedisLabs / redis-cluster-proxy

A proxy for Redis clusters.
GNU Affero General Public License v3.0
990 stars 129 forks source link

Proxy returns MOVED responses #31

Open JanBerktold opened 4 years ago

JanBerktold commented 4 years ago

I have noticed that the proxy appears to return MOVED responses, therefore not hiding slot movements properly. Looking at the code, this appears to be confined to transactions currently (https://github.com/artix75/redis-cluster-proxy/blob/unstable/src/proxy.c#L4225) but I may be missing other parts of it.

In our case, this lead to our 'smart' client switching to cluster mode and trying to bypass the proxy. Solutions I can see:

  1. Retry transactions(?)
  2. Rewrite error messages to not follow standard MOVED format. i.e. replace with cancelled due to cluster topology change
artix75 commented 4 years ago

The proxy should handle MOVED replies if the client is not under a transaction. So this is the behavior:

If the client is under MULTI transaction:

JanBerktold commented 4 years ago

So I just reproduced the C# StackExchange.Redis client acting up and trying to switch into cluster mode after reading the MOVED error inside of the transaction. For starters, what do you think about changing that specific error message?

I'm not fully convinced, that that's the original error that I saw though - Going to be digging deeper for a 2nd repro case there.

artix75 commented 4 years ago

@JanBerktold Were you under a MULTI transaction?

JanBerktold commented 4 years ago

@artix75 Yes!