Skip to content

Commit

Permalink
chore(cluster): disable parallel commit for cluster task (#17034)
Browse files Browse the repository at this point in the history
* chore(cluster): disable parallel commit for cluster task

* chore(cluster): update default setting
  • Loading branch information
zhang2014 authored Dec 11, 2024
1 parent a71d8cb commit fb77c1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/query/service/src/clusters/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ impl ClusterHelper for Cluster {
)))
}

let mut futures = Vec::with_capacity(message.len());
let mut response = HashMap::with_capacity(message.len());
for (id, message) in message {
let node = get_node(&self.nodes, &id)?;

futures.push({
let do_action_with_retry = {
let config = GlobalConfig::instance();
let flight_address = node.flight_address.clone();
let node_secret = node.secret.clone();
Expand All @@ -161,7 +161,7 @@ impl ClusterHelper for Cluster {
)
.await
{
Ok(result) => return Ok((id, result)),
Ok(result) => return Ok(result),
Err(e)
if e.code() == ErrorCode::CANNOT_CONNECT_NODE
&& attempt < flight_params.retry_times =>
Expand All @@ -175,10 +175,12 @@ impl ClusterHelper for Cluster {
}
}
}
});
};

response.insert(id, do_action_with_retry.await?);
}
let responses: Vec<(String, Res)> = futures::future::try_join_all(futures).await?;
Ok(responses.into_iter().collect::<HashMap<String, Res>>())

Ok(response)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/query/settings/src/settings_default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,16 +965,16 @@ impl DefaultSettings {
range: Some(SettingRange::Numeric(0..=1)),
}),
("flight_connection_max_retry_times", DefaultSettingValue {
value: UserSettingValue::UInt64(3),
value: UserSettingValue::UInt64(0),
desc: "The maximum retry count for cluster flight. Disable if 0.",
mode: SettingMode::Both,
range: Some(SettingRange::Numeric(0..=10)),
}),
("flight_connection_retry_interval", DefaultSettingValue {
value: UserSettingValue::UInt64(3),
value: UserSettingValue::UInt64(1),
desc: "The retry interval of cluster flight is in seconds.",
mode: SettingMode::Both,
range: Some(SettingRange::Numeric(0..=30)),
range: Some(SettingRange::Numeric(0..=10)),
}),
]);

Expand Down

0 comments on commit fb77c1e

Please sign in to comment.