From ea8350a3b52d4ddd6fd839aa56d69e67dab3ef51 Mon Sep 17 00:00:00 2001 From: Tyler Neely Date: Fri, 31 Jan 2020 09:59:12 +0100 Subject: [PATCH 1/2] Fix MAX_MSG_HEADER_LEN to be 32, accounting for max varint len --- Cargo.toml | 2 +- src/pagecache/constants.rs | 10 +++++----- src/pagecache/logger.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6b95aa703..77ca9ba60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sled" -version = "0.31.0" +version = "0.31.1" authors = ["Tyler Neely "] description = "a modern embedded database" license = "MIT/Apache-2.0" diff --git a/src/pagecache/constants.rs b/src/pagecache/constants.rs index 563a95f8e..a796b7d28 100644 --- a/src/pagecache/constants.rs +++ b/src/pagecache/constants.rs @@ -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; diff --git a/src/pagecache/logger.rs b/src/pagecache/logger.rs index 63e71bb29..c42769bf3 100644 --- a/src/pagecache/logger.rs +++ b/src/pagecache/logger.rs @@ -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. From de84c68555582463b3587f8fa7c0147cc2b6c234 Mon Sep 17 00:00:00 2001 From: Tyler Neely Date: Fri, 31 Jan 2020 10:00:46 +0100 Subject: [PATCH 2/2] Adjust version number properly --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 77ca9ba60..6b95aa703 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sled" -version = "0.31.1" +version = "0.31.0" authors = ["Tyler Neely "] description = "a modern embedded database" license = "MIT/Apache-2.0"