aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-03-16 16:35:10 +0100
committerAlex Auvolat <alex@adnab.me>2021-03-16 16:35:10 +0100
commit3fadc5cbbd5067e160dbe9cf23e301f74a19186e (patch)
tree252357775eda37a2c40c153692574ed5d9d70fa6
parentf4346cc5f45839ace93d2d11ce6beea632fd8f2c (diff)
downloadgarage-3fadc5cbbd5067e160dbe9cf23e301f74a19186e.tar.gz
garage-3fadc5cbbd5067e160dbe9cf23e301f74a19186e.zip
Small changes
-rw-r--r--src/garage/admin_rpc.rs36
-rw-r--r--src/table/gc.rs13
2 files changed, 26 insertions, 23 deletions
diff --git a/src/garage/admin_rpc.rs b/src/garage/admin_rpc.rs
index aec791a4..10087f74 100644
--- a/src/garage/admin_rpc.rs
+++ b/src/garage/admin_rpc.rs
@@ -443,12 +443,14 @@ impl AdminRpcHandler {
self.gather_table_stats(&mut ret, &self.garage.block_ref_table, &opt)?;
writeln!(&mut ret, "\nBlock manager stats:").unwrap();
- writeln!(
- &mut ret,
- " number of blocks: {}",
- self.garage.block_manager.rc_len()
- )
- .unwrap();
+ if opt.detailed {
+ writeln!(
+ &mut ret,
+ " number of blocks: {}",
+ self.garage.block_manager.rc_len()
+ )
+ .unwrap();
+ }
writeln!(
&mut ret,
" resync queue length: {}",
@@ -456,10 +458,6 @@ impl AdminRpcHandler {
)
.unwrap();
- if opt.detailed {
- writeln!(&mut ret, "\nDetailed stats not implemented yet.").unwrap();
- }
-
Ok(ret)
}
@@ -467,26 +465,28 @@ impl AdminRpcHandler {
&self,
to: &mut String,
t: &Arc<Table<F, R>>,
- _opt: &StatsOpt,
+ opt: &StatsOpt,
) -> Result<(), Error>
where
F: TableSchema + 'static,
R: TableReplication + 'static,
{
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!(
to,
" Merkle updater todo queue length: {}",
t.merkle_updater.todo_len()
)
.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();
Ok(())
}
diff --git a/src/table/gc.rs b/src/table/gc.rs
index 20ebe3c7..a37c052f 100644
--- a/src/table/gc.rs
+++ b/src/table/gc.rs
@@ -146,16 +146,19 @@ where
.map(|(nodes, items)| self.try_send_and_delete(nodes, items)),
)
.await;
+
+ let mut errs = vec![];
for resp in resps {
if let Err(e) = resp {
- warn!(
- "({}) Unable to send and delete for GC: {}",
- self.data.name, e
- );
+ errs.push(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(