Skip to content

Commit

Permalink
fix: deep copy unit fetch block
Browse files Browse the repository at this point in the history
Signed-off-by: MrCroxx <[email protected]>
  • Loading branch information
MrCroxx committed Jun 11, 2024
1 parent 7465d67 commit 94f8864
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/storage/src/hummock/sstable_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,9 @@ impl BlockFetcher {
let (r, uc) = self.sst.calculate_block_info(blk);
let offset = r.start - range.start;
let len = r.end - r.start;
let bytes = data.slice(offset..offset + len);
// Deep copy the underlying slice here to prevent from OOM that is caused by a single block
// holding a large buffer.
let bytes = Bytes::copy_from_slice(&data[offset..offset + len]);
match Block::decode(bytes, uc) {
Ok(block) => Some(Box::new(block)),
Err(e) => {
Expand Down

0 comments on commit 94f8864

Please sign in to comment.