Skip to content

Commit

Permalink
[storage] refine error msg on first event missing when requested by s…
Browse files Browse the repository at this point in the history
…eq_num
  • Loading branch information
msmouse committed Jul 22, 2022
1 parent dc0ba4f commit 44c7261
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions storage/aptosdb/src/event_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{
},
};
use accumulator::{HashReader, MerkleAccumulator};
use anyhow::{ensure, format_err, Result};
use anyhow::{bail, ensure, format_err, Result};
use aptos_crypto::{
hash::{CryptoHash, EventAccumulatorHasher},
HashValue,
Expand Down Expand Up @@ -167,12 +167,14 @@ impl EventStore {
if path != *event_key || ver > ledger_version {
break;
}
ensure!(
seq == cur_seq,
"DB corrupt: Sequence number not continuous, expected: {}, actual: {}.",
cur_seq,
seq
);
if seq != cur_seq {
let msg = if cur_seq == start_seq_num {
"First requested event is probably pruned."
} else {
"DB corruption: Sequence number not continous."
};
bail!("{} expected: {}, actual: {}", msg, cur_seq, seq);
}
result.push((seq, ver, idx));
cur_seq += 1;
}
Expand Down

0 comments on commit 44c7261

Please sign in to comment.