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
e52a036a
Unverified
Commit
e52a036a
authored
Jul 24, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Jul 24, 2018
Browse files
Merge pull request #5154 from trevor211/optimizeMigrate
Do not migrate already expired keys.
parents
8513f31b
4017a111
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
e52a036a
...
@@ -5146,6 +5146,8 @@ try_again:
...
@@ -5146,6 +5146,8 @@ try_again:
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkLongLong
(
&
cmd
,
dbid
));
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkLongLong
(
&
cmd
,
dbid
));
}
}
int
num_keys_non_expired
=
0
;
/* Create RESTORE payload and generate the protocol to call the command. */
/* Create RESTORE payload and generate the protocol to call the command. */
for
(
j
=
0
;
j
<
num_keys
;
j
++
)
{
for
(
j
=
0
;
j
<
num_keys
;
j
++
)
{
long
long
ttl
=
0
;
long
long
ttl
=
0
;
...
@@ -5153,8 +5155,10 @@ try_again:
...
@@ -5153,8 +5155,10 @@ try_again:
if
(
expireat
!=
-
1
)
{
if
(
expireat
!=
-
1
)
{
ttl
=
expireat
-
mstime
();
ttl
=
expireat
-
mstime
();
if
(
ttl
<
0
)
continue
;
if
(
ttl
<
1
)
ttl
=
1
;
if
(
ttl
<
1
)
ttl
=
1
;
}
}
num_keys_non_expired
++
;
serverAssertWithInfo
(
c
,
NULL
,
serverAssertWithInfo
(
c
,
NULL
,
rioWriteBulkCount
(
&
cmd
,
'*'
,
replace
?
5
:
4
));
rioWriteBulkCount
(
&
cmd
,
'*'
,
replace
?
5
:
4
));
...
@@ -5217,9 +5221,9 @@ try_again:
...
@@ -5217,9 +5221,9 @@ try_again:
int
socket_error
=
0
;
int
socket_error
=
0
;
int
del_idx
=
1
;
/* Index of the key argument for the replicated DEL op. */
int
del_idx
=
1
;
/* Index of the key argument for the replicated DEL op. */
if
(
!
copy
)
newargv
=
zmalloc
(
sizeof
(
robj
*
)
*
(
num_keys
+
1
));
if
(
!
copy
)
newargv
=
zmalloc
(
sizeof
(
robj
*
)
*
(
num_keys
_non_expired
+
1
));
for
(
j
=
0
;
j
<
num_keys
;
j
++
)
{
for
(
j
=
0
;
j
<
num_keys
_non_expired
;
j
++
)
{
if
(
syncReadLine
(
cs
->
fd
,
buf2
,
sizeof
(
buf2
),
timeout
)
<=
0
)
{
if
(
syncReadLine
(
cs
->
fd
,
buf2
,
sizeof
(
buf2
),
timeout
)
<=
0
)
{
socket_error
=
1
;
socket_error
=
1
;
break
;
break
;
...
...
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