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
a6499eca
Commit
a6499eca
authored
Oct 18, 2018
by
youjiali1995
Browse files
migrate: fix mismatch of RESTORE reply when some keys have expired.
parent
144832ee
Changes
1
Show whitespace changes
Inline
Side-by-side
src/cluster.c
View file @
a6499eca
...
@@ -5164,7 +5164,7 @@ try_again:
...
@@ -5164,7 +5164,7 @@ try_again:
serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid));
serverAssertWithInfo(c,NULL,rioWriteBulkLongLong(&cmd,dbid));
}
}
int expired = 0; /* Number of keys that we'll find
already
expired.
int
non_
expired = 0; /* Number of keys that we'll find
non
expired.
Note that serializing large keys may take some time
Note that serializing large keys may take some time
so certain keys that were found non expired by the
so certain keys that were found non expired by the
lookupKey() function, may be expired later. */
lookupKey() function, may be expired later. */
...
@@ -5177,11 +5177,12 @@ try_again:
...
@@ -5177,11 +5177,12 @@ try_again:
if (expireat != -1) {
if (expireat != -1) {
ttl = expireat-mstime();
ttl = expireat-mstime();
if (ttl < 0) {
if (ttl < 0) {
expired++;
continue;
continue;
}
}
if (ttl < 1) ttl = 1;
if (ttl < 1) ttl = 1;
}
}
kv[non_expired++] = kv[j];
serverAssertWithInfo(c,NULL,
serverAssertWithInfo(c,NULL,
rioWriteBulkCount(&cmd,'*',replace ? 5 : 4));
rioWriteBulkCount(&cmd,'*',replace ? 5 : 4));
...
@@ -5208,6 +5209,7 @@ try_again:
...
@@ -5208,6 +5209,7 @@ try_again:
if (replace)
if (replace)
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"REPLACE",7));
serverAssertWithInfo(c,NULL,rioWriteBulkString(&cmd,"REPLACE",7));
}
}
num_keys = non_expired;
/* Transfer the query to the other node in 64K chunks. */
/* Transfer the query to the other node in 64K chunks. */
errno = 0;
errno = 0;
...
@@ -5250,7 +5252,7 @@ try_again:
...
@@ -5250,7 +5252,7 @@ try_again:
* command name itself. */
* command name itself. */
if (!copy) newargv = zmalloc(sizeof(robj*)*(num_keys+1));
if (!copy) newargv = zmalloc(sizeof(robj*)*(num_keys+1));
for (j = 0; j < num_keys
-expired
; j++) {
for (j = 0; j < num_keys; 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