Skip to content

Commit

Permalink
more comments for new_caller_controlled_max_limit
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi Z <chi@neon.tech>
  • Loading branch information
skyzh committed Jun 14, 2024
1 parent 8080865 commit b1c8ff6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pageserver/src/tenant/storage_layer/image_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ impl<'a, 'ctx> ImageLayerIterator<'a, 'ctx> {
// We want to have exactly one read syscall (plus several others for index lookup) for each `next_batch` call.
// Therefore, we enforce `self.max_read_size` by ourselves instead of using the VectoredReadPlanner's capability,
// to avoid splitting into two I/Os.
let mut read_planner = VectoredReadPlanner::new_without_max_limit();
let mut read_planner = VectoredReadPlanner::new_caller_controlled_max_limit();
let mut cnt = 0;
let mut start_pos = None;
let mut range_end_handled = false;
Expand Down
7 changes: 6 additions & 1 deletion pageserver/src/tenant/vectored_blob_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ impl VectoredReadPlanner {
}
}

pub fn new_without_max_limit() -> Self {
/// This function should *only* be used if the caller has a way to control the limit. e.g., in `ImageLayerIterator`,
/// it uses the vectored read planner to avoid duplicated logic on handling blob start/end, while expecting the vectored
/// read planner to give a single read to a continuous range of bytes in the image layer. Therefore, it does not need the
/// code path to split reads into chunks of `max_read_size`, and controls the read size itself.
#[cfg(test)]
pub(crate) fn new_caller_controlled_max_limit() -> Self {
Self {
blobs: BTreeMap::new(),
prev: None,
Expand Down

0 comments on commit b1c8ff6

Please sign in to comment.