forked from redis-rs/redis-rs
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Merge from upstream #132
Merged
shachlanAmazon
merged 28 commits into
amazon-contributing:main
from
nihohit:merge-upstream
Mar 13, 2024
Merged
Merge from upstream #132
shachlanAmazon
merged 28 commits into
amazon-contributing:main
from
nihohit:merge-upstream
Mar 13, 2024
Conversation
This file contains 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
* Cluster SlotMap: Allow missing slots. The cluster can still operate when some slots don't have coverage, so there's no reason that the connection won't work. Requests that should be routed to missing slots will be forwarded to a random node. * Fix SlotAddrs not holding all replicas. This change fixes 2 issues - 1. Since SlotAddrs saves at most 1 replica (or none, if `read_from_replica` is false), it means that when there are 2 or more replicas in the cluster, `AllNodes` commands aren't actually sent to all nodes. 2. `SlotAddr::Replica` carries 2 separate semantic meanings - it could mean that the command is a readonly command, or that the user asked to route the command to a replica. The first case should be affected by the `read_from_replica` client flag, but the second case shouldn't - if the user requested that this specific command be routed to the replica, the specific request should override the prior configuration. * Fix multi-slot routes/addresses mismatch. If the `SlotMap` is partial, and some slots don't have addresses, then we need to communicate this back when getting addresses for multi-slot commands. Otherwise we the key indices won't match the addresses, and commands with the wrong keys will be sent to the wrong nodes. * fix typo
Replace Vec reference with a slice, and remove iterator trait when using ExactSizeIterator, since it encompasses it.
…dis-rs#968) * aio::ClusterConnection: Report missing connections. This change should ensure that if a connection wasn't found, after redirecting to node, or when no random connection is available, then the cluster connection will refresh slots. * Add sleep to refresh slots action. * Cancel redirects after disconnects. If a redirected request reaches a disconnected node, the redirection will be cancelled, and the routing will revert to the original routing. * Move OperationTarget to Err side of result, and reduce generics. OperationTarget is used only on errors, so it should be in the `Err` case only. The added generics were used to hide a single type. * Handle disconnect from all nodes. If the async cluster connection completely disconnects from all nodes in the server, it will try again to connect to the inital nodes that were provided upon creation. This prevents a situation where the client removes connections incrementally, until the connection map is completely empty, and there are no connections to refresh slots on.
Parsing errors mean that the connection received a response it doesn't know how to handle. This means that it cannot make sense of the next values sent over the connection, and the connection must be replaced. related: redis-rs#984 (comment)
This change ensures that reconnect attempts that happen during retries, or new connections that happen after MOVED/ASKING errors, will be saved instead of constantly reconnecting until slots are refreshed.
This removes unnecessary `match`es and `map` from the code, and moves the usage of `poll_recover` into `poll_flush`, so as not to block new requests while trying to recover a connection.
`aio::Connection` is deprecated, we should test `aio::MultiplexedConnection` instead.
Currently server errors stop the parser and return a RedisError. This caused errors that are returned inside an array, such as transaction errors, to cause the rest of the array to not be parsed. This is solved by adding an internal value type that includes the server errors, so when parsing to the internal value type, the array will finish parsing, and then extracting the error.
Parsing errors are client-side errors, that are caused by bad output from the server. Response errors are server-side errors, caused by bad input from the user / client. Parse errors cause the client to be in an unrecoverable state. response errors are OK.
* Initial implementation of RESP3 (redis-rs#757) These changes implement all RESP3 types (excluding streamed types). RESP3 can be enabled per connection by adding `?resp3=true` to connection uri. It currently supports PubSub as RESP2 PubSub support in library, but in future PRs it'll support handling normal commands and PubSub messages in one connection. Only `num-bigint` is added as dependency to support `BigNumber` type. Changes made in support of redis-rs#329 and redis-rs#749 * Add RESP3 support to cluster connections. (redis-rs#1001) * Resp3 Push Management (redis-rs#898) * squash! * oops! * test invalidation in cluster && introduce client tracking options * introduce basic PubSub functionality to MultiplexedConnection and make tokio sender unbounded channel * fix tests & linter, make PushSender::Tokio as aio feature only * add resp3 to ci branches and fix cluster client tracking option * test dropping and update ci yml * remove unsubscribe fn and introduce unsubscribing by dropping receiver. * fix tests because RedisJson returns responses in an array when it's resp3 * override redisjson cache (it's a temp solution) * add -skip test_module to RESP3 testing and upgrade redis 6.2.4 to 6.2.13 * test json modules with RESP3 and get json fix from main * in redis v7 RedisJson is different with Resp3 🤔 * Implement Pub/Sub in Async Cluster & fmt & remove usage of is_err_and(stable only after v1.70) * don't use sharded pub/sub with redis v6 * use REDIS_VERSION in env instead of using HELLO command to fetch redis version * oops * fix linter * fix fmt and remove benchmark from CI * simplify PushManager and add tokio as non-optional dependency. * get fixes from 220c6a9 * use --test-threads=1 * override redisjson cache (it's a temp solution) * remove get_push_manager from traits & remove push manager from aio::Connection * remove client_tracking_options * remove 0.21.x from rust.yml * add tests for pushmanager * format & move push_info into a variable * change tests according to comments. * apply 6.2.4 changes && fmt * try to fix * remove con_addr & remove pub/sub support in cluster connections * add disconnection handling to sync, mpx, cm && test it * remove push_manager argument from connection creation * better docs * add has_reply function to PushKind * remove no response command support in mpx since it's not used in mpx pub/sub * apply changes from redis-rs#994 * fix tests * Use enum instead of boolean for RESP version. (redis-rs#1012) Since there's a discussion starting about what might become RESP4, this PR will make it easier to add more RESP versions in the future. * Rename Value enum types in order to match Redis RESP names. (redis-rs#779) * Rename Value::Bulk to Value::Array. * Rename Value::Status to Value::SimpleString. * Rename Value::Data to Value::BulkString. * Fix debug names of values. * fix nightly comments. * reintroduce client tracking to tests. * fix merge errors. --------- Co-authored-by: Altan Özlü <5479094+altanozlu@users.noreply.github.com>
barshaul
approved these changes
Mar 13, 2024
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.
Issue #, if available:
Description of changes:
Pull recent changes to https://github.com/redis-rs/redis-rs.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.