-
Notifications
You must be signed in to change notification settings - Fork 5k
redis: added support for transactions (#22162) #22729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: asheryer <[email protected]>
Signed-off-by: Asher Yermiyahu <[email protected]>
Signed-off-by: asheryer <[email protected]>
looks like formatting is still broken. /wait |
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
/wait |
Working now on fixing the tests |
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
@asheryerm Glad to see you working on this. Did you look into accumulating the commands between |
@bpo Hi Brian, yes, there are two viable options:
I chose option (2) for two reasons: |
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
…_impl.cc Co-authored-by: Wei Si <[email protected]> Signed-off-by: Asher Yermiyahu <[email protected]>
Hey @weisisea I tested this by connecting envoy to a redis-server and then killing the server in the middle of the transaction: If the client continues sending commands past this point they will receive an |
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Closing the downstream connection (ProxyFilter object) upon the dedicated connection being closed sounds good to me since we probably don't want the rest of the commands to be run outside of the transaction. Could you please elaborate more on how closing the downstream connection is achieved? |
A follow-up question, is there a plan on incorporating WATCH command support as well to complete the whole transaction story for Redis? Thanks! |
Hi @mattklein123, the changes look good to me. Do you want to take a pass at it? |
/retest |
Retrying Azure Pipelines: |
When the dedicated connection is closed the dispatcher sends a close event to the dedicated transaction client. However, the dedicated client uses the parent ProxyFilter for the handling of its connection callbacks, so this leads to a termination of the ProxyFilter. |
If this current PR is merged and you are more or less happy with the way I did it, then I can definitely look into supporting WATCH as well. It will probably be a smaller change once we have transaction support in place. |
Signed-off-by: asheryer <[email protected]>
Signed-off-by: asheryer <[email protected]>
Great, thanks! |
Signed-off-by: asheryer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM. One small documentation request. Thank you!
/wait
Signed-off-by: asheryer <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: asheryer [email protected]
Commit Message: redis: added support for transactions (#22162)
Additional Description:
This has been a feature requested by several large clients who would like to work with envoy+elasticache.
The lack of support for transactions in envoy has prevented them from migrating to envoy thus for.
For certain users, redis transactions are a vital part of their workflow/s.
I implemented transactions by opening a new connection to the primary host of the shard that handles the transaction.
A new connection is needed to prevent contamination of the transaction by other clients.
Once the transaction is over the connection is closed.
In more detail:
When a MULTI command is sent, we mark down that this client has started a transaction and we reply locally with an "OK". We then wait for a command with key KEY, and once it arrives we:
Edge cases such as nested MULTI, EXEC without MULTI, etc. are all handled.
As far as the user is concerned, the user experience is almost identical to working with a standalone Redis node.
Risk Level: Medium
Testing: Tested on standalone/cluster/elasticache
Docs Changes: changelog
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]