Skip to content

Commit

Permalink
Use default compression level for zstd (#1116)
Browse files Browse the repository at this point in the history
JAVA-4868 backport
  • Loading branch information
ispringer committed May 26, 2023
1 parent c28506c commit d08b993
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import java.util.List;

class ZstdCompressor extends Compressor {
private static final int DEFAULT_COMPRESSION_LEVEL = 3;

@Override
public String getName() {
return "zstd";
Expand All @@ -46,7 +48,7 @@ public void compress(final List<ByteBuf> source, final BsonOutput target) {

try {
byte[] out = new byte[(int) Zstd.compressBound(uncompressedSize)];
int compressedSize = (int) Zstd.compress(out, singleByteArraySource, Zstd.maxCompressionLevel());
int compressedSize = (int) Zstd.compress(out, singleByteArraySource, DEFAULT_COMPRESSION_LEVEL);
target.writeBytes(out, 0, compressedSize);
} catch (RuntimeException e) {
throw new MongoInternalException("Unexpected RuntimeException", e);
Expand Down

0 comments on commit d08b993

Please sign in to comment.