Renew slots when MOVED occured during request to Cluster
* It's suggested by http://redis.io/topics/cluster-spec ** antirez/redis-rb-cluster implementation does it, too * Since Redis 3.0-beta 7 introduces CLUSTER SLOTS, it becomes easier * FIXME: It's fully synchronized, so it hurts performance (somewhat poor implementation) ** We can try Reader / Writer strategy to make lock waiting make shorter
This commit is contained in:
@@ -72,13 +72,15 @@ public abstract class JedisClusterCommand<T> {
|
||||
} catch (JedisRedirectionException jre) {
|
||||
if (jre instanceof JedisAskDataException) {
|
||||
asking = true;
|
||||
} else if (jre instanceof JedisMovedDataException) {
|
||||
// TODO : In antirez's redis-rb-cluster implementation,
|
||||
// it rebuilds cluster's slot and node cache
|
||||
}
|
||||
|
||||
this.connectionHandler.assignSlotToNode(jre.getSlot(),
|
||||
jre.getTargetNode());
|
||||
this.connectionHandler.assignSlotToNode(jre.getSlot(),
|
||||
jre.getTargetNode());
|
||||
} else if (jre instanceof JedisMovedDataException) {
|
||||
// it rebuilds cluster's slot cache
|
||||
// recommended by Redis cluster specification
|
||||
this.connectionHandler.renewSlotCache();
|
||||
} else {
|
||||
throw new JedisClusterException(jre);
|
||||
}
|
||||
|
||||
releaseConnection(connection, false);
|
||||
connection = null;
|
||||
|
||||
Reference in New Issue
Block a user