From 786b8d6c87a5e4d17b709df8095f0e7c45638944 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 20 Feb 2013 17:36:54 +0100 Subject: [PATCH] Use RESTORE-ASKING for MIGRATE when in cluster mode. --- src/cluster.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cluster.c b/src/cluster.c index b17a8489f..64d773786 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1816,7 +1816,11 @@ try_again: if (ttl < 1) ttl = 1; } redisAssertWithInfo(c,NULL,rioWriteBulkCount(&cmd,'*',replace ? 5 : 4)); - redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7)); + if (server.cluster_enabled) + redisAssertWithInfo(c,NULL, + rioWriteBulkString(&cmd,"RESTORE-ASKING",14)); + else + redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"RESTORE",7)); redisAssertWithInfo(c,NULL,c->argv[3]->encoding == REDIS_ENCODING_RAW); redisAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,c->argv[3]->ptr,sdslen(c->argv[3]->ptr))); redisAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,ttl));