scripting: flag lua_client as CLIENT_MULTI after redis.replicate_command() immediately#5780
Merged
antirez merged 2 commits intoredis:unstablefrom Dec 19, 2019
Merged
Conversation
Collaborator
|
Hi @soloestoy, this makes sense to me and I think it's cleaner this way indeed. |
…ands() 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.
Change server.lua_client's flag in a more explicit way.
2de3949 to
73841e8
Compare
Contributor
|
Thanks, merged. |
JackieXie168
pushed a commit
to JackieXie168/redis
that referenced
this pull request
Dec 24, 2019
scripting: flag lua_client as CLIENT_MULTI after redis.replicate_command() immediately
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @antirez and @yossigo , we have talked about this in #5323, I think we should discuss it deeply now.
To avoid nested
MULTI/EXECin PR #4467, we check thelua_caller's flag, if we are in the MULTI context we flag thelua_clientas CLIENT_MULTI.But it's not enough, we shoud flag
lua_clientasCLIENT_MULTIafterredis.replicate_commands()immediately, or the first write command afterredis.replicate_commands()cannot know it's in an transaction.I know the missing
CLIENT_MULTIdoesn't have any effect now, but it's a real bug and we should fix it, in case someday we allow some dangerous command likeBLPOP.Moreover, reflect
MULTIstate in everyluaRedisGenericCommand()is not clear and not easy to understand, I think we can changelua_client's flag in a more explicit way, like inevalGenericCommand().