mirror of
https://github.com/fluencelabs/redis
synced 2025-03-20 01:20:50 +00:00
call() deserves a good top-comment.
This commit is contained in:
parent
c950facf43
commit
54f5ecfd49
40
src/server.c
40
src/server.c
@ -2164,7 +2164,43 @@ void preventCommandReplication(client *c) {
|
|||||||
c->flags |= CLIENT_PREVENT_REPL_PROP;
|
c->flags |= CLIENT_PREVENT_REPL_PROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call() is the core of Redis execution of a command */
|
/* Call() is the core of Redis execution of a command.
|
||||||
|
*
|
||||||
|
* The following flags can be passed:
|
||||||
|
* CMD_CALL_NONE No flags.
|
||||||
|
* CMD_CALL_SLOWLOG Check command speed and log in the slow log if needed.
|
||||||
|
* CMD_CALL_STATS Populate command stats.
|
||||||
|
* CMD_CALL_PROPAGATE_AOF Append command to AOF if it modified the dataset
|
||||||
|
* or if the client flags are forcing propagation.
|
||||||
|
* CMD_CALL_PROPAGATE_REPL Send command to salves if it modified the dataset
|
||||||
|
* or if the client flags are forcing propagation.
|
||||||
|
* CMD_CALL_PROPAGATE Alias for PROPAGATE_AOF|PROPAGATE_REPL.
|
||||||
|
* CMD_CALL_FULL Alias for SLOWLOG|STATS|PROPAGATE.
|
||||||
|
*
|
||||||
|
* The exact propagation behavior depends on the client flags.
|
||||||
|
* Specifically:
|
||||||
|
*
|
||||||
|
* 1. If the client flags CLIENT_FORCE_AOF or CLIENT_FORCE_REPL are set
|
||||||
|
* and assuming the corresponding CMD_CALL_PROPAGATE_AOF/REPL is set
|
||||||
|
* in the call flags, then the command is propagated even if the
|
||||||
|
* dataset was not affected by the command.
|
||||||
|
* 2. If the client flags CLIENT_PREVENT_REPL_PROP or CLIENT_PREVENT_AOF_PROP
|
||||||
|
* are set, the propagation into AOF or to slaves is not performed even
|
||||||
|
* if the command modified the dataset.
|
||||||
|
*
|
||||||
|
* Note that regardless of the client flags, if CMD_CALL_PROPAGATE_AOF
|
||||||
|
* or CMD_CALL_PROPAGATE_REPL are not set, then respectively AOF or
|
||||||
|
* slaves propagation will never occur.
|
||||||
|
*
|
||||||
|
* Client flags are modified by the implementation of a given command
|
||||||
|
* using the following API:
|
||||||
|
*
|
||||||
|
* forceCommandPropagation(client *c, int flags);
|
||||||
|
* preventCommandPropagation(client *c);
|
||||||
|
* preventCommandAOF(client *c);
|
||||||
|
* preventCommandReplication(client *c);
|
||||||
|
*
|
||||||
|
*/
|
||||||
void call(client *c, int flags) {
|
void call(client *c, int flags) {
|
||||||
long long dirty, start, duration;
|
long long dirty, start, duration;
|
||||||
int client_old_flags = c->flags;
|
int client_old_flags = c->flags;
|
||||||
@ -2229,7 +2265,7 @@ void call(client *c, int flags) {
|
|||||||
* set for replication / AOF propagation. */
|
* set for replication / AOF propagation. */
|
||||||
if (dirty) propagate_flags |= (PROPAGATE_AOF|PROPAGATE_REPL);
|
if (dirty) propagate_flags |= (PROPAGATE_AOF|PROPAGATE_REPL);
|
||||||
|
|
||||||
/* If the command forced AOF / replication of the command, set
|
/* If the client forced AOF / replication of the command, set
|
||||||
* the flags regardless of the command effects on the data set. */
|
* the flags regardless of the command effects on the data set. */
|
||||||
if (c->flags & CLIENT_FORCE_REPL) propagate_flags |= PROPAGATE_REPL;
|
if (c->flags & CLIENT_FORCE_REPL) propagate_flags |= PROPAGATE_REPL;
|
||||||
if (c->flags & CLIENT_FORCE_AOF) propagate_flags |= PROPAGATE_AOF;
|
if (c->flags & CLIENT_FORCE_AOF) propagate_flags |= PROPAGATE_AOF;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user