diff options
author | antirez <antirez@gmail.com> | 2018-08-30 17:40:58 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2018-08-30 17:52:04 +0200 |
commit | e8d35809c4d85a58e757c90c38e02fcef2b97374 (patch) | |
tree | e67bdd56c4809fceda14ab22098d475dfd04d8d7 | |
parent | 4b68dbcbd7ed93867ad0ed4ebe9623d734f624dd (diff) | |
download | redis-e8d35809c4d85a58e757c90c38e02fcef2b97374.tar.gz |
While the slave is busy, just accumulate master input.
Processing command from the master while the slave is in busy state is
not correct, however we cannot, also, just reply -BUSY to the
replication stream commands from the master. The correct solution is to
stop processing data from the master, but just accumulate the stream
into the buffers and resume the processing later.
Related to #5297.
-rw-r--r-- | src/networking.c | 6 | ||||
-rw-r--r-- | src/server.c | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/networking.c b/src/networking.c index 58248ced0..eb581462b 100644 --- a/src/networking.c +++ b/src/networking.c @@ -1362,6 +1362,12 @@ void processInputBuffer(client *c) { /* Immediately abort if the client is in the middle of something. */ if (c->flags & CLIENT_BLOCKED) break; + /* Don't process input from the master while there is a busy script + * condition on the slave. We want just to accumulate the replication + * stream (instead of replying -BUSY like we do with other clients) and + * later resume the processing. */ + if (server.lua_timedout && c->flags & CLIENT_MASTER) break; + /* CLIENT_CLOSE_AFTER_REPLY closes the connection once the reply is * written to the client. Make sure to not let the reply grow after * this flag has been set (i.e. don't process more commands). diff --git a/src/server.c b/src/server.c index 1afc9a802..55bcb4dc2 100644 --- a/src/server.c +++ b/src/server.c @@ -2683,7 +2683,6 @@ int processCommand(client *c) { /* Lua script too slow? Only allow a limited number of commands. */ if (server.lua_timedout && - !(c->flags & CLIENT_MASTER) && c->cmd->proc != authCommand && c->cmd->proc != replconfCommand && !(c->cmd->proc == shutdownCommand && |