krishvishal commented on code in PR #3284:
URL: https://github.com/apache/iggy/pull/3284#discussion_r3273430233
##########
core/journal/src/prepare_journal.rs:
##########
@@ -557,6 +568,36 @@ mod tests {
}
}
+ #[compio::test]
+ async fn corrupt_command_byte_truncates_on_reopen() {
+ // Bit-flipped `Command2` discriminant: must truncate, not panic.
+ let dir = tempdir().unwrap();
+ let path = dir.path().join("journal.wal");
+
+ {
+ let journal = PrepareJournal::open(&path, 0).await.unwrap();
+ journal.append(make_prepare(1, 64)).await.unwrap();
+ journal.append(make_prepare(2, 128)).await.unwrap();
+ journal.storage.fsync().await.unwrap();
+ }
+
+ // Entry 2 at offset HEADER_SIZE+64=320; command byte at +60 within
header.
+ let entry_2_offset = (HEADER_SIZE + 64) as u64;
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]