aboutsummaryrefslogtreecommitdiff
path: root/src/block/manager.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2024-03-20 16:53:47 +0000
committerAlex <alex@adnab.me>2024-03-20 16:53:47 +0000
commite83519694055750cf29c31845d712165dbbebd66 (patch)
treefd2c3d53e6d3ae0c5e3e3f15d83431f7ef8b53c1 /src/block/manager.rs
parent30abf7e086359c914b1e083d3eec0f4e5fa37351 (diff)
parentba33bb31f1855a327b5adc676b92270c90f773e9 (diff)
downloadgarage-e83519694055750cf29c31845d712165dbbebd66.tar.gz
garage-e83519694055750cf29c31845d712165dbbebd66.zip
Merge pull request 'Add marker files in data directories (fix #601)' (#785) from check-data-dir into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/785
Diffstat (limited to 'src/block/manager.rs')
-rw-r--r--src/block/manager.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/block/manager.rs b/src/block/manager.rs
index ef7279e9..34d854b9 100644
--- a/src/block/manager.rs
+++ b/src/block/manager.rs
@@ -127,17 +127,15 @@ impl BlockManager {
// Load or compute layout, i.e. assignment of data blocks to the different data directories
let data_layout_persister: Persister<DataLayout> =
Persister::new(&system.metadata_dir, "data_layout");
- let data_layout = match data_layout_persister.load() {
- Ok(mut layout) => {
- layout
- .update(&config.data_dir)
- .ok_or_message("invalid data_dir config")?;
- layout
- }
+ let mut data_layout = match data_layout_persister.load() {
+ Ok(layout) => layout
+ .update(&config.data_dir)
+ .ok_or_message("invalid data_dir config")?,
Err(_) => {
DataLayout::initialize(&config.data_dir).ok_or_message("invalid data_dir config")?
}
};
+ data_layout.check_markers()?;
data_layout_persister
.save(&data_layout)
.expect("cannot save data_layout");