aboutsummaryrefslogtreecommitdiff
path: root/src/block/manager.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-03-15 12:31:23 +0100
committerAlex Auvolat <alex@adnab.me>2022-03-23 10:25:19 +0100
commite480aaf338e3dfa280f0a78921c024265c811458 (patch)
treeecfa923127094b492154fa482ca3da8de64b8d90 /src/block/manager.rs
parent8fd6745745f5676b5e80920792fa23453f3a20d7 (diff)
downloadgarage-e480aaf338e3dfa280f0a78921c024265c811458.tar.gz
garage-e480aaf338e3dfa280f0a78921c024265c811458.zip
Make background tranquility a configurable parameter
Diffstat (limited to 'src/block/manager.rs')
-rw-r--r--src/block/manager.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs
index feb6fb9d..3215d27e 100644
--- a/src/block/manager.rs
+++ b/src/block/manager.rs
@@ -29,15 +29,13 @@ use garage_rpc::*;
use garage_table::replication::{TableReplication, TableShardedReplication};
-use crate::metrics::*;
use crate::block::*;
+use crate::metrics::*;
use crate::rc::*;
/// Size under which data will be stored inlined in database instead of as files
pub const INLINE_THRESHOLD: usize = 3072;
-pub const BACKGROUND_TRANQUILITY: u32 = 2;
-
// Timeout for RPCs that read and write blocks to remote nodes
const BLOCK_RW_TIMEOUT: Duration = Duration::from_secs(30);
// Timeout for RPCs that ask other nodes whether they need a copy
@@ -82,8 +80,9 @@ pub struct BlockManager {
pub replication: TableShardedReplication,
/// Directory in which block are stored
pub data_dir: PathBuf,
- /// Zstd compression level
+
compression_level: Option<i32>,
+ background_tranquility: u32,
mutation_lock: Mutex<BlockManagerLocked>,
@@ -109,6 +108,7 @@ impl BlockManager {
db: &sled::Db,
data_dir: PathBuf,
compression_level: Option<i32>,
+ background_tranquility: u32,
replication: TableShardedReplication,
system: Arc<System>,
) -> Arc<Self> {
@@ -139,6 +139,7 @@ impl BlockManager {
replication,
data_dir,
compression_level,
+ background_tranquility,
mutation_lock: Mutex::new(manager_locked),
rc,
resync_queue,
@@ -440,7 +441,7 @@ impl BlockManager {
while !*must_exit.borrow() {
match self.resync_iter(&mut must_exit).await {
Ok(true) => {
- tranquilizer.tranquilize(BACKGROUND_TRANQUILITY).await;
+ tranquilizer.tranquilize(self.background_tranquility).await;
}
Ok(false) => {
tranquilizer.reset();