aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-06-13 17:02:42 +0200
committerAlex Auvolat <alex@adnab.me>2023-06-13 17:14:11 +0200
commit90b2d43eb49d49c3aef4f501a30cf2f181adb183 (patch)
treef7f7c15547e2f2072a1841fcb2350c272faf3c9d /src/block
parentbf19a44fd93584d5250a2e98e5b1d3a2de6d59d1 (diff)
parent01346143ca09eab262f0d8f8a0a744c2f6d667cc (diff)
downloadgarage-90b2d43eb49d49c3aef4f501a30cf2f181adb183.tar.gz
garage-90b2d43eb49d49c3aef4f501a30cf2f181adb183.zip
Merge branch 'main' into next
Diffstat (limited to 'src/block')
-rw-r--r--src/block/Cargo.toml2
-rw-r--r--src/block/repair.rs14
2 files changed, 5 insertions, 11 deletions
diff --git a/src/block/Cargo.toml b/src/block/Cargo.toml
index 3bf1c40a..1f8d738b 100644
--- a/src/block/Cargo.toml
+++ b/src/block/Cargo.toml
@@ -37,7 +37,7 @@ serde_bytes = "0.11"
futures = "0.3"
futures-util = "0.3"
tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] }
-tokio-util = { version = "0.6", features = ["io"] }
+tokio-util = { version = "0.7", features = ["io"] }
[features]
system-libs = [ "zstd/pkg-config" ]
diff --git a/src/block/repair.rs b/src/block/repair.rs
index c89484d9..71093d69 100644
--- a/src/block/repair.rs
+++ b/src/block/repair.rs
@@ -220,14 +220,12 @@ fn randomize_next_scrub_run_time(timestamp: u64) -> u64 {
// Take SCRUB_INTERVAL and mix in a random interval of 10 days to attempt to
// balance scrub load across different cluster nodes.
- let next_run_timestamp = timestamp
+ timestamp
+ SCRUB_INTERVAL
.saturating_add(Duration::from_secs(
rand::thread_rng().gen_range(0..3600 * 24 * 10),
))
- .as_millis() as u64;
-
- next_run_timestamp
+ .as_millis() as u64
}
impl Default for ScrubWorkerPersisted {
@@ -241,18 +239,14 @@ impl Default for ScrubWorkerPersisted {
}
}
+#[derive(Default)]
enum ScrubWorkerState {
Running(BlockStoreIterator),
Paused(BlockStoreIterator, u64), // u64 = time when to resume scrub
+ #[default]
Finished,
}
-impl Default for ScrubWorkerState {
- fn default() -> Self {
- ScrubWorkerState::Finished
- }
-}
-
#[derive(Debug)]
pub enum ScrubWorkerCommand {
Start,