diff --git a/src/debug.c b/src/debug.c index 92cfe12936ffc0e1eca7d175f1ce18c4d1d20de5..f00d8174169b2a68ade35a054489e99c165d3c48 100644 --- a/src/debug.c +++ b/src/debug.c @@ -423,6 +423,11 @@ void debugCommand(client *c) { { server.active_expire_enabled = atoi(c->argv[2]->ptr); addReply(c,shared.ok); + } else if (!strcasecmp(c->argv[1]->ptr,"lua-always-replicate-commands") && + c->argc == 3) + { + server.lua_always_replicate_commands = atoi(c->argv[2]->ptr); + addReply(c,shared.ok); } else if (!strcasecmp(c->argv[1]->ptr,"error") && c->argc == 3) { sds errstr = sdsnewlen("-",1); diff --git a/src/scripting.c b/src/scripting.c index e43517b1434d64b049749cdab60fa19644c4ad4a..44c8233fab3e1fc3bc294a573b6e58297a0f55ef 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -1038,7 +1038,7 @@ void evalGenericCommand(client *c, int evalsha) { * is called after a random command was used. */ server.lua_random_dirty = 0; server.lua_write_dirty = 0; - server.lua_replicate_commands = 0; + server.lua_replicate_commands = server.lua_always_replicate_commands; server.lua_multi_emitted = 0; server.lua_repl = PROPAGATE_AOF|PROPAGATE_REPL; diff --git a/src/server.c b/src/server.c index 9dcd55e725883d57884df20dd1131e059cc394d4..9bcf11e8111428d8a75d742cd5fc659f430faa02 100644 --- a/src/server.c +++ b/src/server.c @@ -1512,6 +1512,7 @@ void initServerConfig(void) { server.lua_time_limit = LUA_SCRIPT_TIME_LIMIT; server.lua_client = NULL; server.lua_timedout = 0; + server.lua_always_replicate_commands = 0; /* Only DEBUG can change it. */ server.migrate_cached_sockets = dictCreate(&migrateCacheDictType,NULL); server.next_client_id = 1; /* Client IDs, start from 1 .*/ server.loading_process_events_interval_bytes = (1024*1024*2); diff --git a/src/server.h b/src/server.h index 5f502143e8a8900d8dbcd0b3c4e1b8724a792783..882b4cfbab6e5d5fe15fed771ca93b8cb2f046d3 100644 --- a/src/server.h +++ b/src/server.h @@ -960,6 +960,7 @@ struct redisServer { int lua_timedout; /* True if we reached the time limit for script execution. */ int lua_kill; /* Kill the script if true. */ + int lua_always_replicate_commands; /* Default replication type. */ /* Lazy free */ int lazyfree_lazy_eviction; int lazyfree_lazy_expire;