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

Update Cluster Bus Port out of range error message for Cluster Meet command #240

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hwware
Copy link
Member

@hwware hwware commented Feb 27, 2025

This PR is related to PR valkey-io/valkey#1686

@hwware hwware force-pushed the port-and-cport-range-check branch from f838260 to 1cf1cef Compare February 27, 2025 17:16
@hwware hwware requested a review from zuiderkwast February 27, 2025 17:17
hwware added a commit to valkey-io/valkey that referenced this pull request Feb 27, 2025
…and (#1686)

Now for the cluster meet command, we first check the port and cport
number, and then the function clusterStartHandshake() is called.
In the function clusterStartHandshake(), ip address is checked first and
then port and cport range are checked.
Even port or cport range is out of bound, only error message "Invalid
node address specified" is reported.
This is not correct.

In this PR, I just make the port and cport check together before
clusterStartHandshake() function. Thus the port number and range can be
checked together.

One example:

Current behavior:

127.0.0.1:7000> cluster meet 10.21.96.98 65000
(error) ERR Invalid node address specified: 10.21.96.98:65000
127.0.0.1:7000> cluster meet 1928.2292.2983.3884.26622 6379
(error) ERR Invalid node address specified:
1928.2292.2983.3884.26622:6379

Whatever the wrong ip address or incorrect bus port number, user get the
same error message.

New behavior:

127.0.0.1:7000> cluster meet 10.21.96.98 65000
(error) ERR Cluster bus port number is out of range
127.0.0.1:7000> cluster meet 1928.2292.2983.3884.26622 6379
(error) ERR Invalid node address specified:
1928.2292.2983.3884.26622:6379

User can get much clearer error message.

Related note pr: valkey-io/valkey-doc#240

---------

Signed-off-by: hwware <[email protected]>
Signed-off-by: Wen Hui <[email protected]>
Co-authored-by: Viktor Söderqvist <[email protected]>
@@ -259,7 +259,7 @@
"[Array reply](../topics/protocol.md#arrays): an array of maps where each map contains various attributes and their values of a cluster link."
],
"CLUSTER MEET": [
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. If the address or port specified are invalid an error is returned."
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. If the port or cluster bus port number is out of range, an error is returned. If the ip address is invalid, Invalid node address message is returned."
Copy link
Contributor

Choose a reason for hiding this comment

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

"Invalid node address message" is an error too.

Do we need to specify document the exact error message here? I think we usually don't document it.

What do you think about this?

Suggested change
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. If the port or cluster bus port number is out of range, an error is returned. If the ip address is invalid, Invalid node address message is returned."
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. If the port or cluster bus port number is out of range, or if an invalid address is specified, an error is returned."

Copy link
Member Author

Choose a reason for hiding this comment

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

Address your comments in 2 files. Please take a look, Thanks

@hwware hwware force-pushed the port-and-cport-range-check branch from 4485b7b to 4d07e16 Compare February 28, 2025 16:18
@@ -259,7 +259,7 @@
"[Array reply](../topics/protocol.md#arrays): an array of [Map reply](../topics/protocol.md#maps) where each map contains various attributes and their values of a cluster link."
],
"CLUSTER MEET": [
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. If the address or port specified are invalid an error is returned."
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful.If the port or cluster bus port number is out of range, or if an invalid address is specified, an error is returned."
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, but a space was removed by mistake.

Suggested change
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful.If the port or cluster bus port number is out of range, or if an invalid address is specified, an error is returned."
"[Simple string reply](../topics/protocol.md#simple-strings): `OK` if the command was successful. If the port or cluster bus port number is out of range, or if an invalid address is specified, an error is returned."

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