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

Clusters should optionally require full slot coverage #1845

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

barshaul
Copy link
Contributor

@barshaul barshaul commented Jan 2, 2022

…on, Changed RedisClient's 'require_full_coverage' default value to false

Pull Request check-list

Please make sure to review and check all of these items:

  • Does $ tox pass with this change (including linting)?
  • 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)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

In order to avoid the client being a limiting factor for communicating with the server, we should not require full slots coverage by default in the client side.

require_full_coverage parameter:
When set to False (default value): the client will not require a
full coverage of the slots. However, if not all slots are covered,
and at least one node has 'cluster-require-full-coverage' set to
'yes,' the server will throw a ClusterDownError for some key-based
commands. See -
https://redis.io/topics/cluster-tutorial#redis-cluster-configuration-parameters
When set to True: all slots must be covered to construct the
cluster client. If not all slots are covered, RedisClusterException
will be thrown.

The 'skip_full_coverage_check' parameter has been removed from RedisClient, and the client no longer checks for 'cluster-require-full-coverage' configuration on the cluster nodes (note - not backward compatible). This check doesn't need to be run since it's an overhead for the client and is already handled by the server's ClusterDown error. Additionally, some managed Redis clusters, such as ElastiCache, don't support the 'config' command, so the client will not work with the default configurations if we keep the node's configuration check. Other clients (e.g. Lettuce, Jedis) doesn't run this check as well.

…on, Changed RedisClient's 'require_full_coverage' default value to false
@barshaul barshaul marked this pull request as draft January 2, 2022 14:04
@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2022

Codecov Report

Merging #1845 (b9748e9) into master (231d402) will decrease coverage by 0.04%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1845      +/-   ##
==========================================
- Coverage   93.64%   93.60%   -0.05%     
==========================================
  Files          76       76              
  Lines       16207    16199       -8     
==========================================
- Hits        15177    15163      -14     
- Misses       1030     1036       +6     
Impacted Files Coverage Δ
redis/cluster.py 92.42% <ø> (+0.37%) ⬆️
tests/test_cluster.py 98.28% <75.00%> (-0.51%) ⬇️
tests/conftest.py 89.76% <0.00%> (-0.94%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 231d402...b9748e9. Read the comment docs.

@@ -1450,29 +1419,9 @@ def initialize(self):
# isn't a full coverage
raise RedisClusterException(
f"All slots are not covered after query all startup_nodes. "
f"{len(self.slots_cache)} of {REDIS_CLUSTER_HASH_SLOTS} "
f"{len(tmp_slots)} of {REDIS_CLUSTER_HASH_SLOTS} "
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small bug fix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - limit based on available as opposed to the entire cluster. This should recover more cleanly.

@barshaul barshaul marked this pull request as ready for review January 2, 2022 14:48
@@ -1450,29 +1419,9 @@ def initialize(self):
# isn't a full coverage
raise RedisClusterException(
f"All slots are not covered after query all startup_nodes. "
f"{len(self.slots_cache)} of {REDIS_CLUSTER_HASH_SLOTS} "
f"{len(tmp_slots)} of {REDIS_CLUSTER_HASH_SLOTS} "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense - limit based on available as opposed to the entire cluster. This should recover more cleanly.

@chayim chayim added the bug Bug label Jan 4, 2022
@chayim chayim changed the title RedisCluster client changed to not require full slots coverage by default Clusters should optionally require full slot coverage Jan 4, 2022
@chayim chayim merged commit 80f1d2f into redis:master Jan 10, 2022
@chayim chayim deleted the require_slots_full_coverage branch January 10, 2022 11:03
dvora-h pushed a commit to dvora-h/redis-py that referenced this pull request Jan 11, 2022
dvora-h pushed a commit to dvora-h/redis-py that referenced this pull request Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants