From 51b5058d04233bce24927ac233d68cfdfda2cfb9 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 22 Feb 2013 11:33:10 +0100 Subject: redis-trib: skeleton of coverage fix for "keys in multiple nodes" case. --- src/redis-trib.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/redis-trib.rb') diff --git a/src/redis-trib.rb b/src/redis-trib.rb index 8daeaa8fd..fd4d29063 100755 --- a/src/redis-trib.rb +++ b/src/redis-trib.rb @@ -309,6 +309,23 @@ class RedisTrib nodes[0].r.cluster("addslots",slot) } end + + # Handle case "3": keys in multiple nodes. + if multi.length > 0 + puts "The folowing uncovered slots have keys in multiple nodes:" + puts multi.keys.join(",") + yes_or_die "Fix these slots by moving keys into a single node?" + multi.each{|slot,nodes| + puts "Covering slot #{slot} moving keys to #{nodes[0]}" + # TODO + # 1) Set all nodes as "MIGRATING" for this slot, so that we + # can access keys in the hash slot using ASKING. + # 2) Move everything to node[0] + # 3) Clear MIGRATING from nodes, and ADDSLOTS the slot to + # node[0]. + raise "TODO: Work in progress" + } + end end def alloc_slots -- cgit v1.2.1