aboutsummaryrefslogtreecommitdiff
path: root/src/garage
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-09-06 22:13:01 +0200
committerAlex Auvolat <alex@adnab.me>2022-09-06 22:13:01 +0200
commit6b958979bd898a576ee9c1021cc908b3ec75ffc7 (patch)
tree72e35a3b12c616965bcdf60bf18d1c0db29955ba /src/garage
parent4024822585783368993ac26807d076d8c312bb35 (diff)
parentd23b3a14fc28de164080e762f0e97e6cbc868940 (diff)
downloadgarage-6b958979bd898a576ee9c1021cc908b3ec75ffc7.tar.gz
garage-6b958979bd898a576ee9c1021cc908b3ec75ffc7.zip
Merge branch 'lx-perf-improvements' into netapp-stream-body
Diffstat (limited to 'src/garage')
-rw-r--r--src/garage/admin.rs32
-rw-r--r--src/garage/cli/structs.rs19
2 files changed, 49 insertions, 2 deletions
diff --git a/src/garage/admin.rs b/src/garage/admin.rs
index 64a448fc..7ba9330c 100644
--- a/src/garage/admin.rs
+++ b/src/garage/admin.rs
@@ -15,6 +15,8 @@ use garage_table::*;
use garage_rpc::*;
+use garage_block::repair::ScrubWorkerCommand;
+
use garage_model::bucket_alias_table::*;
use garage_model::bucket_table::*;
use garage_model::garage::Garage;
@@ -779,13 +781,13 @@ impl AdminRpcHandler {
writeln!(
&mut ret,
" resync queue length: {}",
- self.garage.block_manager.resync_queue_len()?
+ self.garage.block_manager.resync.queue_len()?
)
.unwrap();
writeln!(
&mut ret,
" blocks with resync errors: {}",
- self.garage.block_manager.resync_errors_len()?
+ self.garage.block_manager.resync.errors_len()?
)
.unwrap();
@@ -836,6 +838,32 @@ impl AdminRpcHandler {
let workers = self.garage.background.get_worker_info();
Ok(AdminRpc::WorkerList(workers, opt))
}
+ WorkerCmd::Set { opt } => match opt {
+ WorkerSetCmd::ScrubTranquility { tranquility } => {
+ let scrub_command = ScrubWorkerCommand::SetTranquility(tranquility);
+ self.garage
+ .block_manager
+ .send_scrub_command(scrub_command)
+ .await;
+ Ok(AdminRpc::Ok("Scrub tranquility updated".into()))
+ }
+ WorkerSetCmd::ResyncNWorkers { n_workers } => {
+ self.garage
+ .block_manager
+ .resync
+ .set_n_workers(n_workers)
+ .await?;
+ Ok(AdminRpc::Ok("Number of resync workers updated".into()))
+ }
+ WorkerSetCmd::ResyncTranquility { tranquility } => {
+ self.garage
+ .block_manager
+ .resync
+ .set_tranquility(tranquility)
+ .await?;
+ Ok(AdminRpc::Ok("Resync tranquility updated".into()))
+ }
+ },
}
}
}
diff --git a/src/garage/cli/structs.rs b/src/garage/cli/structs.rs
index 9274f80f..0388cef5 100644
--- a/src/garage/cli/structs.rs
+++ b/src/garage/cli/structs.rs
@@ -501,6 +501,12 @@ pub enum WorkerCmd {
#[structopt(flatten)]
opt: WorkerListOpt,
},
+ /// Set worker parameter
+ #[structopt(name = "set", version = version::garage())]
+ Set {
+ #[structopt(subcommand)]
+ opt: WorkerSetCmd,
+ },
}
#[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone, Copy)]
@@ -512,3 +518,16 @@ pub struct WorkerListOpt {
#[structopt(short = "e", long = "errors")]
pub errors: bool,
}
+
+#[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)]
+pub enum WorkerSetCmd {
+ /// Set tranquility of scrub operations
+ #[structopt(name = "scrub-tranquility", version = version::garage())]
+ ScrubTranquility { tranquility: u32 },
+ /// Set number of concurrent block resync workers
+ #[structopt(name = "resync-n-workers", version = version::garage())]
+ ResyncNWorkers { n_workers: usize },
+ /// Set tranquility of block resync operations
+ #[structopt(name = "resync-tranquility", version = version::garage())]
+ ResyncTranquility { tranquility: u32 },
+}