Skip to content

Commit 3e59948

Browse files
author
Jan Lindström
committed
MDEV-6392: Change innodb_have_lzo and innodb_have_lz4 as a static
variables and reduce the number of ifdef's
1 parent b95ec13 commit 3e59948

File tree

12 files changed

+36
-104
lines changed

12 files changed

+36
-104
lines changed

mysql-test/suite/sys_vars/r/innodb_have_lz4_basic.result

Lines changed: 0 additions & 3 deletions
This file was deleted.

mysql-test/suite/sys_vars/r/innodb_have_lzo_basic.result

Lines changed: 0 additions & 3 deletions
This file was deleted.

mysql-test/suite/sys_vars/t/innodb_have_lz4_basic.test

Lines changed: 0 additions & 5 deletions
This file was deleted.

mysql-test/suite/sys_vars/t/innodb_have_lzo_basic.test

Lines changed: 0 additions & 5 deletions
This file was deleted.

storage/innobase/handler/ha_innodb.cc

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,8 @@ innodb_compression_algorithm_validate(
576576
for update function */
577577
struct st_mysql_value* value); /*!< in: incoming string */
578578

579+
static ibool innodb_have_lzo=IF_LZO(1, 0);
580+
static ibool innodb_have_lz4=IF_LZ4(1, 0);
579581

580582
static const char innobase_hton_name[]= "InnoDB";
581583

@@ -740,9 +742,9 @@ static SHOW_VAR innodb_status_variables[]= {
740742
{"num_pages_page_decompressed",
741743
(char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
742744
{"have_lz4",
743-
(char*) &export_vars.innodb_have_lz4, SHOW_LONG},
745+
(char*) &innodb_have_lz4, SHOW_BOOL},
744746
{"have_lzo",
745-
(char*) &export_vars.innodb_have_lzo, SHOW_LONG},
747+
(char*) &innodb_have_lzo, SHOW_BOOL},
746748

747749
{NullS, NullS, SHOW_LONG}
748750
};
@@ -17044,13 +17046,6 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
1704417046
"Use trim. Default FALSE.",
1704517047
NULL, NULL, FALSE);
1704617048

17047-
#if defined(HAVE_LZO)
17048-
#define default_compression_algorithm PAGE_LZO_ALGORITHM
17049-
#elif defined(HAVE_LZ4)
17050-
#define default_compression_algorithm PAGE_LZ4_ALGORITHM
17051-
#else
17052-
#define default_compression_algorithm PAGE_ZLIB_ALGORITHM
17053-
#endif
1705417049
static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 };
1705517050
static TYPELIB page_compression_algorithms_typelib=
1705617051
{
@@ -17060,21 +17055,10 @@ static TYPELIB page_compression_algorithms_typelib=
1706017055
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
1706117056
PLUGIN_VAR_OPCMDARG,
1706217057
"Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo",
17063-
innodb_compression_algorithm_validate, NULL, default_compression_algorithm,
17058+
innodb_compression_algorithm_validate, NULL,
17059+
IF_LZO(PAGE_LZO_ALGORITHM, IF_LZ4(PAGE_LZ4_ALGORITHM, PAGE_ZLIB_ALGORITHM)),
1706417060
&page_compression_algorithms_typelib);
1706517061

17066-
static MYSQL_SYSVAR_ULONG(have_lz4, srv_have_lz4,
17067-
PLUGIN_VAR_READONLY,
17068-
"InnoDB compiled support with liblz4",
17069-
NULL, NULL, srv_have_lz4,
17070-
0, 1, 0);
17071-
17072-
static MYSQL_SYSVAR_ULONG(have_lzo, srv_have_lzo,
17073-
PLUGIN_VAR_READONLY,
17074-
"InnoDB compiled support with liblzo",
17075-
NULL, NULL, srv_have_lzo,
17076-
0, 1, 0);
17077-
1707817062
static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads,
1707917063
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
1708017064
"Number of multi-threaded flush threads",
@@ -17251,8 +17235,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
1725117235
MYSQL_SYSVAR(compression_algorithm),
1725217236
MYSQL_SYSVAR(mtflush_threads),
1725317237
MYSQL_SYSVAR(use_mtflush),
17254-
MYSQL_SYSVAR(have_lz4),
17255-
MYSQL_SYSVAR(have_lzo),
1725617238
NULL
1725717239
};
1725817240

