Merge pull request #5684 from soloestoy/ignore-multi-cmd-flags-loading-aof

multi: ignore multiState's cmd_flags when loading AOF
This commit is contained in:
Salvatore Sanfilippo 2018-12-11 12:57:25 +01:00 committed by GitHub
commit 11d399dded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -144,12 +144,12 @@ void execCommand(client *c) {
* was initiated when the instance was a master or a writable replica and
* then the configuration changed (for example instance was turned into
* a replica). */
if (server.masterhost && server.repl_slave_ro &&
if (!server.loading && server.masterhost && server.repl_slave_ro &&
!(c->flags & CLIENT_MASTER) && c->mstate.cmd_flags & CMD_WRITE)
{
addReplyError(c,
"Transaction contains write commands but instance "
"is now a read-only slave. EXEC aborted.");
"is now a read-only replica. EXEC aborted.");
discardTransaction(c);
goto handle_monitor;
}