}
// Check crc
+ uint32_t actual_crc = 0;
if (checksum_) {
uint32_t expected_crc = crc32c::Unmask(DecodeFixed32(header));
- uint32_t actual_crc = crc32c::Value(header + 6, length + header_size - 6);
+ actual_crc = crc32c::Value(header + 6, length + header_size - 6);
if (actual_crc != expected_crc) {
// Drop the rest of the buffer since "length" itself may have
// been corrupted and if we trust it, we could find some
return kBadRecord;
}
+ Log(InfoLogLevel::DEBUG_LEVEL, info_log_,
+ "ReadPhysicalRecord: log %lld offset %lld len %d crc %d type %d",
+ (unsigned long long)log_number_,
+ (unsigned long long)(end_of_buffer_offset_ - buffer_.size() -
+ header_size - length),
+ (int)header_size + (int)length, crc32c::Mask(actual_crc),
+ type);
+
*result = Slice(header + header_size, length);
return type;
}