storage/innobase/include/srv0srv.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,6 @@ extern long srv_mtflush_threads;
264264
/* If this flag is TRUE, then we will use multi threaded flush. */
265265
extern my_bool srv_use_mtflush;
266266

267-
extern ulong srv_have_lz4;
268-
extern ulong srv_have_lzo;
269-
270267
#ifdef __WIN__
271268
extern ibool srv_use_native_conditions;
272269
#endif /* __WIN__ */
@@ -919,8 +916,6 @@ struct export_var_t{
919916
compression */
920917
ib_int64_t innodb_pages_page_compression_error;/*!< Number of page
921918
compression errors */
922-
ulint innodb_have_lz4; /*!< HAVE_LZ4 */
923-
ulint innodb_have_lzo; /*!< HAVE_LZO */
924919
};
925920

926921
/** Thread slot in the thread table. */

storage/innobase/include/univ.i

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,18 @@ typedef enum innodb_file_formats_enum innodb_file_formats_t;
331331
/** The 2-logarithm of UNIV_PAGE_SIZE: */
332332
#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift
333333

334+
#ifdef HAVE_LZO
335+
#define IF_LZO(A,B) A
336+
#else
337+
#define IF_LZO(A,B) B
338+
#endif
339+
340+
#ifdef HAVE_LZ4
341+
#define IF_LZ4(A,B) A
342+
#else
343+
#define IF_LZ4(A,B) B
344+
#endif
345+
334346
/** The universal page size of the database */
335347
#define UNIV_PAGE_SIZE ((ulint) srv_page_size)
336348

storage/innobase/srv/srv0srv.cc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,6 @@ UNIV_INTERN uint srv_flush_log_at_timeout = 1;
209209
UNIV_INTERN ulong srv_page_size = UNIV_PAGE_SIZE_DEF;
210210
UNIV_INTERN ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF;
211211

212-
#ifdef HAVE_LZ4
213-
UNIV_INTERN ulong srv_have_lz4 = 1;
214-
#else
215-
UNIV_INTERN ulong srv_have_lz4 = 0;
216-
#endif
217-
218-
#ifdef HAVE_LZO
219-
UNIV_INTERN ulong srv_have_lzo = 1;
220-
#else
221-
UNIV_INTERN ulong srv_have_lzo = 0;
222-
#endif
223-
224212
/* Try to flush dirty pages so as to avoid IO bursts at
225213
the checkpoints. */
226214
UNIV_INTERN char srv_adaptive_flushing = TRUE;
@@ -1434,9 +1422,6 @@ srv_export_innodb_status(void)
14341422
#endif
14351423
export_vars.innodb_page_size = UNIV_PAGE_SIZE;
14361424

1437-
export_vars.innodb_have_lz4 = srv_have_lz4;
1438-
export_vars.innodb_have_lzo = srv_have_lzo;
1439-
14401425
export_vars.innodb_log_waits = srv_stats.log_waits;
14411426

14421427
export_vars.innodb_os_log_written = srv_stats.os_log_written;

storage/xtradb/handler/ha_innodb.cc

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,8 @@ static MYSQL_THDVAR_BOOL(fake_changes, PLUGIN_VAR_OPCMDARG,
717717
"This is to cause replication prefetch IO. ATTENTION: the transaction started after enabled is affected.",
718718
NULL, NULL, FALSE);
719719

720+
static ibool innodb_have_lzo=IF_LZO(1, 0);
721+
static ibool innodb_have_lz4=IF_LZ4(1, 0);
720722

