Skip to content

Commit

Permalink
Fix duplicate log (join/rejoined)
Browse files Browse the repository at this point in the history
  • Loading branch information
guilload committed Feb 29, 2024
1 parent a5c1199 commit 3b309bd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions quickwit/quickwit-cluster/src/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ async fn compute_cluster_change_events_on_added(
let maybe_previous_node_entry = previous_nodes.entry(new_node_id);

let mut events = Vec::new();
let mut verb = "joined";

if let Entry::Occupied(previous_node_entry) = maybe_previous_node_entry {
let previous_node_ref = previous_node_entry.get();
Expand All @@ -158,13 +159,8 @@ async fn compute_cluster_change_events_on_added(
);
return events;
}
info!(
node_id=%new_chitchat_id.node_id,
generation_id=%new_chitchat_id.generation_id,
"node `{}` has rejoined the cluster",
new_chitchat_id.node_id
);
let previous_node = previous_node_entry.remove();
verb = "rejoined";

if previous_node.is_ready() {
events.push(ClusterChange::Remove(previous_node));
Expand All @@ -178,8 +174,8 @@ async fn compute_cluster_change_events_on_added(
info!(
node_id=%new_chitchat_id.node_id,
generation_id=%new_chitchat_id.generation_id,
"node `{}` has joined the cluster",
new_chitchat_id.node_id
"node `{}` has {verb} the cluster",
new_chitchat_id.node_id,
);
let new_node_id: NodeId = new_node.node_id().into();
previous_nodes.insert(new_node_id, new_node.clone());
Expand Down

0 comments on commit 3b309bd

Please sign in to comment.