Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Implementing cross-segment read/write for WAL based on local disk #1556

Merged
merged 16 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wal/src/local_storage_impl/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LocalStorageConfig {
pub path: String,
pub max_segment_size: u64,
pub max_segment_size: usize,
pub cache_size: usize,
}

Expand Down
8 changes: 8 additions & 0 deletions src/wal/src/local_storage_impl/record_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ define_result!(Error);
/// | (u8) | (u32) | (u32) | (u64) | (u64) | (u32) | |
/// +---------+--------+--------+------------+--------------+--------------+-------+
/// ```
#[derive(Debug)]
pub struct Record<'a> {
/// The version number of the record.
pub version: u8,
Expand Down Expand Up @@ -183,6 +184,13 @@ impl RecordEncoding {

// 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!(
Expand Down
Loading
Loading