Skip to content

Allow replica to master promotion in nodes_cache#2549

Merged
dvora-h merged 1 commit intoredis:masterfrom
zakaf:promote_node_in_cache
Jan 11, 2023
Merged

Allow replica to master promotion in nodes_cache#2549
dvora-h merged 1 commit intoredis:masterfrom
zakaf:promote_node_in_cache

Conversation

@zakaf
Copy link
Copy Markdown
Contributor

@zakaf zakaf commented Jan 10, 2023

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

Please provide a description of the change here.
fixes #2433

When replica is promoted to master, ClusterNode's server_type must change accordingly, but the current implementation reuses the server_type, so no master is found in nodes_cache after initialization

This PR changes the server_type to a correct value, even if we reuse ClusterNode from nodes_cache

I've personally experienced this scenario, when i changed instance type in AWS Elasticache

  • changing instance type resulted in the addition of a new replica node and that node getting promoted to master

@zakaf zakaf force-pushed the promote_node_in_cache branch from bf2a30c to af47499 Compare January 10, 2023 04:00
@zakaf zakaf changed the title add support for custom connection pool class in NodesManager @zach-iee allow replica to master promotion in nodes_cache Jan 10, 2023
@zakaf zakaf changed the title @zach-iee allow replica to master promotion in nodes_cache Allow replica to master promotion in nodes_cache Jan 10, 2023
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 10, 2023

Codecov Report

Base: 92.24% // Head: 92.22% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (af47499) compared to base (f46d7f3).
Patch coverage: 85.18% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2549      +/-   ##
==========================================
- Coverage   92.24%   92.22%   -0.02%     
==========================================
  Files         115      115              
  Lines       29554    29581      +27     
==========================================
+ Hits        27262    27281      +19     
- Misses       2292     2300       +8     
Impacted Files Coverage Δ
tests/test_cluster.py 96.83% <84.00%> (-0.29%) ⬇️
redis/cluster.py 90.37% <100.00%> (+0.02%) ⬆️
tests/test_asyncio/test_search.py 98.29% <0.00%> (-0.35%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@chayim chayim added the bug Bug label Jan 10, 2023
@dvora-h dvora-h merged commit bae6385 into redis:master Jan 11, 2023
@zakaf zakaf deleted the promote_node_in_cache branch January 11, 2023 13:52
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.

IndexError during Cluster client creation

5 participants