-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add debugging fields to archiver errors #3377
Conversation
@@ -247,6 +262,21 @@ pub struct Archiver { | |||
last_archived_block: LastArchivedBlock, | |||
} | |||
|
|||
// Equality, mainly for use in integration tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semantically this doesn't really make a lot of sense IMO, which is why tests did not use it. There should be no need and it does not make sense to compare two archiver instances.
#[error( | ||
"Invalid last archived block, its size {block_bytes} bytes is the same as encoded \ | ||
block, archived in segment: {prev_segment_index:?} {prev_segment_header_hash:?}" | ||
)] | ||
InvalidLastArchivedBlock { | ||
/// Already archived block size, which is equal to the full block size | ||
block_bytes: u32, | ||
/// The segment index for the segment that already archived the block | ||
prev_segment_index: SegmentIndex, | ||
/// The segment header hash for the segment that already archived the block | ||
prev_segment_header_hash: Blake3Hash, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how useful this actually is, we already have this information on higher level.
I'd probably replace "Incorrect parameters for archiver" panic with an error message that also logs the whole last_segment_header
, which will have the same effect.
Also test seems to fail due to |
Since you’ve asked me to rewrite almost the whole PR, I think it would be less confusing to close this one, and open another one if I get time. |
We had a report of archiver errors on a timekeeper:
Looking at the code, there's nowhere that changes the segment header (last archived block) or block data. So this seems like corruption in the segment or block stores due to overclocking. This PR adds debugging fields to archiver instantiation errors, to help diagnose similar errors in future.
It also adds a
PartialEq
implementation forArchiver
, which simplifies existing tests. I plan to use it in future archiver object mapping or retrieval tests. (Unfortunately this impl can't becfg(test)
, because it's used in integration tests.)Finally, this PR changes an incorrect (but harmless)
BlockNumber
type in that error tou32
.Code contributor checklist: