diff options
author | Alex <alex@adnab.me> | 2022-09-05 12:35:08 +0200 |
---|---|---|
committer | Alex <alex@adnab.me> | 2022-09-05 12:35:08 +0200 |
commit | 0009fd136c744944888df15d706ca08ca251aed7 (patch) | |
tree | c77f5299ac72bcb69c3832022fd3c05140489f7a /src/garage/admin.rs | |
parent | 532eca7ff94e4710283fb38951a349a83654de59 (diff) | |
parent | e1751c8a9cb2a0d91b5aed636ee72ca4fa31ca68 (diff) | |
download | garage-0009fd136c744944888df15d706ca08ca251aed7.tar.gz garage-0009fd136c744944888df15d706ca08ca251aed7.zip |
Merge pull request 'Make block resync speed dynamically configurable' (#369) from resync-ajustable-speed into main
Included in this PR:
- [x] Small refactor, resync code is moved to a separate `block/resync.rs` file
- [x] Block resync tranquility is no longer in config file, it is set dynamically using `garage worker set resync-tranquility` (this parameter is persisted over Garage restarts)
- [x] Up to 4 block resync workers can be activated to run simultaneously to speed up big resyncs, this parameter is set dynamically using `garage worker set resync-n-workers`
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/369
Diffstat (limited to 'src/garage/admin.rs')
-rw-r--r-- | src/garage/admin.rs | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/garage/admin.rs b/src/garage/admin.rs index 71ee608c..76261050 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())) + } + }, } } } |