Commit 3e599486 authored by Jan Lindström's avatar Jan Lindström

MDEV-6392: Change innodb_have_lzo and innodb_have_lz4 as a static

variables and reduce the number of ifdef's
parent b95ec135
select @@global.innodb_have_lz4;
@@global.innodb_have_lz4
0
select @@global.innodb_have_lzo;
@@global.innodb_have_lzo
0
--source include/have_innodb.inc
--let $inno= `select @@global.innodb_have_lz4`
--replace_result $inno 0
select @@global.innodb_have_lz4;
--source include/have_innodb.inc
--let $inno= `select @@global.innodb_have_lzo`
--replace_result $inno 0
select @@global.innodb_have_lzo;
...@@ -576,6 +576,8 @@ innodb_compression_algorithm_validate( ...@@ -576,6 +576,8 @@ innodb_compression_algorithm_validate(
for update function */ for update function */
struct st_mysql_value* value); /*!< in: incoming string */ struct st_mysql_value* value); /*!< in: incoming string */
static ibool innodb_have_lzo=IF_LZO(1, 0);
static ibool innodb_have_lz4=IF_LZ4(1, 0);
static const char innobase_hton_name[]= "InnoDB"; static const char innobase_hton_name[]= "InnoDB";
...@@ -740,9 +742,9 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -740,9 +742,9 @@ static SHOW_VAR innodb_status_variables[]= {
{"num_pages_page_decompressed", {"num_pages_page_decompressed",
(char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG}, (char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
{"have_lz4", {"have_lz4",
(char*) &export_vars.innodb_have_lz4, SHOW_LONG}, (char*) &innodb_have_lz4, SHOW_BOOL},
{"have_lzo", {"have_lzo",
(char*) &export_vars.innodb_have_lzo, SHOW_LONG}, (char*) &innodb_have_lzo, SHOW_BOOL},
{NullS, NullS, SHOW_LONG} {NullS, NullS, SHOW_LONG}
}; };
...@@ -17044,13 +17046,6 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, ...@@ -17044,13 +17046,6 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
"Use trim. Default FALSE.", "Use trim. Default FALSE.",
NULL, NULL, FALSE); NULL, NULL, FALSE);
#if defined(HAVE_LZO)
#define default_compression_algorithm PAGE_LZO_ALGORITHM
#elif defined(HAVE_LZ4)
#define default_compression_algorithm PAGE_LZ4_ALGORITHM
#else
#define default_compression_algorithm PAGE_ZLIB_ALGORITHM
#endif
static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 }; static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 };
static TYPELIB page_compression_algorithms_typelib= static TYPELIB page_compression_algorithms_typelib=
{ {
...@@ -17060,21 +17055,10 @@ static TYPELIB page_compression_algorithms_typelib= ...@@ -17060,21 +17055,10 @@ static TYPELIB page_compression_algorithms_typelib=
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm, static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo", "Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo",
innodb_compression_algorithm_validate, NULL, default_compression_algorithm, innodb_compression_algorithm_validate, NULL,
IF_LZO(PAGE_LZO_ALGORITHM, IF_LZ4(PAGE_LZ4_ALGORITHM, PAGE_ZLIB_ALGORITHM)),
&page_compression_algorithms_typelib); &page_compression_algorithms_typelib);
static MYSQL_SYSVAR_ULONG(have_lz4, srv_have_lz4,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblz4",
NULL, NULL, srv_have_lz4,
0, 1, 0);
static MYSQL_SYSVAR_ULONG(have_lzo, srv_have_lzo,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblzo",
NULL, NULL, srv_have_lzo,
0, 1, 0);
static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of multi-threaded flush threads", "Number of multi-threaded flush threads",
...@@ -17251,8 +17235,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -17251,8 +17235,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(compression_algorithm), MYSQL_SYSVAR(compression_algorithm),
MYSQL_SYSVAR(mtflush_threads), MYSQL_SYSVAR(mtflush_threads),
MYSQL_SYSVAR(use_mtflush), MYSQL_SYSVAR(use_mtflush),
MYSQL_SYSVAR(have_lz4),
MYSQL_SYSVAR(have_lzo),
NULL NULL
}; };
......
...@@ -264,9 +264,6 @@ extern long srv_mtflush_threads; ...@@ -264,9 +264,6 @@ extern long srv_mtflush_threads;
/* If this flag is TRUE, then we will use multi threaded flush. */ /* If this flag is TRUE, then we will use multi threaded flush. */
extern my_bool srv_use_mtflush; extern my_bool srv_use_mtflush;
extern ulong srv_have_lz4;
extern ulong srv_have_lzo;
#ifdef __WIN__ #ifdef __WIN__
extern ibool srv_use_native_conditions; extern ibool srv_use_native_conditions;
#endif /* __WIN__ */ #endif /* __WIN__ */
...@@ -919,8 +916,6 @@ struct export_var_t{ ...@@ -919,8 +916,6 @@ struct export_var_t{
compression */ compression */
ib_int64_t innodb_pages_page_compression_error;/*!< Number of page ib_int64_t innodb_pages_page_compression_error;/*!< Number of page
compression errors */ compression errors */
ulint innodb_have_lz4; /*!< HAVE_LZ4 */
ulint innodb_have_lzo; /*!< HAVE_LZO */
}; };
/** Thread slot in the thread table. */ /** Thread slot in the thread table. */
......
...@@ -331,6 +331,18 @@ typedef enum innodb_file_formats_enum innodb_file_formats_t; ...@@ -331,6 +331,18 @@ typedef enum innodb_file_formats_enum innodb_file_formats_t;
/** The 2-logarithm of UNIV_PAGE_SIZE: */ /** The 2-logarithm of UNIV_PAGE_SIZE: */
#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift #define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift
#ifdef HAVE_LZO
#define IF_LZO(A,B) A
#else
#define IF_LZO(A,B) B
#endif
#ifdef HAVE_LZ4
#define IF_LZ4(A,B) A
#else
#define IF_LZ4(A,B) B
#endif
/** The universal page size of the database */ /** The universal page size of the database */
#define UNIV_PAGE_SIZE ((ulint) srv_page_size) #define UNIV_PAGE_SIZE ((ulint) srv_page_size)
......
...@@ -209,18 +209,6 @@ UNIV_INTERN uint srv_flush_log_at_timeout = 1; ...@@ -209,18 +209,6 @@ UNIV_INTERN uint srv_flush_log_at_timeout = 1;
UNIV_INTERN ulong srv_page_size = UNIV_PAGE_SIZE_DEF; UNIV_INTERN ulong srv_page_size = UNIV_PAGE_SIZE_DEF;
UNIV_INTERN ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF; UNIV_INTERN ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF;
#ifdef HAVE_LZ4
UNIV_INTERN ulong srv_have_lz4 = 1;
#else
UNIV_INTERN ulong srv_have_lz4 = 0;
#endif
#ifdef HAVE_LZO
UNIV_INTERN ulong srv_have_lzo = 1;
#else
UNIV_INTERN ulong srv_have_lzo = 0;
#endif
/* Try to flush dirty pages so as to avoid IO bursts at /* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */ the checkpoints. */
UNIV_INTERN char srv_adaptive_flushing = TRUE; UNIV_INTERN char srv_adaptive_flushing = TRUE;
...@@ -1434,9 +1422,6 @@ srv_export_innodb_status(void) ...@@ -1434,9 +1422,6 @@ srv_export_innodb_status(void)
#endif #endif
export_vars.innodb_page_size = UNIV_PAGE_SIZE; export_vars.innodb_page_size = UNIV_PAGE_SIZE;
export_vars.innodb_have_lz4 = srv_have_lz4;
export_vars.innodb_have_lzo = srv_have_lzo;
export_vars.innodb_log_waits = srv_stats.log_waits; export_vars.innodb_log_waits = srv_stats.log_waits;
export_vars.innodb_os_log_written = srv_stats.os_log_written; export_vars.innodb_os_log_written = srv_stats.os_log_written;
......
...@@ -717,6 +717,8 @@ static MYSQL_THDVAR_BOOL(fake_changes, PLUGIN_VAR_OPCMDARG, ...@@ -717,6 +717,8 @@ static MYSQL_THDVAR_BOOL(fake_changes, PLUGIN_VAR_OPCMDARG,
"This is to cause replication prefetch IO. ATTENTION: the transaction started after enabled is affected.", "This is to cause replication prefetch IO. ATTENTION: the transaction started after enabled is affected.",
NULL, NULL, FALSE); NULL, NULL, FALSE);
static ibool innodb_have_lzo=IF_LZO(1, 0);
static ibool innodb_have_lz4=IF_LZ4(1, 0);
static SHOW_VAR innodb_status_variables[]= { static SHOW_VAR innodb_status_variables[]= {
{"available_undo_logs", {"available_undo_logs",
...@@ -934,9 +936,9 @@ static SHOW_VAR innodb_status_variables[]= { ...@@ -934,9 +936,9 @@ static SHOW_VAR innodb_status_variables[]= {
{"num_pages_page_decompressed", {"num_pages_page_decompressed",
(char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG}, (char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
{"have_lz4", {"have_lz4",
(char*) &export_vars.innodb_have_lz4, SHOW_LONG}, (char*) &innodb_have_lz4, SHOW_BOOL},
{"have_lzo", {"have_lzo",
(char*) &export_vars.innodb_have_lzo, SHOW_LONG}, (char*) &innodb_have_lzo, SHOW_BOOL},
{NullS, NullS, SHOW_LONG} {NullS, NullS, SHOW_LONG}
}; };
...@@ -18217,13 +18219,6 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, ...@@ -18217,13 +18219,6 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
"Use trim. Default FALSE.", "Use trim. Default FALSE.",
NULL, NULL, FALSE); NULL, NULL, FALSE);
#if defined(HAVE_LZO)
#define default_compression_algorithm PAGE_LZO_ALGORITHM
#elif defined(HAVE_LZ4)
#define default_compression_algorithm PAGE_LZ4_ALGORITHM
#else
#define default_compression_algorithm PAGE_ZLIB_ALGORITHM
#endif
static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 }; static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 };
static TYPELIB page_compression_algorithms_typelib= static TYPELIB page_compression_algorithms_typelib=
{ {
...@@ -18233,21 +18228,10 @@ static TYPELIB page_compression_algorithms_typelib= ...@@ -18233,21 +18228,10 @@ static TYPELIB page_compression_algorithms_typelib=
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm, static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo", "Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo",
innodb_compression_algorithm_validate, NULL, default_compression_algorithm, innodb_compression_algorithm_validate, NULL,
IF_LZO(PAGE_LZO_ALGORITHM, IF_LZ4(PAGE_LZ4_ALGORITHM, PAGE_ZLIB_ALGORITHM)),
&page_compression_algorithms_typelib); &page_compression_algorithms_typelib);
static MYSQL_SYSVAR_ULONG(have_lz4, srv_have_lz4,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblz4",
NULL, NULL, srv_have_lz4,
0, 1, 0);
static MYSQL_SYSVAR_ULONG(have_lzo, srv_have_lzo,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblzo",
NULL, NULL, srv_have_lzo,
0, 1, 0);
static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads, static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of multi-threaded flush threads", "Number of multi-threaded flush threads",
...@@ -18462,8 +18446,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { ...@@ -18462,8 +18446,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(compression_algorithm), MYSQL_SYSVAR(compression_algorithm),
MYSQL_SYSVAR(mtflush_threads), MYSQL_SYSVAR(mtflush_threads),
MYSQL_SYSVAR(use_mtflush), MYSQL_SYSVAR(use_mtflush),
MYSQL_SYSVAR(have_lz4),
MYSQL_SYSVAR(have_lzo),
NULL NULL
}; };
......
...@@ -282,9 +282,6 @@ extern long srv_mtflush_threads; ...@@ -282,9 +282,6 @@ extern long srv_mtflush_threads;
/* If this flag is TRUE, then we will use multi threaded flush. */ /* If this flag is TRUE, then we will use multi threaded flush. */
extern my_bool srv_use_mtflush; extern my_bool srv_use_mtflush;
extern ulong srv_have_lz4;
extern ulong srv_have_lzo;
/** Server undo tablespaces directory, can be absolute path. */ /** Server undo tablespaces directory, can be absolute path. */
extern char* srv_undo_dir; extern char* srv_undo_dir;
...@@ -1130,8 +1127,6 @@ struct export_var_t{ ...@@ -1130,8 +1127,6 @@ struct export_var_t{
compression */ compression */
ib_int64_t innodb_pages_page_compression_error;/*!< Number of page ib_int64_t innodb_pages_page_compression_error;/*!< Number of page
compression errors */ compression errors */
ulint innodb_have_lz4; /*!< HAVE_LZ4 */
ulint innodb_have_lzo; /*!< HAVE_LZO */
}; };
/** Thread slot in the thread table. */ /** Thread slot in the thread table. */
......
...@@ -346,6 +346,18 @@ typedef enum innodb_file_formats_enum innodb_file_formats_t; ...@@ -346,6 +346,18 @@ typedef enum innodb_file_formats_enum innodb_file_formats_t;
/** The 2-logarithm of UNIV_PAGE_SIZE: */ /** The 2-logarithm of UNIV_PAGE_SIZE: */
#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift #define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift
#ifdef HAVE_LZO
#define IF_LZO(A,B) A
#else
#define IF_LZO(A,B) B
#endif
#ifdef HAVE_LZ4
#define IF_LZ4(A,B) A
#else
#define IF_LZ4(A,B) B
#endif
/** The universal page size of the database */ /** The universal page size of the database */
#define UNIV_PAGE_SIZE ((ulint) srv_page_size) #define UNIV_PAGE_SIZE ((ulint) srv_page_size)
......
...@@ -237,18 +237,6 @@ UNIV_INTERN ulong srv_page_size = UNIV_PAGE_SIZE_DEF; ...@@ -237,18 +237,6 @@ UNIV_INTERN ulong srv_page_size = UNIV_PAGE_SIZE_DEF;
UNIV_INTERN ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF; UNIV_INTERN ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF;
UNIV_INTERN char srv_use_global_flush_log_at_trx_commit = TRUE; UNIV_INTERN char srv_use_global_flush_log_at_trx_commit = TRUE;
#ifdef HAVE_LZ4
UNIV_INTERN ulong srv_have_lz4 = 1;
#else
UNIV_INTERN ulong srv_have_lz4 = 0;
#endif
#ifdef HAVE_LZO
UNIV_INTERN ulong srv_have_lzo = 1;
#else
UNIV_INTERN ulong srv_have_lzo = 0;
#endif
/* Try to flush dirty pages so as to avoid IO bursts at /* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */ the checkpoints. */
UNIV_INTERN char srv_adaptive_flushing = TRUE; UNIV_INTERN char srv_adaptive_flushing = TRUE;
...@@ -1813,9 +1801,6 @@ srv_export_innodb_status(void) ...@@ -1813,9 +1801,6 @@ srv_export_innodb_status(void)
#endif #endif
export_vars.innodb_page_size = UNIV_PAGE_SIZE; export_vars.innodb_page_size = UNIV_PAGE_SIZE;
export_vars.innodb_have_lz4 = srv_have_lz4;
export_vars.innodb_have_lzo = srv_have_lzo;
export_vars.innodb_log_waits = srv_stats.log_waits; export_vars.innodb_log_waits = srv_stats.log_waits;
export_vars.innodb_os_log_written = srv_stats.os_log_written; export_vars.innodb_os_log_written = srv_stats.os_log_written;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment