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

Assign a new node after calling update_cluster_info! #355

Conversation

KJTsanaktsidis
Copy link
Contributor

If we catch a connection error and refresh the cluster topology, we need to re-calculate what node to send the command to in the router; the node we're using might not even be a valid node any longer.

I added two test cases to test_against_cluster_broken.rb which demonstrate this; one with a transaction, and one without. In both cases, without the patch, the first command after a node goes down fails because the client realises it needs to fetch new node info (with update_cluster_info!), but then retries the command on the old node still (which doesn't even exist anymore). The patch fixes this.

Unfortunately these tests won't pass on CI at the moment because of #354 but they work on my machine if you run them by themseles (with bundle exec ruby -Itest test/test_against_cluster_broken.rb -n 'test_reloading_on_connection_error').

If we catch a connection error and refresh the cluster topology, we need
to re-calculate what node to send the command to in the router; the node
we're using might not even be a valid node any longer.
@KJTsanaktsidis KJTsanaktsidis force-pushed the ktsanaktsidis/requery_node_after_reload branch from 0703ce5 to 11c6a2c Compare October 17, 2024 04:48
@KJTsanaktsidis
Copy link
Contributor Author

@supercaracal Thank you for fixing #354 - based on the changes you recently made to test_against_cluster_broken, I was able to rebase this PR and all the tests are now passing. I think this should be something ready to be reviewed now?

@supercaracal supercaracal self-requested a review October 17, 2024 04:59
@supercaracal supercaracal merged commit a6d5df1 into redis-rb:master Oct 17, 2024
33 checks passed
@supercaracal
Copy link
Member

Yes, it is. Thank you for the improvement!

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.

2 participants