MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / streamPropagateConsumerCreation

Function streamPropagateConsumerCreation

src/t_stream.cpp:1434–1448  ·  view source on GitHub ↗

We need this when we want to propagate creation of consumer that was created * by XREADGROUP with the NOACK option. In that case, the only way to create * the consumer at the replica is by using XGROUP CREATECONSUMER (see issue #7140) * * XGROUP CREATECONSUMER */

Source from the content-addressed store, hash-verified

1432 * XGROUP CREATECONSUMER <key> <groupname> <consumername>
1433 */
1434void streamPropagateConsumerCreation(client *c, robj *key, robj *groupname, sds consumername) {
1435 robj *argv[5];
1436 argv[0] = shared.xgroup;
1437 argv[1] = shared.createconsumer;
1438 argv[2] = key;
1439 argv[3] = groupname;
1440 argv[4] = createObject(OBJ_STRING,sdsdup(consumername));
1441
1442 /* We use progagate() because this code path is not always called from
1443 * the command execution context. Moreover this will just alter the
1444 * consumer group state, and we don't need MULTI/EXEC wrapping because
1445 * there is no message state cross-message atomicity required. */
1446 propagate(cserver.xgroupCommand,c->db->id,argv,5,PROPAGATE_AOF|PROPAGATE_REPL);
1447 decrRefCount(argv[4]);
1448}
1449
1450/* Send the stream items in the specified range to the client 'c'. The range
1451 * the client will receive is between start and end inclusive, if 'count' is

Callers 2

xreadCommandFunction · 0.85

Calls 4

createObjectFunction · 0.85
sdsdupFunction · 0.85
propagateFunction · 0.85
decrRefCountFunction · 0.85

Tested by

no test coverage detected