Skip to content

Commit

Permalink
chore: upon startup, meta-service output human-readable error if tryi…
Browse files Browse the repository at this point in the history
…ng to open future version on-disk data
  • Loading branch information
drmingdrmer committed Oct 24, 2024
1 parent 9a56324 commit f64e68b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/meta/raft-store/src/ondisk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,18 @@ impl OnDisk {
let tree = SledTree::open(db, &tree_name, config.is_sync())?;
let ks = tree.key_space::<DataHeader>();

let header = ks.get(&Self::KEY_HEADER.to_string())?;
let header = ks.get(&Self::KEY_HEADER.to_string()).map_err(|e| {
MetaStorageError::BytesError(
AnyError::error(format!(
"Unable to read meta-service data version from disk; \
Possible reasons: opening future version meta-service with old version binary, \
or the on-disk data is damaged. \
error: {}",
e
))
.add_context(|| "open on-disk data"),
)
})?;
info!("Loaded header: {:?}", header);

if let Some(v) = header {
Expand Down

0 comments on commit f64e68b

Please sign in to comment.