Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1019c729
Commit
1019c729
authored
Jan 08, 2015
by
Salvatore Sanfilippo
Browse files
Merge pull request #2265 from mattsta/fix/trib/create
Fix redis-trib creation failure
parents
622c69e9
bf58f8b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/redis-trib.rb
View file @
1019c729
...
@@ -72,7 +72,7 @@ class ClusterNode
...
@@ -72,7 +72,7 @@ class ClusterNode
@friends
@friends
end
end
def
slots
def
slots
@info
[
:slots
]
@info
[
:slots
]
end
end
...
@@ -154,7 +154,7 @@ class ClusterNode
...
@@ -154,7 +154,7 @@ class ClusterNode
end
end
}
if
slots
}
if
slots
@dirty
=
false
@dirty
=
false
@r
.
cluster
(
"info"
).
split
(
"
\n
"
).
each
{
|
e
|
@r
.
cluster
(
"info"
).
split
(
"
\n
"
).
each
{
|
e
|
k
,
v
=
e
.
split
(
":"
)
k
,
v
=
e
.
split
(
":"
)
k
=
k
.
to_sym
k
=
k
.
to_sym
v
.
chop!
v
.
chop!
...
@@ -213,7 +213,7 @@ class ClusterNode
...
@@ -213,7 +213,7 @@ class ClusterNode
#
#
# Note: this could be easily written without side effects,
# Note: this could be easily written without side effects,
# we use 'slots' just to split the computation into steps.
# we use 'slots' just to split the computation into steps.
# First step: we want an increasing array of integers
# First step: we want an increasing array of integers
# for instance: [1,2,3,4,5,8,9,20,21,22,23,24,25,30]
# for instance: [1,2,3,4,5,8,9,20,21,22,23,24,25,30]
slots
=
@info
[
:slots
].
keys
.
sort
slots
=
@info
[
:slots
].
keys
.
sort
...
@@ -273,7 +273,7 @@ class ClusterNode
...
@@ -273,7 +273,7 @@ class ClusterNode
def
info
def
info
@info
@info
end
end
def
is_dirty?
def
is_dirty?
@dirty
@dirty
end
end
...
@@ -563,8 +563,17 @@ class RedisTrib
...
@@ -563,8 +563,17 @@ class RedisTrib
# Take one node from each IP until we run out of nodes
# Take one node from each IP until we run out of nodes
# across every IP.
# across every IP.
ips
.
each
do
|
ip
,
nodes
|
ips
.
each
do
|
ip
,
nodes
|
stop
=
nodes
.
empty?
and
next
if
nodes
.
empty?
interleaved
.
push
nodes
.
shift
# if this IP has no remaining nodes, check for termination
if
interleaved
.
length
==
nodes_count
# stop when 'interleaved' has accumulated all nodes
stop
=
true
next
end
else
# else, move one node from this IP to 'interleaved'
interleaved
.
push
nodes
.
shift
end
end
end
end
end
...
@@ -780,7 +789,7 @@ class RedisTrib
...
@@ -780,7 +789,7 @@ class RedisTrib
# Move slots between source and target nodes using MIGRATE.
# Move slots between source and target nodes using MIGRATE.
#
#
# Options:
# Options:
# :verbose -- Print a dot for every moved key.
# :verbose -- Print a dot for every moved key.
# :fix -- We are moving in the context of a fix. Use REPLACE.
# :fix -- We are moving in the context of a fix. Use REPLACE.
# :cold -- Move keys without opening / reconfiguring the nodes.
# :cold -- Move keys without opening / reconfiguring the nodes.
...
@@ -1223,7 +1232,7 @@ end
...
@@ -1223,7 +1232,7 @@ end
#################################################################################
#################################################################################
# Libraries
# Libraries
#
#
# We try to don't depend on external libs since this is a critical part
# We try to don't depend on external libs since this is a critical part
# of Redis Cluster.
# of Redis Cluster.
#################################################################################
#################################################################################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment