jiacai2050 commented on code in PR #1576:
URL: https://github.com/apache/horaedb/pull/1576#discussion_r1802745561
##########
src/wal/src/local_storage_impl/record_encoding.rs:
##########
@@ -172,38 +172,26 @@ impl RecordEncoding {
// Verify version
ensure!(
- version == self.version,
+ version == self.expected_version,
Version {
- expected: self.version,
+ expected: self.expected_version,
given: version
}
);
- // Read CRC
let crc = buf.try_get_u32().context(Decoding)?;
-
- // Read length
- let length = buf.try_get_u32().context(Decoding)?;
- ensure!(
- length > 0,
- LengthMismatch {
- expected: 1usize,
- actual: 0usize
- }
- );
-
- // Ensure the buf is long enough
- ensure!(
- buf.remaining() >= length as usize,
- LengthMismatch {
- expected: length as usize,
- actual: buf.remaining()
- }
- );
+ let table_id = buf.try_get_u64().context(Decoding)?;
+ let sequence_num = buf.try_get_u64().context(Decoding)?;
+ let value_length = buf.try_get_u32().context(Decoding)?;
+ let value = buf[0..value_length as usize].to_vec();
// Verify CRC
- let data = &buf[0..length as usize];
- let computed_crc = crc32fast::hash(data);
+ let mut h = Hasher::new();
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]