diff --git a/sstables/compress.cc b/sstables/compress.cc index cda3a30be1..211be48caa 100644 --- a/sstables/compress.cc +++ b/sstables/compress.cc @@ -121,7 +121,11 @@ size_t compress_lz4(const char* input, size_t input_len, output[1] = (input_len >> 8) & 0xFF; output[2] = (input_len >> 16) & 0xFF; output[3] = (input_len >> 24) & 0xFF; +#ifdef HAVE_LZ4_COMPRESS_DEFAULT + auto ret = LZ4_compress_default(input, output + 4, input_len, LZ4_compressBound(input_len)); +#else auto ret = LZ4_compress(input, output + 4, input_len); +#endif if (ret == 0) { throw std::runtime_error("LZ4 compression failure: LZ4_compress() failed"); } diff --git a/transport/server.cc b/transport/server.cc index 7158226fb7..2282ee9998 100644 --- a/transport/server.cc +++ b/transport/server.cc @@ -1504,7 +1504,11 @@ std::vector cql_server::response::compress_lz4(const std::vector& bo output[1] = (input_len >> 16) & 0xFF; output[2] = (input_len >> 8) & 0xFF; output[3] = input_len & 0xFF; +#ifdef HAVE_LZ4_COMPRESS_DEFAULT + auto ret = LZ4_compress_default(input, output + 4, input_len, LZ4_compressBound(input_len)); +#else auto ret = LZ4_compress(input, output + 4, input_len); +#endif if (ret == 0) { throw std::runtime_error("CQL frame LZ4 compression failure"); }