Adding load balancing strategy configuration to cluster clients(replacement for 'read_from_replicas' config) by petyaslavova · Pull Request #3563 · redis/redis-py (original) (raw)
Pull Request check-list
Please make sure to review and check all of these items:
- Do tests and lints pass with this change?
- Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
- Is the new or changed code fully tested?
- Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
- Is there an example added to the examples folder (if applicable)?
- Was the change added to CHANGES file?
NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
Description of change
Adding load balancing strategy configuration to cluster clients(replacement for 'read_from_replicas' config)
The idea of this setting is to replace the currently existing 'read_from_replicas' configuration - its name is confusing. It leaves the impression that all the reads will be sent to replica nodes, while it actually chooses between the primary and replicas in a round-robin manner.
There was one specific situation in which random replica selection was also exposed - with this change, this configuration will be exposed through the RedisCluster objects for sync and async clients.
- Adding a new configuration field for Redis Cluster objects - load_balancing_strategy
- Adding deprecation for one of the current configs - read_from_replicas
- Adding a new enum for the available load-balancing strategies (LoadBalancingStrategy)
- Adding unit tests for the cluster and cluster pipeline operations with the new load-balancing strategies
- Adding unit test coverage for the added load-balancing strategies
- Adding some setup fixes for multiptocessing unit tests (the issue resurfaced for Mac users with a recent merge)