MCPcopy Create free account
hub / github.com/F-Stack/f-stack / propagate

Function propagate

app/redis-6.2.6/src/server.c:3576–3598  ·  view source on GitHub ↗

Propagate the specified command (in the context of the specified database id) * to AOF and Slaves. * * flags are an xor between: * + PROPAGATE_NONE (no propagation of command at all) * + PROPAGATE_AOF (propagate into the AOF file if is enabled) * + PROPAGATE_REPL (propagate into the replication link) * * This should not be used inside commands implementation since it will not * wrap the r

Source from the content-addressed store, hash-verified

3574 * want to use propagate().
3575 */
3576void propagate(struct redisCommand *cmd, int dbid, robj **argv, int argc,
3577 int flags)
3578{
3579 if (!server.replication_allowed)
3580 return;
3581
3582 /* Propagate a MULTI request once we encounter the first command which
3583 * is a write command.
3584 * This way we'll deliver the MULTI/..../EXEC block as a whole and
3585 * both the AOF and the replication link will have the same consistency
3586 * and atomicity guarantees. */
3587 if (server.in_exec && !server.propagate_in_transaction)
3588 execCommandPropagateMulti(dbid);
3589
3590 /* This needs to be unreachable since the dataset should be fixed during
3591 * client pause, otherwise data may be lossed during a failover. */
3592 serverAssert(!(areClientsPaused() && !server.client_pause_in_transaction));
3593
3594 if (server.aof_state != AOF_OFF && flags & PROPAGATE_AOF)
3595 feedAppendOnlyFile(cmd,dbid,argv,argc);
3596 if (flags & PROPAGATE_REPL)
3597 replicationFeedSlaves(server.slaves,dbid,argv,argc);
3598}
3599
3600/* Used inside commands to schedule the propagation of additional commands
3601 * after the current command is propagated to AOF / Replication.

Callers 11

execCommandPropagateExecFunction · 0.85
callFunction · 0.85
propagateExpireFunction · 0.85
RM_ReplicateFunction · 0.85
streamPropagateXCLAIMFunction · 0.85
streamPropagateGroupIDFunction · 0.85
serveClientBlockedOnListFunction · 0.85

Calls 4

areClientsPausedFunction · 0.85
feedAppendOnlyFileFunction · 0.85
replicationFeedSlavesFunction · 0.85

Tested by

no test coverage detected