Commit 097c4a65 authored by zhaozhao.zz's avatar zhaozhao.zz
Browse files

scripting: flag lua_client as CLIENT_MULTI after redis.replicate_commands() immediately

To avoid nested MULTI/EXEC, we check the lua_caller's flag,
if we are in the MULTI context we flag the lua_client as
CLIENT_MULTI, but it's not enough we shoud flag lua_client
as CLIENT_MULTI after redis.replicate_commands() immediately
or the first write command after redis.replicate_commands()
cannot know it's in an transaction, I know the missing CLIENT_MULTI
doesn't have any effect now, but it's a real bug and we should fix
it, in case someday we allow some dangerous command like BLPOP.
parent b9394558
......@@ -703,6 +703,9 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) {
{
execCommandPropagateMulti(server.lua_caller);
server.lua_multi_emitted = 1;
/* Now we are in the MULTI context, the lua_client should be
* flag as CLIENT_MULTI. */
c->flags |= CLIENT_MULTI;
}
/* Run the command */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment