Skip to content

Open slots also need to be parsed #2072

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

Closed
wants to merge 2 commits into from
Closed

Open slots also need to be parsed #2072

wants to merge 2 commits into from

Conversation

ma2sql
Copy link

@ma2sql ma2sql commented Mar 30, 2022

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

Special slot entries called open slots for the CLUSTER NODES command should also be parsed.
(https://redis.io/commands/cluster-nodes/#special-slot-entries)

Currently, [0->-292f8b365bb7edb5e285caf0b7e6ddc7265d2f4f] is parsed as follows.

# output of cluster("NODES")
{
...
'slots': [['0', '5460'], ['[0', '>', '292f8b365bb7edb5e285caf0b7e6ddc7265d2f4f]']
...
}

I think it's better to have it parsed as follows.

# output of cluster("NODES")
{
...
'slots': [['0', '5460']],
'migrating': {'0': '292f8b365bb7edb5e285caf0b7e6ddc7265d2f4f'},
'importing': {'5461': 'e7d1eecce10fd6bb5eb35b9f99a514335d9ba9ca'},
...
}

And I also fixed an issue where the parse_cluster_nodes function could not handle byte arrays.

@dvora-h
Copy link
Collaborator

dvora-h commented Apr 3, 2022

@ma2sql Great PR, Thanks! I just merge in the latest master to make sure all the tests pass and we can merge this PR.

@codecov-commenter
Copy link

codecov-commenter commented Apr 3, 2022

Codecov Report

Merging #2072 (3586968) into master (876cafc) will decrease coverage by 9.46%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##           master    #2072      +/-   ##
==========================================
- Coverage   91.23%   81.77%   -9.47%     
==========================================
  Files         100      100              
  Lines       21361    21372      +11     
==========================================
- Hits        19489    17477    -2012     
- Misses       1872     3895    +2023     
Impacted Files Coverage Δ
redis/client.py 88.55% <66.66%> (-0.75%) ⬇️
tests/test_cluster.py 17.43% <0.00%> (-80.12%) ⬇️
redis/cluster.py 22.19% <0.00%> (-69.64%) ⬇️
redis/crc.py 40.00% <0.00%> (-60.00%) ⬇️
redis/commands/cluster.py 34.28% <0.00%> (-59.29%) ⬇️
redis/utils.py 75.00% <0.00%> (-13.89%) ⬇️
redis/exceptions.py 86.56% <0.00%> (-11.95%) ⬇️
tests/conftest.py 77.20% <0.00%> (-9.21%) ⬇️
tests/test_scripting.py 90.38% <0.00%> (-3.21%) ⬇️
redis/commands/parser.py 86.95% <0.00%> (-1.45%) ⬇️
... and 5 more

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 876cafc...3586968. Read the comment docs.

@ma2sql
Copy link
Author

ma2sql commented Apr 4, 2022

@dvora-h Thank you!

@ma2sql
Copy link
Author

ma2sql commented Apr 4, 2022

#2080 It's duplicated. Close it.

@ma2sql ma2sql closed this Apr 4, 2022
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.

3 participants