Skip to content

Commit

Permalink
fix clippy
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 26, 2024
1 parent 8549834 commit 845b00e
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions pageserver/src/tenant/storage_layer/delta_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use crate::virtual_file::{self, VirtualFile};
use crate::{walrecord, TEMP_FILE_SUFFIX};
use crate::{DELTA_FILE_MAGIC, STORAGE_FORMAT_VERSION};
use anyhow::{anyhow, bail, ensure, Context, Result};
use bytes::{Bytes, BytesMut};
use bytes::{BytesMut};
use camino::{Utf8Path, Utf8PathBuf};
use futures::StreamExt;
use itertools::Itertools;
Expand Down Expand Up @@ -189,20 +189,6 @@ impl DeltaKey {
lsn_buf.copy_from_slice(&buf[KEY_SIZE..]);
Lsn(u64::from_be_bytes(lsn_buf))
}

fn next(&self) -> Self {
let key = self.key();
let lsn = self.lsn();
if lsn == Lsn::MAX {
Self::from_key_lsn(&key.next(), Lsn::MIN)
} else {
Self::from_key_lsn(&key, Lsn(lsn.0 + 1))
}
}

fn min() -> Self {
Self::from_key_lsn(&Key::MIN, Lsn::MIN)
}
}

/// This is used only from `pagectl`. Within pageserver, all layers are
Expand Down Expand Up @@ -1515,7 +1501,7 @@ impl DeltaLayerInner {
DeltaLayerIterator {
delta_layer: self,
ctx,
index_iter: tree_reader.iter(&[0; KEY_SIZE], ctx),
index_iter: tree_reader.iter(&[0; DELTA_KEY_SIZE], ctx),
key_values_batch: std::collections::VecDeque::new(),
is_end: false,
planner: crate::tenant::vectored_blob_io::StreamingVectoredReadPlanner::new(
Expand Down Expand Up @@ -1623,7 +1609,7 @@ impl<'a> DeltaLayerIterator<'a> {
let blobs_buf = vectored_blob_reader
.read_blobs(&plan, buf, self.ctx)
.await?;
let frozen_buf: Bytes = blobs_buf.buf.freeze();
let frozen_buf = blobs_buf.buf.freeze();
for meta in blobs_buf.blobs.iter() {
let value = Value::des(&frozen_buf[meta.start..meta.end])?;
next_batch.push_back((meta.meta.key, meta.meta.lsn, value));
Expand Down Expand Up @@ -2280,6 +2266,7 @@ mod test {
#[tokio::test]
async fn delta_layer_iterator() {
use crate::repository::Value;
use bytes::Bytes;

let harness = TenantHarness::create("delta_layer_iterator").unwrap();
let (tenant, ctx) = harness.load().await;
Expand Down

0 comments on commit 845b00e

Please sign in to comment.