Small changes

This commit is contained in:
Alex Auvolat 2021-03-16 16:35:10 +01:00
parent f4346cc5f4
commit 3fadc5cbbd
2 changed files with 26 additions and 23 deletions

View File

@ -443,12 +443,14 @@ impl AdminRpcHandler {
self.gather_table_stats(&mut ret, &self.garage.block_ref_table, &opt)?; self.gather_table_stats(&mut ret, &self.garage.block_ref_table, &opt)?;
writeln!(&mut ret, "\nBlock manager stats:").unwrap(); writeln!(&mut ret, "\nBlock manager stats:").unwrap();
writeln!( if opt.detailed {
&mut ret, writeln!(
" number of blocks: {}", &mut ret,
self.garage.block_manager.rc_len() " number of blocks: {}",
) self.garage.block_manager.rc_len()
.unwrap(); )
.unwrap();
}
writeln!( writeln!(
&mut ret, &mut ret,
" resync queue length: {}", " resync queue length: {}",
@ -456,10 +458,6 @@ impl AdminRpcHandler {
) )
.unwrap(); .unwrap();
if opt.detailed {
writeln!(&mut ret, "\nDetailed stats not implemented yet.").unwrap();
}
Ok(ret) Ok(ret)
} }
@ -467,26 +465,28 @@ impl AdminRpcHandler {
&self, &self,
to: &mut String, to: &mut String,
t: &Arc<Table<F, R>>, t: &Arc<Table<F, R>>,
_opt: &StatsOpt, opt: &StatsOpt,
) -> Result<(), Error> ) -> Result<(), Error>
where where
F: TableSchema + 'static, F: TableSchema + 'static,
R: TableReplication + 'static, R: TableReplication + 'static,
{ {
writeln!(to, "\nTable stats for {}", t.data.name).unwrap(); writeln!(to, "\nTable stats for {}", t.data.name).unwrap();
writeln!(to, " number of items: {}", t.data.store.len()).unwrap(); if opt.detailed {
writeln!(to, " number of items: {}", t.data.store.len()).unwrap();
writeln!(
to,
" Merkle tree size: {}",
t.merkle_updater.merkle_tree_len()
)
.unwrap();
}
writeln!( writeln!(
to, to,
" Merkle updater todo queue length: {}", " Merkle updater todo queue length: {}",
t.merkle_updater.todo_len() t.merkle_updater.todo_len()
) )
.unwrap(); .unwrap();
writeln!(
to,
" Merkle tree size: {}",
t.merkle_updater.merkle_tree_len()
)
.unwrap();
writeln!(to, " GC todo queue length: {}", t.data.gc_todo_len()).unwrap(); writeln!(to, " GC todo queue length: {}", t.data.gc_todo_len()).unwrap();
Ok(()) Ok(())
} }

View File

@ -146,16 +146,19 @@ where
.map(|(nodes, items)| self.try_send_and_delete(nodes, items)), .map(|(nodes, items)| self.try_send_and_delete(nodes, items)),
) )
.await; .await;
let mut errs = vec![];
for resp in resps { for resp in resps {
if let Err(e) = resp { if let Err(e) = resp {
warn!( errs.push(e);
"({}) Unable to send and delete for GC: {}",
self.data.name, e
);
} }
} }
Ok(true) if errs.is_empty() {
Ok(true)
} else {
Err(Error::Message(errs.into_iter().map(|x| format!("{}", x)).collect::<Vec<_>>().join(", ")))
}
} }
async fn try_send_and_delete( async fn try_send_and_delete(