Skip to content

refactor: add const (and increase value) for commit files buffer size #790

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions kernel/src/log_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ use url::Url;
#[cfg(test)]
mod tests;

// This is the size of the buffer we use hold commit file names during log listing. We expect
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the size of the buffer we use to hold commit file names during log listing.

// somewhere on the order of 10-200 commit files per checkpoint, so we pick 200. We could adjust
// this based on config in the future
const COMMIT_FILES_LIST_BUFFER_LENGTH: usize = 200;

/// A [`LogSegment`] represents a contiguous section of the log and is made of checkpoint files
/// and commit files and guarantees the following:
/// 1. Commit file versions will not have any gaps between them.
Expand Down Expand Up @@ -443,13 +448,10 @@ fn list_log_files_with_version(
start_version: Option<Version>,
end_version: Option<Version>,
) -> DeltaResult<(Vec<ParsedLogPath>, Vec<ParsedLogPath>)> {
// We expect 10 commit files per checkpoint, so start with that size. We could adjust this based
// on config at some point

let log_files = list_log_files(fs_client, log_root, start_version, end_version)?;

log_files.process_results(|iter| {
let mut commit_files = Vec::with_capacity(10);
let mut commit_files = Vec::with_capacity(COMMIT_FILES_LIST_BUFFER_LENGTH);
let mut checkpoint_parts = vec![];

// Group log files by version
Expand Down
Loading