Skip to content

Cluster mode draft PR #2 #4

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

Draft
wants to merge 105 commits into
base: master
Choose a base branch
from
Draft

Cluster mode draft PR #2 #4

wants to merge 105 commits into from

Conversation

barshaul
Copy link
Owner

@barshaul barshaul commented Sep 5, 2021

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)?

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

Description of change

Please provide a description of the change here.

barshaul and others added 17 commits August 16, 2021 18:23
Reformated files and sorted imports and static arrays.
…n' to override the Connection's class on_connect function.

2. Replaced CLusterConnection and SSLClusterConnection classes in RedisCluster.on_connect function that would be responsable of establishing readonly connection and setting the connection's parser to ClusterParser.
3. Added support in reading from replicas with Round-Robin load balancing.
4. Added readonly and readwrite commands.
 2) Commands class divided into smaller categories
 2) Commands class divided into smaller categories
…and 1 replica. Added Makefile target 'test-cluster' to run all the cluster's tests.
2. Fixed bugs related to moved/cluster down error.
2. Added another replica for the cluster's docker env.
docker-entry.sh Outdated
@@ -15,5 +15,7 @@ if [ "${GITHUB_ACTIONS}" = true ] ; then
fi

# use the wait-for-it util to ensure the server is running before invoking Tox
util/wait-for-it.sh ${REDIS_MASTER} -- tox -- --redis-url=redis://"${REDIS_MASTER}"/9
util/wait-for-it.sh ${REDIS_MASTER} -- tox -- --redis-url=redis://"${REDIS_MASTER}"/${DB}
#util/wait-for-it.sh ${REDIS_MASTER} -- tox -- tests/test_cluster.py::TestRedisClusterObj::test_moved_redirection_after_failover --redis-url=redis://"${REDIS_MASTER}"/${DB}
Copy link
Owner Author

Choose a reason for hiding this comment

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

For debug purposes, will be deleted.

@@ -16,7 +16,7 @@


REDIS_INFO = {}
default_redis_url = "redis://localhost:6379/9"
default_redis_url = "redis://localhost:6379/0"
Copy link
Owner Author

Choose a reason for hiding this comment

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

For debug purposes, will be deleted

@@ -123,6 +127,7 @@ def test_acl_getuser_setuser(self, r, request):

def teardown():
r.acl_deluser(username)

Copy link
Owner Author

Choose a reason for hiding this comment

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

I used autopep8 on this file so it was reformatted, I can roll it back to remove all the unrelated changes in future PR.

def test_reset(cluster, sentinel):
cluster.master['is_odown'] = True
assert sentinel.sentinel_reset('mymaster')
def test_discover_master(sentinel, master_ip):
Copy link
Owner Author

Choose a reason for hiding this comment

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

I moved all tests to be under a class so I could use 'skip_if_cluster_mode' on all together.

chayim and others added 24 commits October 26, 2021 10:20
…we will execute 'COMMAND GETKEYS' command to get from the server the key positions. if is a pubsub command, we'll use the hardcoded positions. else, we will use the start/last key and step count of 'COMMAND's output.
…h set to True by default. With this changes, RedisCluster creation doesn't need to run cluster_require_full_coverage() by default, which didn't work with clusters without the CONFIG command, and will be called only if require_full_coverage was set to False by the user and the slots are not fully covered.
…er which will be called by RedisCluster function 'on_connect' when connection is getting established
2. Fixed the cluster's response_callbacks to be called only with cluster commands
…CAS, ALL_NODES and RANDOM. It intends to replace executing commands with specifying directly target nodes (for example r.ping(r.get_primaries())), so the nodes will be internally resolved and the client will be able to retry after a topology change.
…ation check for 'cluster-require-full-coverage' if the user requested that the cluster won't require full coverage.
…stead of slot to server_idx.

Added debug mode to print the executed command and target node.
…le docker that will create all nodes locally.
@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@992b149). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #4   +/-   ##
=========================================
  Coverage          ?   49.10%           
=========================================
  Files             ?       59           
  Lines             ?    13740           
  Branches          ?        0           
=========================================
  Hits              ?     6747           
  Misses            ?     6993           
  Partials          ?        0           

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 992b149...5372cb6. Read the comment docs.

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.

4 participants