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
2ba9a57c
Commit
2ba9a57c
authored
Mar 20, 2018
by
antirez
Browse files
CG: Add JUSTID to XCLAIM propagation to reduce CPU usage.
parent
ad716e29
Changes
1
Show whitespace changes
Inline
Side-by-side
src/t_stream.c
View file @
2ba9a57c
...
@@ -686,8 +686,11 @@ void streamPropagateXCLAIM(client *c, robj *key, robj *group, robj *id, streamNA
...
@@ -686,8 +686,11 @@ void streamPropagateXCLAIM(client *c, robj *key, robj *group, robj *id, streamNA
/* We need to generate an XCLAIM that will work in a idempotent fashion:
/* We need to generate an XCLAIM that will work in a idempotent fashion:
*
*
* XCLAIM <key> <group> <consumer> 0 <id> TIME <milliseconds-unix-time>
* XCLAIM <key> <group> <consumer> 0 <id> TIME <milliseconds-unix-time>
* RETRYCOUNT <count> [FORCE]. */
* RETRYCOUNT <count> FORCE JUSTID.
robj *argv[11];
*
* Note that JUSTID is useful in order to avoid that XCLAIM will do
* useless work in the slave side, trying to fetch the stream item. */
robj *argv[12];
argv[0] = createStringObject("XCLAIM",6);
argv[0] = createStringObject("XCLAIM",6);
argv[1] = key;
argv[1] = key;
argv[2] = group;
argv[2] = group;
...
@@ -699,7 +702,8 @@ void streamPropagateXCLAIM(client *c, robj *key, robj *group, robj *id, streamNA
...
@@ -699,7 +702,8 @@ void streamPropagateXCLAIM(client *c, robj *key, robj *group, robj *id, streamNA
argv[8] = createStringObject("RETRYCOUNT",10);
argv[8] = createStringObject("RETRYCOUNT",10);
argv[9] = createStringObjectFromLongLong(nack->delivery_count);
argv[9] = createStringObjectFromLongLong(nack->delivery_count);
argv[10] = createStringObject("FORCE",5);
argv[10] = createStringObject("FORCE",5);
propagate(server.xclaimCommand,c->db->id,argv,11,PROPAGATE_AOF|PROPAGATE_REPL);
argv[11] = createStringObject("JUSTID",6);
propagate(server.xclaimCommand,c->db->id,argv,12,PROPAGATE_AOF|PROPAGATE_REPL);
decrRefCount(argv[0]);
decrRefCount(argv[0]);
decrRefCount(argv[3]);
decrRefCount(argv[3]);
decrRefCount(argv[4]);
decrRefCount(argv[4]);
...
...
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