Skip to content
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

Fix new clippy lints. #1052

Merged
merged 1 commit into from
Feb 9, 2024
Merged

Fix new clippy lints. #1052

merged 1 commit into from
Feb 9, 2024

Conversation

nihohit
Copy link
Contributor

@nihohit nihohit commented Feb 8, 2024

Replace Vec reference with a slice, and remove iterator trait when using ExactSizeIterator, since it encompasses it.

Replace Vec reference with a slice, and remove iterator trait when using ExactSizeIterator, since it encompasses it.
@nihohit nihohit merged commit 26c977c into redis-rs:main Feb 9, 2024
10 checks passed
@nihohit nihohit deleted the clippy-upstream branch February 11, 2024 13:33
shachlanAmazon pushed a commit to amazon-contributing/redis-rs that referenced this pull request Feb 26, 2024
* 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.

* Add lock file to keep MSRV constant. (redis-rs#1039)

* [opt] preallocate buffer for evalsha in `Script` (redis-rs#1044)

* Cluster: fix read from replica & missing slots. (redis-rs#965)

* 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

* fix redis-rs#1045: impl `Clone`/`Copy` for `SetOptions` (redis-rs#1046)

* docs: add "connection-manager" cfg attr (redis-rs#1048)

* Fix new clippy lints. (redis-rs#1052)

Replace Vec reference with a slice, and remove iterator trait when using ExactSizeIterator, since it encompasses it.

* 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 lints.

---------

Co-authored-by: Altan Özlü <5479094+altanozlu@users.noreply.github.com>
Co-authored-by: Huxley Hu <framlog@users.noreply.github.com>
Co-authored-by: Ahmad <39441506+ahmadbky@users.noreply.github.com>
Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
shachlanAmazon pushed a commit to amazon-contributing/redis-rs that referenced this pull request Mar 13, 2024
* Add lock file to keep MSRV constant. (redis-rs#1039)

* [opt] preallocate buffer for evalsha in `Script` (redis-rs#1044)

* Cluster: fix read from replica & missing slots. (redis-rs#965)

* 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

* fix redis-rs#1045: impl `Clone`/`Copy` for `SetOptions` (redis-rs#1046)

* docs: add "connection-manager" cfg attr (redis-rs#1048)

* Fix new clippy lints. (redis-rs#1052)

Replace Vec reference with a slice, and remove iterator trait when using ExactSizeIterator, since it encompasses it.

* Async cluster connection: Improve handling of missing connections (redis-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.

* Appease Clippy (redis-rs#1061)

* Reconnect on parsing errors.

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)

* Save reconnected connections during retries.

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.

* [fix] make `Pipeline` handle returned bulks correctly

* Update mio dependency due to vulnerability. (redis-rs#1064)

GHSA-r8w9-5wcg-vfj7

* Simplify Sink polling logic.

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.

* Remove the usage of aio::Connection in tests.

`aio::Connection` is deprecated, we should test `aio::MultiplexedConnection` instead.

* Fail CI if lock file isn't updated.

* Handle server errors in array response.

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.

* Create a server error type.

* Separate parsing errors from general response errors.

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.

* Release redis 0.25.0 / redis-test 0.4.0

* Update test version (redis-rs#1071)

* Fix ambiguity in examples

* Upgrade to socket2 0.5

* Avoid library dependency on futures-time

* Merge the `resp3` branch. (redis-rs#1058)

* 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>

* fix flakey test

* Fix linter.

* fix cargo lock.

---------

Co-authored-by: Huxley Hu <framlog@users.noreply.github.com>
Co-authored-by: Ahmad <39441506+ahmadbky@users.noreply.github.com>
Co-authored-by: ⭐️NINIKA⭐️ <DCNick3@users.noreply.github.com>
Co-authored-by: James Lucas <jaymell@users.noreply.github.com>
Co-authored-by: framlog <framlog@gmail.com>
Co-authored-by: Neo Sun <huachuang20@gmail.com>
Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
Co-authored-by: Altan Özlü <5479094+altanozlu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants