-
Notifications
You must be signed in to change notification settings - Fork 76
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
[Feature]: Membership change #306
Comments
More details of stage 1
|
ProblemAt first, I planned to reuse the processing logic for command directly as follows, but the ...
TaskType::SpecExe(entry, pre_err) => {
let er = if let Some(err_msg) = pre_err {
Err(err_msg)
} else {
match entry.entry_data {
EntryData::Command(ref cmd) => ce
.execute(cmd, entry.index)
.await
.map_err(|e| e.to_string()),
EntryData::ConfChange(_) => todo!(),
}
};
let er_ok = er.is_ok();
cb.write().insert_er(entry.id(), er);
if !er_ok {
sp.lock().remove(entry.id());
let _ig = ucp.lock().remove(entry.id());
}
debug!(
"{id} cmd({}) is speculatively executed, exe status: {er_ok}",
entry.id()
);
er_ok
}
... Solution...
TaskType::SpecExe(entry, pre_err) => match entry.entry_data {
EntryData::Command(ref cmd) => {
let er = if let Some(err_msg) = pre_err {
Err(err_msg)
} else {
ce.execute(cmd, entry.index)
.await
.map_err(|e| e.to_string())
};
let er_ok = er.is_ok();
cb.write().insert_er(entry.id(), er);
if !er_ok {
sp.lock().remove(entry.id());
let _ig = ucp.lock().remove(entry.id());
}
debug!(
"{id} cmd({}) is speculatively executed, exe status: {er_ok}",
entry.id()
);
er_ok
}
EntryData::ConfChange(_) => true,
}
... In fact, |
LGTM |
Description about the feature
Membership change has two different situations
C_new
, and the old configuration node set isC_old
. AfterC_new
is committed, it enters the joint consensus state. When an election occurs,C_old
andC_new
jointly decide, and then the leader creates an empty Configuration change log, after this log committed, cluster can useC_new
alone to make decisions, and the cluster completes this configuration change node, and this configuration change is complete.Learner
When adding a new node to the cluster, the new node does not have the current data of the cluster. At this time, the leader needs to sync the data to the new node. This process may take a while, which will increase the risk of cluster unavailability. Therefore, the Learner node is introduced. Nodes only sync logs, do not participate in voting, wait until the Leaner node catches up with the progress of the leader, and then promote it to a normal node.
I plan to implement the membership change in three stages
Tests
Related papers
Code of Conduct
The text was updated successfully, but these errors were encountered: