redis-trib: ignore slaves when resharding.

This commit is contained in:
antirez 2013-03-21 18:17:06 +01:00
parent 47da76576e
commit 4dded0c187

View File

@ -576,8 +576,9 @@ class RedisTrib
while not target while not target
print "What is the receiving node ID? " print "What is the receiving node ID? "
target = get_node_by_name(STDIN.gets.chop) target = get_node_by_name(STDIN.gets.chop)
if not target if !target || target.has_flag?("slave")
puts "The specified node is not known, please retry." puts "The specified node is not known or not a master, please retry."
target = nil
end end
end end
sources = [] sources = []
@ -598,11 +599,12 @@ class RedisTrib
elsif line == "all" elsif line == "all"
@nodes.each{|n| @nodes.each{|n|
next if n.info[:name] == target.info[:name] next if n.info[:name] == target.info[:name]
next if n.has_flag?("slave")
sources << n sources << n
} }
break break
elsif not src elsif !src || src.has_flags?("slave")
puts "The specified node is not known, please retry." puts "The specified node is not known or is not a master, please retry."
elsif src.info[:name] == target.info[:name] elsif src.info[:name] == target.info[:name]
puts "It is not possible to use the target node as source node." puts "It is not possible to use the target node as source node."
else else