summaryrefslogtreecommitdiff
path: root/bench/wtperf/wtperf.c
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-10-21 23:10:39 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2016-10-21 23:10:39 -0400
commitb486c5ce2f342f4ec659b31764320d740ab40f46 (patch)
treef711932b7d3e869695d3e400e7ba4718e2b87cb9 /bench/wtperf/wtperf.c
parentceeb57b565fca6ade4bb02d8cf62095374743bd1 (diff)
downloadmongo-b486c5ce2f342f4ec659b31764320d740ab40f46.tar.gz
WT-2880 Add Zstandard compression support (#3075)
* Fix a bug found by inspection in LZ4 code: we're going to offset the destination buffer by sizeof(LZ4_PREFIX), so we need to offset the destination buffer length by the same amount. * Prettiness pass through the snappy driver so it and the zstd driver look the same, minor cleanup in zlib. * Add the compression_level configuration option to the zstd extension initialization function so it's possible to set the compression level from an application. * Fix a bug in zlib raw compression: the destination buffer size (dst_len), can be smaller than the target page size (page_max), use the smaller of the two values to set the target compression size. * The zlib raw compression function could return without calling deflateEnd on its z_stream structures, potentially leaking memory and scratch buffers. * If the default reserved bytes for zlib raw compression isn't sufficient, we fail on compression of what might be very large blocks. We don't have information on how many bytes need to be reserved in order to know the final deflate() will succeed, and the default value was experimentally derived, for all we know there are workloads where the default will fail a lot. Add a fallback before failing hard, try with 2x the default reserved space.
Diffstat (limited to 'bench/wtperf/wtperf.c')
-rw-r--r--bench/wtperf/wtperf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bench/wtperf/wtperf.c b/bench/wtperf/wtperf.c
index a1dc78a5312..8c7f0053388 100644
--- a/bench/wtperf/wtperf.c
+++ b/bench/wtperf/wtperf.c
@@ -2078,6 +2078,11 @@ config_compress(WTPERF *wtperf)
wtperf->compress_ext = ZLIB_EXT;
#endif
wtperf->compress_table = ZLIB_BLK;
+ } else if (strcmp(s, "zstd") == 0) {
+#ifndef HAVE_BUILTIN_EXTENSION_ZSTD
+ wtperf->compress_ext = ZSTD_EXT;
+#endif
+ wtperf->compress_table = ZSTD_BLK;
} else {
fprintf(stderr,
"invalid compression configuration: %s\n", s);