Skip to content

Commit

Permalink
Merge pull request #949 from spacejam/tyler_fix_max_header_length
Browse files Browse the repository at this point in the history
Fix MAX_MSG_HEADER_LEN to be 32, accounting for max varint len
  • Loading branch information
spacejam authored Jan 31, 2020
2 parents e7a3603 + de84c68 commit d52480a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/pagecache/constants.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::*;

// kind: u8 1
// pid: u64 8
// lsn: i64 8
// len: u64 8
// crc: u32 4
// kind: u8 1
// seg num: u64 9 (varint)
// pid: u64 9 (varint)
// len: u64 9 (varint)
/// Log messages have a header that might eb up to this length.
pub const MAX_MSG_HEADER_LEN: usize = 29;
pub const MAX_MSG_HEADER_LEN: usize = 32;

/// Log segments have a header of this length.
pub const SEG_HEADER_LEN: usize = 20;
Expand Down
2 changes: 1 addition & 1 deletion src/pagecache/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@ impl Drop for Log {
/// All log messages are prepended with this header
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct MessageHeader {
pub crc32: u32,
pub kind: MessageKind,
pub segment_number: SegmentNumber,
pub pid: PageId,
pub len: u64,
pub crc32: u32,
}

/// A number representing a segment number.
Expand Down

0 comments on commit d52480a

Please sign in to comment.