From 60fdcc9e35206ce9ea5cad9aa0be9c6317823a56 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Wed, 18 Mar 2015 11:24:25 -0400 Subject: Add LZ4 compression to the standard list. Rework compression choices, take 10% from the no-compression case, and 10% from the bzip case, make them a 20% lz4 case. --- test/format/config.c | 12 ++++++++---- test/format/config.h | 4 ++-- test/format/format.h | 11 +++++++---- test/format/s_dumpcmp.sh | 4 ++++ test/format/wts.c | 8 +++++++- 5 files changed, 28 insertions(+), 11 deletions(-) (limited to 'test') diff --git a/test/format/config.c b/test/format/config.c index 212cf350c0b..ce5d0a9c372 100644 --- a/test/format/config.c +++ b/test/format/config.c @@ -232,15 +232,17 @@ config_compression(void) if (!config_is_perm("compression")) { cstr = "compression=none"; switch (MMRAND(1, 20)) { - case 1: case 2: case 3: /* 30% no compression */ - case 4: case 5: case 6: + case 1: case 2: case 3: case 4: /* 20% no compression */ break; - case 7: case 8: case 9: case 10: /* 20% bzip */ + case 5: case 6: /* 10% bzip */ cstr = "compression=bzip"; break; - case 11: /* 5% bzip-raw */ + case 7: /* 5% bzip-raw */ cstr = "compression=bzip-raw"; break; + case 8: case 9: case 10: case 11: /* 20% lz4 */ + cstr = "compression=lz4"; + break; case 12: case 13: case 14: case 15: /* 20% snappy */ cstr = "compression=snappy"; break; @@ -516,6 +518,8 @@ config_map_compression(const char *s, u_int *vp) *vp = COMPRESS_BZIP; else if (strcmp(s, "bzip-raw") == 0) *vp = COMPRESS_BZIP_RAW; + else if (strcmp(s, "lz4") == 0) + *vp = COMPRESS_LZ4; else if (strcmp(s, "lzo") == 0) *vp = COMPRESS_LZO; else if (strcmp(s, "snappy") == 0) diff --git a/test/format/config.h b/test/format/config.h index cc084d5b238..3a849a36c26 100644 --- a/test/format/config.h +++ b/test/format/config.h @@ -118,8 +118,8 @@ static CONFIG c[] = { { "compression", "type of compression " - "(none | bzip | bzip-raw | lzo | snappy | zlib | zlib-noraw)", - C_IGNORE|C_STRING, 1, 5, 5, NULL, &g.c_compression }, + "(none | bzip | bzip-raw | lz4 | lzo | snappy | zlib | zlib-noraw)", + C_IGNORE|C_STRING, 0, 0, 0, NULL, &g.c_compression }, { "data_extend", "if data files are extended", /* 5% */ diff --git a/test/format/format.h b/test/format/format.h index 9d3f95697c0..f6e7a83470e 100644 --- a/test/format/format.h +++ b/test/format/format.h @@ -73,6 +73,8 @@ extern WT_EXTENSION_API *wt_api; #define BZIP_PATH \ EXTPATH "compressors/bzip2/.libs/libwiredtiger_bzip2.so" +#define LZ4_PATH \ + EXTPATH "compressors/lz4/.libs/libwiredtiger_lz4.so" #define SNAPPY_PATH \ EXTPATH "compressors/snappy/.libs/libwiredtiger_snappy.so" #define ZLIB_PATH \ @@ -239,10 +241,11 @@ typedef struct { #define COMPRESS_NONE 1 #define COMPRESS_BZIP 2 #define COMPRESS_BZIP_RAW 3 -#define COMPRESS_LZO 4 -#define COMPRESS_SNAPPY 5 -#define COMPRESS_ZLIB 6 -#define COMPRESS_ZLIB_NO_RAW 7 +#define COMPRESS_LZ4 4 +#define COMPRESS_LZO 5 +#define COMPRESS_SNAPPY 6 +#define COMPRESS_ZLIB 7 +#define COMPRESS_ZLIB_NO_RAW 8 u_int c_compression_flag; /* Compression flag value */ #define ISOLATION_RANDOM 1 diff --git a/test/format/s_dumpcmp.sh b/test/format/s_dumpcmp.sh index 82a9a214a88..2760d5e9268 100755 --- a/test/format/s_dumpcmp.sh +++ b/test/format/s_dumpcmp.sh @@ -51,6 +51,10 @@ bzip_raw_ext=".libs/bzip_raw_compress.so" if test -e $bzip_raw_ext ; then ext="$ext,\"$bzip_raw_ext\"" fi +lz4_ext="$top/ext/compressors/lz4/.libs/libwiredtiger_lz4.so" +if test -e $lz4_ext ; then + ext="$ext,\"$lz4_ext\"" +fi snappy_ext="$top/ext/compressors/snappy/.libs/libwiredtiger_snappy.so" if test -e $snappy_ext ; then ext="$ext,\"$snappy_ext\"" diff --git a/test/format/wts.c b/test/format/wts.c index 0875f3900f8..553b9902a46 100644 --- a/test/format/wts.c +++ b/test/format/wts.c @@ -140,9 +140,11 @@ wts_open(const char *home, int set_api, WT_CONNECTION **connp) /* Extensions. */ p += snprintf(p, REMAIN(p, end), - ",extensions=[\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"],", + ",extensions=[" + "\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\"],", g.c_reverse ? REVERSE_PATH : "", access(BZIP_PATH, R_OK) == 0 ? BZIP_PATH : "", + access(LZ4_PATH, R_OK) == 0 ? LZ4_PATH : "", access(LZO_PATH, R_OK) == 0 ? LZO_PATH : "", access(SNAPPY_PATH, R_OK) == 0 ? SNAPPY_PATH : "", access(ZLIB_PATH, R_OK) == 0 ? ZLIB_PATH : "", @@ -316,6 +318,10 @@ wts_create(void) p += snprintf(p, REMAIN(p, end), ",block_compressor=\"bzip2-raw-test\""); break; + case COMPRESS_LZ4: + p += snprintf(p, REMAIN(p, end), + ",block_compressor=\"lz4\""); + break; case COMPRESS_LZO: p += snprintf(p, REMAIN(p, end), ",block_compressor=\"LZO1B-6\""); -- cgit v1.2.1