More aggressively gc segments
@@ -83,18 +83,16 @@ fn run(
if !shutdown.is_running() {
break;
}
- // we had no dirty data to flush,
- // so we can spend a little effort
- // cleaning up the file. try not to
- // spend more than half of our sleep
- // time rewriting pages though.
- while before.elapsed() < flush_every / 2 {
- match pagecache.attempt_gc() {
+ }
+ Ok(_) => {
+ wrote_data = true;
+ // at some point, we may want to
+ // put adaptive logic here to tune
+ // sleeps based on how much work
+ // we accomplished
+ }
Err(e) => {
- error!(
- "failed to clean file from async flush thread: {}",
- e
- );
+ error!("failed to flush from periodic flush thread: {}", e);
#[cfg(feature = "failpoints")]
pagecache.set_failpoint(e);
@@ -103,20 +101,19 @@ fn run(
sc.notify_all();
return;
}
- Ok(false) => break,
- Ok(true) => {}
- }
- }
- }
- Ok(_) => {
- wrote_data = true;
- // at some point, we may want to
- // put adaptive logic here to tune
- // sleeps based on how much work
- // we accomplished
}
+
+ // so we can spend a little effort
+ // cleaning up the segments. try not to
+ // spend more than half of our sleep
+ // time rewriting pages though.
+ while shutdown.is_running() && before.elapsed() < flush_every / 2 {
+ match pagecache.attempt_gc() {
Err(e) => {
- error!("failed to flush from periodic flush thread: {}", e);
+ error!(
+ "failed to clean file from periodic flush thread: {}",
+ e
+ );
#[cfg(feature = "failpoints")]
pagecache.set_failpoint(e);
@@ -125,6 +122,9 @@ fn run(
sc.notify_all();
return;
}
+ Ok(false) => break,
+ Ok(true) => {}
+ }
}
let sleep_duration = flush_every