721723
static SHOW_VAR innodb_status_variables[]= {
722724
{"available_undo_logs",
@@ -934,9 +936,9 @@ static SHOW_VAR innodb_status_variables[]= {
934936
{"num_pages_page_decompressed",
935937
(char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
936938
{"have_lz4",
937-
(char*) &export_vars.innodb_have_lz4, SHOW_LONG},
939+
(char*) &innodb_have_lz4, SHOW_BOOL},
938940
{"have_lzo",
939-
(char*) &export_vars.innodb_have_lzo, SHOW_LONG},
941+
(char*) &innodb_have_lzo, SHOW_BOOL},
940942

941943
{NullS, NullS, SHOW_LONG}
942944
};
@@ -18217,13 +18219,6 @@ static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
1821718219
"Use trim. Default FALSE.",
1821818220
NULL, NULL, FALSE);
1821918221

18220-
#if defined(HAVE_LZO)
18221-
#define default_compression_algorithm PAGE_LZO_ALGORITHM
18222-
#elif defined(HAVE_LZ4)
18223-
#define default_compression_algorithm PAGE_LZ4_ALGORITHM
18224-
#else
18225-
#define default_compression_algorithm PAGE_ZLIB_ALGORITHM
18226-
#endif
1822718222
static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", 0 };
1822818223
static TYPELIB page_compression_algorithms_typelib=
1822918224
{
@@ -18233,21 +18228,10 @@ static TYPELIB page_compression_algorithms_typelib=
1823318228
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
1823418229
PLUGIN_VAR_OPCMDARG,
1823518230
"Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo",
18236-
innodb_compression_algorithm_validate, NULL, default_compression_algorithm,
18231+
innodb_compression_algorithm_validate, NULL,
18232+
IF_LZO(PAGE_LZO_ALGORITHM, IF_LZ4(PAGE_LZ4_ALGORITHM, PAGE_ZLIB_ALGORITHM)),
1823718233
&page_compression_algorithms_typelib);
1823818234

18239-
static MYSQL_SYSVAR_ULONG(have_lz4, srv_have_lz4,
18240-
PLUGIN_VAR_READONLY,
18241-
"InnoDB compiled support with liblz4",
18242-
NULL, NULL, srv_have_lz4,
18243-
0, 1, 0);
18244-
18245-
static MYSQL_SYSVAR_ULONG(have_lzo, srv_have_lzo,
18246-
PLUGIN_VAR_READONLY,
18247-
"InnoDB compiled support with liblzo",
18248-
NULL, NULL, srv_have_lzo,
18249-
0, 1, 0);
18250-
1825118235
static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads,
1825218236
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
1825318237
"Number of multi-threaded flush threads",
@@ -18462,8 +18446,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
1846218446
MYSQL_SYSVAR(compression_algorithm),
1846318447
MYSQL_SYSVAR(mtflush_threads),
1846418448
MYSQL_SYSVAR(use_mtflush),
18465-
MYSQL_SYSVAR(have_lz4),
18466-
MYSQL_SYSVAR(have_lzo),
1846718449

1846818450
NULL
1846918451
};

storage/xtradb/include/srv0srv.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@ extern long srv_mtflush_threads;
282282
/* If this flag is TRUE, then we will use multi threaded flush. */
283283
extern my_bool srv_use_mtflush;
284284

285-
extern ulong srv_have_lz4;
286-
extern ulong srv_have_lzo;
287-
288285
/** Server undo tablespaces directory, can be absolute path. */
289286
extern char* srv_undo_dir;
290287

@@ -1130,8 +1127,6 @@ struct export_var_t{
11301127
compression */
11311128
ib_int64_t innodb_pages_page_compression_error;/*!< Number of page
11321129
compression errors */
1133-
ulint innodb_have_lz4; /*!< HAVE_LZ4 */
1134-
ulint innodb_have_lzo; /*!< HAVE_LZO */
11351130
};
11361131

11371132
/** Thread slot in the thread table. */

0 commit comments

Comments
 (0)