Remove todos in subscribe_metrics function
@@ -81,7 +81,7 @@ pub struct MetaNode {
pub running_tx: watch::Sender<()>,
pub running_rx: watch::Receiver<()>,
pub join_handles: Mutex<Vec<JoinHandle<MetaResult<()>>>>,
- pub joined_nodes: AtomicI32,
+ pub joined_tasks: AtomicI32,
}
impl Opened for MetaNode {
@@ -134,7 +134,7 @@ impl MetaNodeBuilder {
running_tx: tx,
running_rx: rx,
join_handles: Mutex::new(Vec::new()),
- joined_nodes: AtomicI32::new(1),
+ joined_tasks: AtomicI32::new(1),
});
if self.monitor_metrics {
@@ -344,25 +344,23 @@ impl MetaNode {
.await
.map_error_to_meta_error(MetaError::MetaServiceError, || "fail to join")?;
// TODO(luhuanbing): Add joined node information to enrich debugging information
- self.joined_nodes
+ self.joined_tasks
.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
}
tracing::info!("shutdown: id={}", self.sto.id);
- let joined = self.joined_nodes.load(std::sync::atomic::Ordering::Relaxed);
+ let joined = self.joined_tasks.load(std::sync::atomic::Ordering::Relaxed);
Ok(joined)
}
// spawn a monitor to watch raft state changes such as leader changes,
// and manually add non-voter to cluster so that non-voter receives raft logs.
pub async fn subscribe_metrics(mn: Arc<Self>, mut metrics_rx: watch::Receiver<RaftMetrics>) {
- //TODO: return a handle for join
- // TODO: every state change triggers add_non_voter!!!
+ // TODO(luhuanbing): every state change triggers add_non_voter is not very reasonable
let mut running_rx = mn.running_rx.clone();
let mut jh = mn.join_handles.lock().await;
let mut current_leader: Option<u64> = None;
- // TODO: reduce dependency: it does not need all of the fields in MetaNode
let mn = mn.clone();
let span = tracing::span!(tracing::Level::INFO, "watch-metrics");
@@ -394,7 +392,6 @@ impl MetaNode {
}
if cur == mn.sto.id {
- // TODO: check result
let _rst = mn.add_configured_non_voters().await;
if _rst.is_err() {
