Skip to content

Commit

Permalink
feat(storage): avoid copy key slice in storage table iter when unnece…
Browse files Browse the repository at this point in the history
…ssary (#19717)
  • Loading branch information
wenym1 authored Dec 11, 2024
1 parent 00ee666 commit 67491ab
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 216 deletions.
2 changes: 1 addition & 1 deletion src/ctl/src/cmd_impl/table/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async fn do_scan(table: TableCatalog, hummock: MonitoredStateStore<HummockStorag
.await?;
pin_mut!(stream);
while let Some(item) = stream.next().await {
println!("{:?}", item?.into_owned_row());
println!("{:?}", item?);
}
Ok(())
}
6 changes: 5 additions & 1 deletion src/storage/hummock_sdk/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ impl SetSlice<Bytes> for Bytes {
}
}

pub trait CopyFromSlice {
pub trait CopyFromSlice: Send + 'static {
fn copy_from_slice(slice: &[u8]) -> Self;
}

Expand All @@ -456,6 +456,10 @@ impl CopyFromSlice for Bytes {
}
}

impl CopyFromSlice for () {
fn copy_from_slice(_: &[u8]) -> Self {}
}

/// [`TableKey`] is an internal concept in storage. It's a wrapper around the key directly from the
/// user, to make the code clearer and avoid confusion with encoded [`UserKey`] and [`FullKey`].
///
Expand Down
Loading

0 comments on commit 67491ab

Please sign in to comment.