From 8bf23b4eed435bfde4f656b23631f27b55463851 Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Thu, 3 Oct 2024 13:15:18 +0200 Subject: [PATCH] Update aircompressor v3 to 3.1 --- .../java/io/trino/execution/buffer/PageSerializer.java | 7 ++----- pom.xml | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/execution/buffer/PageSerializer.java b/core/trino-main/src/main/java/io/trino/execution/buffer/PageSerializer.java index 10b71ab582ed..88a96b52da47 100644 --- a/core/trino-main/src/main/java/io/trino/execution/buffer/PageSerializer.java +++ b/core/trino-main/src/main/java/io/trino/execution/buffer/PageSerializer.java @@ -15,7 +15,6 @@ import com.google.common.base.VerifyException; import io.airlift.compress.v3.Compressor; -import io.airlift.compress.v3.lz4.Lz4Compressor; import io.airlift.slice.Slice; import io.airlift.slice.SliceOutput; import io.airlift.slice.Slices; @@ -95,9 +94,6 @@ private static class SerializedPageOutput extends SliceOutput { private static final int INSTANCE_SIZE = instanceSize(SerializedPageOutput.class); - // TODO: implement getRetainedSizeInBytes in Lz4Compressor - // TODO: need a fix - private static final int COMPRESSOR_RETAINED_SIZE = toIntExact(instanceSize(Lz4Compressor.class)); private static final int ENCRYPTION_KEY_RETAINED_SIZE = toIntExact(instanceSize(SecretKeySpec.class) + sizeOfByteArray(256 / 8)); private static final double MINIMUM_COMPRESSION_RATIO = 0.8; @@ -483,7 +479,8 @@ private Cipher initCipher(SecretKey key) public long getRetainedSize() { long size = INSTANCE_SIZE; - size += sizeOf(compressor, compressor -> COMPRESSOR_RETAINED_SIZE); + size += sizeOf(compressor, compressor -> instanceSize(compressor.getClass()) + + compressor.getRetainedSizeInBytes(uncompressedSize)); size += sizeOf(encryptionKey, encryptionKey -> ENCRYPTION_KEY_RETAINED_SIZE); size += sizeOf(cipher, cipher -> ESTIMATED_AES_CIPHER_RETAINED_SIZE); for (WriteBuffer buffer : buffers) { diff --git a/pom.xml b/pom.xml index b54ebdadaa12..4398b475f844 100644 --- a/pom.xml +++ b/pom.xml @@ -699,7 +699,7 @@ io.airlift aircompressor-v3 - 3.0 + 3.1