-
Notifications
You must be signed in to change notification settings - Fork 452
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
Persist the cluster nodes info after applying the cluster topology #1219
Persist the cluster nodes info after applying the cluster topology #1219
Conversation
I have some comments on the file format. I think it is a new file format that relies on what is in the comments (starting with
And there are some util functions in |
Yes, it'd be better to keep the same format, I will reconsider if it's other issues. |
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.
And still I have two questions:
- do we have spec on the conf? @PragmaTwice 's advice is ok, and why don't we using something like JSON? It's our standard compatible with other format?
- Should we ignore some "stale" config? What should we do if a server is crashed?
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.
If any bad record or new format is supported, the code running on old server would reject the format, and failed to start.
So, why do we failed when LoadClusterNodes
failed?
src/cluster/cluster.cc
Outdated
nodesInfo.append(line + "\n"); | ||
break; | ||
default: | ||
return {Status::NotOK, "got unknown parse state"}; |
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.
In the future, if we support other states, seems load would fail?
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.
It should make sense that the older version can't parse new state.
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.
It should make sense that the older version can't parse new state.
It's ok but, if a user want to rollback(maybe because some other reason), and the protocol is updated. He will failed to start, unless he delete the file.
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, I have no strong point in this scenario. My initial intention is to prevent unexpected configurations.
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.
To see other folks have any advice? @PragmaTwice @ShooterIT @torwig
I have a suspicion that all the members of the |
Yes, we should reconsider making those commands exclusive. |
all cluster writing commands have |
is there a way which allow we persist the cluster topology into some rocksdb CF? |
another issue, since after rebooting, replica would load topology and try to sync with master, so when master receive the sync request from slave, master should check if the replica is in its current cluster topology, if yes, master allow, if no, it should reject. |
We have no node id or port in the replication process, so it cannot identify the replica and reject it on the master side. But we can compare the cluster version before connecting on the replica side. |
My bad, I forget the |
I think it's unnecessary, the local file will make it easier to modify or drop it manually. |
It seems CI was not triggered. We can make an empty commit to retry. |
ok |
@ShooterIT To make the context clear, I'll merge this PR first, then file another PR to enhance the replication. |
Thanks all, merging... |
This closes #1021
Currently, the cluster nodes' info is only stored in memory and we need to re-sync the cluster topology after restarting. It's very inconvenient and confusing for most users.
Solutoin
{config->dir}/nodes.conf
and the format is below:nodes.conf
if the cluster mode is enabled and the nodes file is exists