From 8eaa1d90a47df52f5abefdd73b4fa64cdb26c59c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 26 May 2014 20:41:10 +0200 Subject: [PATCH] use ENUM not ULONG for innodb-compression-algorithm command-line option --- storage/innobase/handler/ha_innodb.cc | 17 ++++++++++------- storage/innobase/include/srv0srv.h | 2 +- storage/innobase/srv/srv0srv.cc | 2 +- storage/xtradb/handler/ha_innodb.cc | 17 ++++++++++------- storage/xtradb/include/srv0srv.h | 2 +- storage/xtradb/srv/srv0srv.cc | 2 +- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 635c127e55b..c46c44d3cf8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -16804,14 +16804,17 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, #else #define default_compression_algorithm PAGE_ZLIB_ALGORITHM #endif -static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, +static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 }; +static TYPELIB page_compression_algorithms_typelib= +{ + array_elements(page_compression_algorithms) - 1, 0, + page_compression_algorithms, 0 +}; +static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm, PLUGIN_VAR_OPCMDARG, - "Compression algorithm used on page compression. 1 for zlib, 2 for lz3, 3 for lzo", - NULL, NULL, - PAGE_ZLIB_ALGORITHM, - 0, - default_compression_algorithm, - 0); + "Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo", + NULL, NULL, default_compression_algorithm, + &page_compression_algorithms_typelib); static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 26fcf40eb97..df3bb31f9a9 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -252,7 +252,7 @@ extern my_bool srv_use_posix_fallocate; extern my_bool srv_use_atomic_writes; /* Compression algorithm*/ -extern long innodb_compression_algorithm; +extern ulong innodb_compression_algorithm; /* Number of flush threads */ #define MTFLUSH_MAX_WORKER 64 diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index a9cc7beb6b0..16e2aeb6e1b 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -155,7 +155,7 @@ UNIV_INTERN my_bool srv_use_posix_fallocate = FALSE; /* If this flag is TRUE, then we disable doublewrite buffer */ UNIV_INTERN my_bool srv_use_atomic_writes = FALSE; /* If this flag IS TRUE, then we use lz4 to compress/decompress pages */ -UNIV_INTERN long innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; +UNIV_INTERN ulong innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; /* Number of threads used for multi-threaded flush */ UNIV_INTERN long srv_mtflush_threads = MTFLUSH_DEFAULT_WORKER; /* If this flag is TRUE, then we will use multi threaded flush. */ diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index ef0f71a6f7d..bce378f8630 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -17961,14 +17961,17 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, #else #define default_compression_algorithm PAGE_ZLIB_ALGORITHM #endif -static MYSQL_SYSVAR_LONG(compression_algorithm, innodb_compression_algorithm, +static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 }; +static TYPELIB page_compression_algorithms_typelib= +{ + array_elements(page_compression_algorithms) - 1, 0, + page_compression_algorithms, 0 +}; +static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm, PLUGIN_VAR_OPCMDARG, - "Compression algorithm used on page compression. 1 for zlib, 2 for lz3, 3 for lzo", - NULL, NULL, - PAGE_ZLIB_ALGORITHM, - 0, - default_compression_algorithm, - 0); + "Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo", + NULL, NULL, default_compression_algorithm, + &page_compression_algorithms_typelib); static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index ea8afd450dd..18b76fe83cb 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -270,7 +270,7 @@ extern my_bool srv_use_posix_fallocate; extern my_bool srv_use_atomic_writes; /* Compression algorithm*/ -extern long innodb_compression_algorithm; +extern ulong innodb_compression_algorithm; /* Number of flush threads */ #define MTFLUSH_MAX_WORKER 64 diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index e70a2bd0dab..62c0b05eed7 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -173,7 +173,7 @@ UNIV_INTERN my_bool srv_use_posix_fallocate = FALSE; /* If this flag is TRUE, then we disable doublewrite buffer */ UNIV_INTERN my_bool srv_use_atomic_writes = FALSE; /* If this flag IS TRUE, then we use lz4 to compress/decompress pages */ -UNIV_INTERN long innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; +UNIV_INTERN ulong innodb_compression_algorithm = PAGE_ZLIB_ALGORITHM; /* Number of threads used for multi-threaded flush */ UNIV_INTERN long srv_mtflush_threads = MTFLUSH_DEFAULT_WORKER; /* If this flag is TRUE, then we will use multi threaded flush. */