-
Notifications
You must be signed in to change notification settings - Fork 734
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
Implement: CLUSTER REPLICATE NO ONE #1674
base: unstable
Are you sure you want to change the base?
Implement: CLUSTER REPLICATE NO ONE #1674
Conversation
91589d1
to
ff96c0f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1674 +/- ##
============================================
+ Coverage 70.96% 71.13% +0.16%
============================================
Files 123 123
Lines 65648 65669 +21
============================================
+ Hits 46587 46711 +124
+ Misses 19061 18958 -103
|
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.
cluster-replicate.json
file should be updated and as part of the build commands.def
will get updated. or if it was accidentally not staged, please add that.
Also, could you run the clang-format on your end to fix some of the formatting issue.
fde1ab6
to
4abbae8
Compare
Updated. |
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.
This feature makes sense to me.
@valkey-io/core-team New arguments = major decision. Please approve or vote if you agree.
4abbae8
to
85238e6
Compare
The CI job "DCO" is failing. You need to use Why we need it? See here: https://github.com/valkey-io/valkey/blob/unstable/CONTRIBUTING.md#developer-certificate-of-origin thanks! |
85238e6
to
3789227
Compare
3789227
to
e4e8b24
Compare
Done |
e4e8b24
to
bed392b
Compare
Any objection to merge it? |
We're busy making the 8.1.0 release candidate just now. This one will need to wait and get merged after that. |
We should also have some tests validating this new behavior works as intended. Have a cluster, disconnect the replica, make sure slots/shards and all are still consistent and the rest of the cluster agrees on the state. |
Can we introduce a new mode so it doesn't forget all the nodes in the cluster? I think conceptually we are discussing a form of reset still so it seems to me that the solution is too tactical. Maybe BTW, I just noticed that the forget path is not always working. The reset node joined back to the cluster quickly.
I don't see the implementation moves the node to a new shard. This would leave two primaries (one real and one empty) in the original shard, which will confuse the client. |
Good catch! |
IMHO that is just a syntactical question. Whatever command name we would come up with, the behavior of it would be the same: turn replica into primary with leaving it in the cluster. If you think the name of
What do you mean by "forget path is not always working"? What forget path? We are not doing any forgetting here.
AFAIU if node is reset it will not be added back to the cluster automatically, but only when somebody does it explicitly. So if you want to remove replica manually (i.e. node is scheduled for maintenance) the only option for you is to reset with affecting all clients (start seeing errors).
What is a shard? Would you please shed a light on this term? Is it something special for ValKey? AFAIU shard is primary with replicas attached to it. So, when we switched role of the node from replica to empty primary, doesn't it mean that we moved it to separate new shard? |
bed392b
to
b419cfb
Compare
I believe I figured it out. There is internal |
b9ad4fd
to
95c0b42
Compare
I agree with @skolosov-snap that CLUSTER REPLICATE NO ONE is better. The node is not leaving the cluster so RESET seems less intuitive.
To make the cluster forget a node, you need to send |
Looking at the doc it should behave differently:
So, I believe potentially it may be fixed in the future. @PingXie, @zuiderkwast You are right about current
|
95c0b42
to
445e078
Compare
@skolosov-snap @zuiderkwast you have a good point. BTW, a follow up thought, should we consider a single token |
I suggested it earlier in this PR in comment #1674 (comment) and I was already convinced that NO ONE is better. 😆 |
Hmm the comment link seems broken. What convinced you? :) |
Not a big deal to me, but IMHO consistency/similarity between commands is better. What benefit will we get if we replace it with single toke? |
The probability will be practically 0.
We have sds human_nodename; /* The known human readable nodename for this node */ |
Interesting, the link works for me. It's one of the resolved comments above on Quoting @skolosov-snap's comment which made sense to me:
|
@PingXie is command naming still concern for you? |
No it's zero, the node ID is hex characters, you can't have N or O. I also think it's worth keeping |
I am still inclined to a single token but 👍 for "NO ONE" |
c636c6b
to
fd65b48
Compare
Signed-off-by: Sergey Kolosov <[email protected]>
9c3276f
to
9efee82
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.
The new code LGTM, thanks.
clusterCloseAllSlots(); | ||
resetManualFailover(); | ||
|
||
// moving new primary to its own shard. |
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.
@PingXie please also ack this logic.
// moving new primary to its own shard. | |
/* Moving new primary to its own shard. */ |
I prefer |
Currently, ValKey doesn't allow to detach replica attached to primary node. So, if you want to change cluster topology the only way to do it is to reset (
CLUSTER RESET
command) the node. However, this results into removing node from the cluster what affects clients. All clients will keep sending traffic to this node (with getting inaccurate responses) until they refresh their topology.In this change we implement supporting of new argument for CLUSTER REPLICATE command:
CLUSTER REPLICATE NO ONE
. When calling this command the node will be converted from replica to empty primary node but still staying in the cluster. Thus, all traffic coming from the clients to this node can be redirected to correct node.