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

Function alsoPropagate

src/server.cpp:4402–4416  ·  view source on GitHub ↗

Used inside commands to schedule the propagation of additional commands * after the current command is propagated to AOF / Replication. * * 'cmd' must be a pointer to the Redis command to replicate, dbid is the * database ID the command should be propagated into. * Arguments of the command to propagate are passed as an array of redis * objects pointers of len 'argc', using the 'argv' vector.

Source from the content-addressed store, hash-verified

4400 * stack allocated). The function automatically increments ref count of
4401 * passed objects, so the caller does not need to. */
4402void alsoPropagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
4403 int target)
4404{
4405 robj **argvcopy;
4406 int j;
4407
4408 if (g_pserver->loading) return; /* No propagation during loading. */
4409
4410 argvcopy = (robj**)zmalloc(sizeof(robj*)*argc, MALLOC_LOCAL);
4411 for (j = 0; j < argc; j++) {
4412 argvcopy[j] = argv[j];
4413 incrRefCount(argv[j]);
4414 }
4415 redisOpArrayAppend(&g_pserver->also_propagate,cmd,dbid,argvcopy,argc,target);
4416}
4417
4418/* It is possible to call the function forceCommandPropagation() inside a
4419 * Redis command implementation in order to to force the propagation of a

Callers 5

replicaReplayCommandFunction · 0.85
spopWithCountCommandFunction · 0.85
RM_ReplicateFunction · 0.85
RM_ReplicateVerbatimFunction · 0.85

Calls 3

zmallocFunction · 0.85
incrRefCountFunction · 0.85
redisOpArrayAppendFunction · 0.85

Tested by

no test coverage detected