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

Improve error message for initial setup of cluster mode #1075

Merged

Conversation

supercaracal
Copy link
Contributor

@supercaracal supercaracal commented Feb 18, 2022

We are currently hard to find out causes when error occured while fetching cluster state information. So this PR adds a specific error class and messages.

current message:

Redis Client could not connect to any cluster nodes (Redis::CannotConnectError)

improved messages:

Redis client could not fetch cluster information: ERR SELECT is not allowed in cluster mode (Redis::Cluster::InitialSetupError)
Redis client could not fetch cluster information: ERR This instance has cluster support disabled (Redis::Cluster::InitialSetupError)
Redis client could not fetch cluster information: Error connecting to Redis on 127.0.0.1:7006 (Errno::ECONNREFUSED) (Redis::Cluster::InitialSetupError)
Redis client could not fetch cluster information: NOPERM this user has no permissions to run the 'cluster' command or its subcommand (Redis::Cluster::InitialSetupError)

related issues:

@supercaracal supercaracal force-pushed the improve-err-msg-for-cluster-init-steps branch from f7805e1 to fc41681 Compare February 18, 2022 00:55
@supercaracal supercaracal marked this pull request as ready for review February 18, 2022 01:03
Copy link
Collaborator

@byroot byroot left a comment

Choose a reason for hiding this comment

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

One very small code style nitpick, other than that it looks very good.

As always, Thank you @supercaracal !

lib/redis/cluster/command_loader.rb Outdated Show resolved Hide resolved
begin
return fetch_node_info(node)
rescue CannotConnectError, ConnectionError, CommandError => e
next e
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

begin
return fetch_slot_info(node)
rescue CannotConnectError, ConnectionError, CommandError => e
next e
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here.

@supercaracal supercaracal force-pushed the improve-err-msg-for-cluster-init-steps branch from 1cbba57 to 159eb79 Compare February 18, 2022 08:08
@supercaracal
Copy link
Contributor Author

@byroot Thank you for your review and advice. I've fixed it.

@byroot byroot merged commit 13c7a8e into redis:master Feb 18, 2022
@supercaracal supercaracal deleted the improve-err-msg-for-cluster-init-steps branch February 18, 2022 08:21
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