-
Notifications
You must be signed in to change notification settings - Fork 755
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
Add Cluster Bus Port out of range error message for Cluster Meet command #1686
Conversation
470e164
to
007f9c6
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1686 +/- ##
=========================================
Coverage 71.17% 71.17%
=========================================
Files 123 123
Lines 65641 65644 +3
=========================================
+ Hits 46720 46724 +4
+ Misses 18921 18920 -1
|
56b0034
to
1ab8b98
Compare
The behavior change is that CLUSTER MEET can return an error instead of OK when the ports are invalid. This means the user can see the error early and understand what's wrong. This is the user-visible change, so it should be the title of the PR I think. The rest is just refactoring which is not important for users and release notes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need this? The old code also seems to be very easy to understand and maintain
Current old cause developers hard to identify the problem. Existing logic is to check port,, and then in function clusterStartHandshake check the ip first and check the port again. The easier way to put all port checking logic together, and then check the ip. |
@enjoy-binbin @hwware The first commit is smaller. It just moves the check from clusterStartHandshake to CLUSTER MEET so it can return an error, without extra refactoring. |
1ab8b98
to
656abde
Compare
Yes, I just make thing easier. It looks like i update codes to the fist commit, and check the port and cport in the Cluster Meet part. |
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
Signed-off-by: hwware <[email protected]>
ea8755d
to
b5e4e19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is simpler. I like it more. @enjoy-binbin WDYT?
I have just a minor comment about the error message.
Co-authored-by: Viktor Söderqvist <[email protected]> Signed-off-by: Wen Hui <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Before merge, please update the PR title to clarify the user-visible behavior, that CLUSTER MEET validates the ports and returns error for invalid ports.
That is what we should mention in the release notes.
we do return an error in this check.
how so... they are doing different thing, one is extract the number and check it range, the other is check the port range. |
Through this PR, user experience is much clearer and easy to identify where the problem is, for example: Current behavior: 127.0.0.1:7000> cluster meet 10.21.96.98 65000 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 User can get much clearer error message. |
…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]>
…ommand (#240) This PR is related to PR valkey-io/valkey#1686 --------- Signed-off-by: hwware <[email protected]> Signed-off-by: Wen Hui <[email protected]> Co-authored-by: Viktor Söderqvist <[email protected]>
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