Skip to content

Commit 7103cd3

Browse files
leftwoAlan Hanson
andauthored
Print file name for extents (#1811)
When debugging extent issues, it's nice to know both the extent number and the name of the extent file. Some examples: ``` BRM23230018 # cd /pool/ext/15bf0fb1-9b75-49b6-81f1-1a7e86bc4f52/crypt/zone/oxz_crucible_ea22fb71-b24a-4a6d-abce-6b93d5b713e6/root/data/regions/c6d6ed4f-dd2a-424b-9e40-6da8afb82a89/ BRM23230018 # /tmp/crucible-downstairs verify -d . Error: IO Error: raw extent 308 (file 134) has unknown tag 0 ``` Another: ``` BRM23230018 # cd /pool/ext/7e4b532a-f18f-4cf5-9c74-1783466e4e46/crypt/zone/oxz_crucible_0e8fef9a-5905-460d-9cb7-89a8300300c4/root/data/regions/99b7b406-ca63-44c4-8762-d63a18b631a8/ BRM23230018 # /tmp/crucible-downstairs verify -d . validation failed for extent 272 (file 110): GenericError("block 0 has an active slot with mismatched hash") validation failed for extent 773 (file 305): GenericError("block 0 has an active slot with mismatched hash") validation failed for extent 900 (file 384): GenericError("block 0 has an active slot with mismatched hash") Error: Region failed to verify ``` Co-authored-by: Alan Hanson <[email protected]>
1 parent 9cb473a commit 7103cd3

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

downstairs/src/dump.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 Oxide Computer Company
22
use super::*;
3-
use crate::extent::ExtentMeta;
3+
use crate::extent::{ExtentMeta, ExtentType, extent_file_name};
44
use rayon::prelude::*;
55
use std::convert::TryInto;
66

@@ -53,7 +53,12 @@ pub fn verify_region(
5353

5454
if !errors.is_empty() {
5555
for (number, err) in &errors {
56-
println!("validation failed for extent {}: {:?}", number, err);
56+
println!(
57+
"validation failed for extent {} (file {}): {:?}",
58+
number,
59+
extent_file_name(*number, ExtentType::Data),
60+
err
61+
);
5762
}
5863
bail!("Region failed to verify");
5964
}

downstairs/src/extent.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,9 @@ impl Extent {
480480
}
481481
i => {
482482
return Err(CrucibleError::IoError(format!(
483-
"raw extent {number} has unknown tag {i}"
483+
"raw extent {number} (file {}) has unknown \
484+
tag {i}",
485+
extent_file_name(number, ExtentType::Data)
484486
))
485487
.into());
486488
}

0 commit comments

Comments
 (0)