aboutsummaryrefslogtreecommitdiff
path: root/src/block/manager.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-03-20 15:20:25 +0100
committerAlex Auvolat <alex@adnab.me>2024-03-20 15:20:25 +0100
commitba33bb31f1855a327b5adc676b92270c90f773e9 (patch)
treedb2d7c41192b42b42720a8e607afb1e925a60f10 /src/block/manager.rs
parent26310f3242319c9ad093f5121cff0fe0c0108542 (diff)
downloadgarage-ba33bb31f1855a327b5adc676b92270c90f773e9.tar.gz
garage-ba33bb31f1855a327b5adc676b92270c90f773e9.zip
[check-data-dir] add marker files in data directories (fix #601)check-data-dir
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");