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

[fix]the raft protocol is used to synchronize node information fix is… #1352

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions meta/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ async fn detect_node_heartbeat(heartbeat_config: HeartBeatConfig, app: Data<Meta
interval.tick().await;

if let Ok(_leader) = app.raft.is_leader().await {
let sm = app.store.state_machine.write().await;
let opt_list = app.store.state_machine.write().await.children_data::<NodeMetrics>(&metrics_path);

if let Ok(list) = sm.children_data::<NodeMetrics>(&metrics_path) {
if let Ok(list) = opt_list {
let node_metrics_list: Vec<NodeMetrics> = list.into_values().collect();

let time = now_timestamp_secs();
Expand All @@ -151,7 +151,9 @@ async fn detect_node_heartbeat(heartbeat_config: HeartBeatConfig, app: Data<Meta
now_node_metrics,
);

sm.process_write_command(&req);
if app.raft.client_write(req).await.is_err() {
tracing::error!("failed to change node status to unreachable");
}
}
}
}
Expand Down