aboutsummaryrefslogtreecommitdiff
path: root/src/garage/repair/online.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-12-14 16:31:31 +0100
committerAlex Auvolat <alex@adnab.me>2022-12-14 16:31:31 +0100
commit1fcd0b371ba1fa94cd6efad5aa9a236b2e58c922 (patch)
tree22039673232db862aeabb3ab5422de223223d0ca /src/garage/repair/online.rs
parent13c86621267272af5bc89ec037d097739dae9aaf (diff)
downloadgarage-1fcd0b371ba1fa94cd6efad5aa9a236b2e58c922.tar.gz
garage-1fcd0b371ba1fa94cd6efad5aa9a236b2e58c922.zip
online repair workers: retry on error
Diffstat (limited to 'src/garage/repair/online.rs')
-rw-r--r--src/garage/repair/online.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/garage/repair/online.rs b/src/garage/repair/online.rs
index cd7de49b..6e8ec2d3 100644
--- a/src/garage/repair/online.rs
+++ b/src/garage/repair/online.rs
@@ -92,19 +92,14 @@ impl Worker for RepairVersionsWorker {
}
async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
- let item_bytes = match self.garage.version_table.data.store.get_gt(&self.pos)? {
- Some((k, v)) => {
- self.pos = k;
- v
- }
+ let (item_bytes, next_pos) = match self.garage.version_table.data.store.get_gt(&self.pos)? {
+ Some((k, v)) => (v, k),
None => {
info!("repair_versions: finished, done {}", self.counter);
return Ok(WorkerState::Done);
}
};
- self.counter += 1;
-
let version = rmp_serde::decode::from_read_ref::<_, Version>(&item_bytes)?;
if !version.deleted.get() {
let object = self
@@ -133,6 +128,9 @@ impl Worker for RepairVersionsWorker {
}
}
+ self.counter += 1;
+ self.pos = next_pos;
+
Ok(WorkerState::Busy)
}
@@ -173,19 +171,14 @@ impl Worker for RepairBlockrefsWorker {
}
async fn work(&mut self, _must_exit: &mut watch::Receiver<bool>) -> Result<WorkerState, Error> {
- let item_bytes = match self.garage.block_ref_table.data.store.get_gt(&self.pos)? {
- Some((k, v)) => {
- self.pos = k;
- v
- }
+ let (item_bytes, next_pos) = match self.garage.block_ref_table.data.store.get_gt(&self.pos)? {
+ Some((k, v)) => (v, k),
None => {
info!("repair_block_ref: finished, done {}", self.counter);
return Ok(WorkerState::Done);
}
};
- self.counter += 1;
-
let block_ref = rmp_serde::decode::from_read_ref::<_, BlockRef>(&item_bytes)?;
if !block_ref.deleted.get() {
let version = self
@@ -211,6 +204,9 @@ impl Worker for RepairBlockrefsWorker {
}
}
+ self.counter += 1;
+ self.pos = next_pos;
+
Ok(WorkerState::Busy)
}