Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
arpad-m committed Jun 14, 2024
1 parent 2c6267b commit ba3d811
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions pageserver/src/tenant/blob_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl<const BUFFERED: bool> BlobWriter<BUFFERED> {
encoder.shutdown().await.unwrap();
let compressed = encoder.into_inner();
if compressed.len() < len {
let compressed_len = len;
let compressed_len = compressed.len();
compressed_buf = Some(compressed);
(BYTE_ZSTD, compressed_len, slice.into_inner())
} else {
Expand All @@ -336,7 +336,7 @@ impl<const BUFFERED: bool> BlobWriter<BUFFERED> {
let slice = srcbuf.slice(..);
let compressed = lz4_flex::block::compress(&slice[..]);
if compressed.len() < len {
let compressed_len = len;
let compressed_len = compressed.len();
compressed_buf = Some(compressed);
(BYTE_LZ4, compressed_len, slice.into_inner())
} else {
Expand Down Expand Up @@ -418,8 +418,22 @@ mod tests {
for blob in blobs.iter() {
let (_, res) = match COMPRESSION {
0 => wtr.write_blob(blob.clone(), &ctx).await,
1 => wtr.write_blob_compressed(blob.clone(), &ctx, Some(ImageCompressionAlgorithm::ZstdLow)).await,
2 => wtr.write_blob_compressed(blob.clone(), &ctx, Some(ImageCompressionAlgorithm::LZ4)).await,
1 => {
wtr.write_blob_compressed(
blob.clone(),
&ctx,
Some(ImageCompressionAlgorithm::ZstdLow),
)
.await
}
2 => {
wtr.write_blob_compressed(
blob.clone(),
&ctx,
Some(ImageCompressionAlgorithm::LZ4),
)
.await
}
_ => unreachable!("Invalid compression {COMPRESSION}"),
};
let offs = res?;
Expand Down

0 comments on commit ba3d811

Please sign in to comment.