aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-23 17:05:11 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-23 17:05:11 +0200
commit59b43914d4a9ae9a50ae79fee61b1a46bff941f9 (patch)
tree5ca8cdeb754b47a855d142891e41214b77e88c52 /src/block
parentf82cf164f5ab525560415355503c04315901a739 (diff)
downloadgarage-59b43914d4a9ae9a50ae79fee61b1a46bff941f9.tar.gz
garage-59b43914d4a9ae9a50ae79fee61b1a46bff941f9.zip
(to test) error reporting and throttling at higher layer
Diffstat (limited to 'src/block')
-rw-r--r--src/block/manager.rs15
-rw-r--r--src/block/repair.rs3
2 files changed, 6 insertions, 12 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs
index 30d6e792..db73ecbc 100644
--- a/src/block/manager.rs
+++ b/src/block/manager.rs
@@ -734,12 +734,9 @@ impl Worker for ResyncWorker {
) -> Result<WorkerStatus, Error> {
self.tranquilizer.reset();
match self.manager.resync_iter().await {
- Ok(ResyncIterResult::BusyDidSomething) => {
- self.tranquilizer
- .tranquilize(self.manager.background_tranquility)
- .await;
- Ok(WorkerStatus::Busy)
- }
+ Ok(ResyncIterResult::BusyDidSomething) => Ok(self
+ .tranquilizer
+ .tranquilize_worker(self.manager.background_tranquility)),
Ok(ResyncIterResult::BusyDidNothing) => Ok(WorkerStatus::Busy),
Ok(ResyncIterResult::IdleFor(delay)) => {
self.next_delay = delay;
@@ -750,10 +747,8 @@ impl Worker for ResyncWorker {
// We don't really know how to handle them so just ¯\_(ツ)_/¯
// (there is kind of an assumption that Sled won't error on us,
// if it does there is not much we can do -- TODO should we just panic?)
- error!(
- "Could not do a resync iteration: {} (this is a very bad error)",
- e
- );
+ // Here we just give the error to the worker manager,
+ // it will print it to the logs and increment a counter
Err(e.into())
}
}
diff --git a/src/block/repair.rs b/src/block/repair.rs
index 0445527c..a5c01629 100644
--- a/src/block/repair.rs
+++ b/src/block/repair.rs
@@ -138,8 +138,7 @@ impl Worker for ScrubWorker {
self.tranquilizer.reset();
if let Some(hash) = self.iterator.next().await? {
let _ = self.manager.read_block(&hash).await;
- self.tranquilizer.tranquilize(self.tranquility).await;
- Ok(WorkerStatus::Busy)
+ Ok(self.tranquilizer.tranquilize_worker(self.tranquility))
} else {
Ok(WorkerStatus::Done)
}