1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-31 22:22:30 +03:00

Removed options innodb_compress_index_pages and innodb_trim_pct. Both are

unnecessary. There is a lot more index pages than there is normal pages.
Earlier all pages were compressed and this provided best performance and
compression ratio. Added status variable to show how many non index pages
are written.
This commit is contained in:
Jan Lindström
2014-03-12 14:47:38 +02:00
parent e7df30b8dd
commit 3ea72a2ba9
14 changed files with 50 additions and 62 deletions

View File

@@ -5487,6 +5487,8 @@ fil_io(
srv_stats.data_written.add(len); srv_stats.data_written.add(len);
if (fil_page_is_index_page((byte *)buf)) { if (fil_page_is_index_page((byte *)buf)) {
srv_stats.index_pages_written.inc(); srv_stats.index_pages_written.inc();
} else {
srv_stats.non_index_pages_written.inc();
} }
} }

View File

@@ -711,6 +711,8 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_page_compression_trim_sect4096, SHOW_LONGLONG}, (char*) &export_vars.innodb_page_compression_trim_sect4096, SHOW_LONGLONG},
{"num_index_pages_written", {"num_index_pages_written",
(char*) &export_vars.innodb_index_pages_written, SHOW_LONGLONG}, (char*) &export_vars.innodb_index_pages_written, SHOW_LONGLONG},
{"num_non_index_pages_written",
(char*) &export_vars.innodb_non_index_pages_written, SHOW_LONGLONG},
{"num_pages_page_compressed", {"num_pages_page_compressed",
(char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG}, (char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG},
{"num_page_compressed_trim_op", {"num_page_compressed_trim_op",
@@ -16786,18 +16788,6 @@ static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug,
NULL, NULL, FALSE); NULL, NULL, FALSE);
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/*
static MYSQL_SYSVAR_LONG(trim_pct, srv_trim_pct,
PLUGIN_VAR_OPCMDARG ,
"How many percent of compressed pages should be trimmed",
NULL, NULL, 100, 0, 100, 0);
*/
static MYSQL_SYSVAR_BOOL(compress_index_pages, srv_page_compress_index_pages,
PLUGIN_VAR_OPCMDARG,
"Use page compression also for index pages. Default FALSE.",
NULL, NULL, FALSE);
static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Use trim. Default FALSE.", "Use trim. Default FALSE.",
@@ -16976,8 +16966,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(limit_optimistic_insert_debug), MYSQL_SYSVAR(limit_optimistic_insert_debug),
MYSQL_SYSVAR(trx_purge_view_update_only_debug), MYSQL_SYSVAR(trx_purge_view_update_only_debug),
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
// MYSQL_SYSVAR(trim_pct),
MYSQL_SYSVAR(compress_index_pages),
MYSQL_SYSVAR(use_trim), MYSQL_SYSVAR(use_trim),
#ifdef HAVE_LZ4 #ifdef HAVE_LZ4
MYSQL_SYSVAR(use_lz4), MYSQL_SYSVAR(use_lz4),

View File

@@ -165,6 +165,7 @@ enum monitor_id_t {
MONITOR_OVLD_PAGE_CREATED, MONITOR_OVLD_PAGE_CREATED,
MONITOR_OVLD_PAGES_WRITTEN, MONITOR_OVLD_PAGES_WRITTEN,
MONITOR_OVLD_INDEX_PAGES_WRITTEN, MONITOR_OVLD_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_PAGES_READ, MONITOR_OVLD_PAGES_READ,
MONITOR_OVLD_BYTE_READ, MONITOR_OVLD_BYTE_READ,
MONITOR_OVLD_BYTE_WRITTEN, MONITOR_OVLD_BYTE_WRITTEN,

View File

@@ -111,6 +111,8 @@ struct srv_stats_t {
ulint_ctr_64_t page_compression_trim_sect4096; ulint_ctr_64_t page_compression_trim_sect4096;
/* Number of index pages written */ /* Number of index pages written */
ulint_ctr_64_t index_pages_written; ulint_ctr_64_t index_pages_written;
/* Number of non index pages written */
ulint_ctr_64_t non_index_pages_written;
/* Number of pages compressed with page compression */ /* Number of pages compressed with page compression */
ulint_ctr_64_t pages_page_compressed; ulint_ctr_64_t pages_page_compressed;
/* Number of TRIM operations induced by page compression */ /* Number of TRIM operations induced by page compression */
@@ -236,12 +238,6 @@ use simulated aio we build below with threads.
Currently we support native aio on windows and linux */ Currently we support native aio on windows and linux */
extern my_bool srv_use_native_aio; extern my_bool srv_use_native_aio;
/* Is page compression used only for index pages */
extern my_bool srv_page_compress_index_pages;
/* Frequency of trim operations */
extern long srv_trim_pct;
/* Use trim operation */ /* Use trim operation */
extern my_bool srv_use_trim; extern my_bool srv_use_trim;
@@ -901,6 +897,8 @@ struct export_var_t{
by page compression */ by page compression */
ib_int64_t innodb_index_pages_written; /*!< Number of index pages ib_int64_t innodb_index_pages_written; /*!< Number of index pages
written */ written */
ib_int64_t innodb_non_index_pages_written; /*!< Number of non index pages
written */
ib_int64_t innodb_pages_page_compressed;/*!< Number of pages ib_int64_t innodb_pages_page_compressed;/*!< Number of pages
compressed by page compression */ compressed by page compression */
ib_int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations ib_int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations

View File

@@ -4464,12 +4464,8 @@ found:
slot->page_compression = page_compression; slot->page_compression = page_compression;
/* If the space is page compressed and this is write operation /* If the space is page compressed and this is write operation
and either index compression is enabled or page is not a index then we compress the page */
page then we compress the page */ if (message1 && type == OS_FILE_WRITE && page_compression ) {
if (message1 &&
type == OS_FILE_WRITE &&
page_compression &&
(srv_page_compress_index_pages == true || !fil_page_is_index_page(slot->buf))) {
ulint real_len = len; ulint real_len = len;
byte* tmp = NULL; byte* tmp = NULL;

View File

@@ -296,6 +296,12 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON), MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_PAGES_WRITTEN}, MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_PAGES_WRITTEN},
{"buffer_non_index_pages_written", "buffer",
"Number of non index pages written (innodb_non_index_pages_written)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN},
{"buffer_pages_read", "buffer", {"buffer_pages_read", "buffer",
"Number of pages read (innodb_pages_read)", "Number of pages read (innodb_pages_read)",
static_cast<monitor_type_t>( static_cast<monitor_type_t>(
@@ -1593,11 +1599,16 @@ srv_mon_process_existing_counter(
value = stat.n_pages_written; value = stat.n_pages_written;
break; break;
/* innodb_index_pages_written, the number of page written */ /* innodb_index_pages_written, the number of index pages written */
case MONITOR_OVLD_INDEX_PAGES_WRITTEN: case MONITOR_OVLD_INDEX_PAGES_WRITTEN:
value = srv_stats.index_pages_written; value = srv_stats.index_pages_written;
break; break;
/* innodb_non_index_pages_written, the number of non index pages written */
case MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN:
value = srv_stats.non_index_pages_written;
break;
/* innodb_pages_read */ /* innodb_pages_read */
case MONITOR_OVLD_PAGES_READ: case MONITOR_OVLD_PAGES_READ:
buf_get_total_stat(&stat); buf_get_total_stat(&stat);

View File

@@ -146,10 +146,6 @@ use simulated aio we build below with threads.
Currently we support native aio on windows and linux */ Currently we support native aio on windows and linux */
UNIV_INTERN my_bool srv_use_native_aio = TRUE; UNIV_INTERN my_bool srv_use_native_aio = TRUE;
/* If this flag is TRUE, then we will use page compression
only for index pages */
UNIV_INTERN my_bool srv_page_compress_index_pages = FALSE;
UNIV_INTERN long srv_trim_pct = 100;
/* If this flag is TRUE, then we will use fallocate(PUCH_HOLE) /* If this flag is TRUE, then we will use fallocate(PUCH_HOLE)
to the pages */ to the pages */
UNIV_INTERN my_bool srv_use_trim = FALSE; UNIV_INTERN my_bool srv_use_trim = FALSE;
@@ -393,6 +389,7 @@ UNIV_INTERN ib_uint64_t srv_page_compression_saved = 0;
UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect512 = 0; UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect512 = 0;
UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect4096 = 0; UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect4096 = 0;
UNIV_INTERN ib_uint64_t srv_index_pages_written = 0; UNIV_INTERN ib_uint64_t srv_index_pages_written = 0;
UNIV_INTERN ib_uint64_t srv_non_index_pages_written = 0;
UNIV_INTERN ib_uint64_t srv_pages_page_compressed = 0; UNIV_INTERN ib_uint64_t srv_pages_page_compressed = 0;
UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op = 0; UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op = 0;
UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op_saved = 0; UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op_saved = 0;
@@ -1485,6 +1482,7 @@ srv_export_innodb_status(void)
export_vars.innodb_page_compression_trim_sect512 = srv_stats.page_compression_trim_sect512; export_vars.innodb_page_compression_trim_sect512 = srv_stats.page_compression_trim_sect512;
export_vars.innodb_page_compression_trim_sect4096 = srv_stats.page_compression_trim_sect4096; export_vars.innodb_page_compression_trim_sect4096 = srv_stats.page_compression_trim_sect4096;
export_vars.innodb_index_pages_written = srv_stats.index_pages_written; export_vars.innodb_index_pages_written = srv_stats.index_pages_written;
export_vars.innodb_non_index_pages_written = srv_stats.non_index_pages_written;
export_vars.innodb_pages_page_compressed = srv_stats.pages_page_compressed; export_vars.innodb_pages_page_compressed = srv_stats.pages_page_compressed;
export_vars.innodb_page_compressed_trim_op = srv_stats.page_compressed_trim_op; export_vars.innodb_page_compressed_trim_op = srv_stats.page_compressed_trim_op;
export_vars.innodb_page_compressed_trim_op_saved = srv_stats.page_compressed_trim_op_saved; export_vars.innodb_page_compressed_trim_op_saved = srv_stats.page_compressed_trim_op_saved;

View File

@@ -5488,6 +5488,8 @@ _fil_io(
srv_stats.data_written.add(len); srv_stats.data_written.add(len);
if (fil_page_is_index_page((byte *)buf)) { if (fil_page_is_index_page((byte *)buf)) {
srv_stats.index_pages_written.inc(); srv_stats.index_pages_written.inc();
} else {
srv_stats.non_index_pages_written.inc();
} }
} }

View File

@@ -906,6 +906,8 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_page_compression_trim_sect4096, SHOW_LONGLONG}, (char*) &export_vars.innodb_page_compression_trim_sect4096, SHOW_LONGLONG},
{"num_index_pages_written", {"num_index_pages_written",
(char*) &export_vars.innodb_index_pages_written, SHOW_LONGLONG}, (char*) &export_vars.innodb_index_pages_written, SHOW_LONGLONG},
{"num_non_index_pages_written",
(char*) &export_vars.innodb_non_index_pages_written, SHOW_LONGLONG},
{"num_pages_page_compressed", {"num_pages_page_compressed",
(char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG}, (char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG},
{"num_page_compressed_trim_op", {"num_page_compressed_trim_op",
@@ -17934,24 +17936,12 @@ static MYSQL_SYSVAR_BOOL(use_stacktrace, srv_use_stacktrace,
"Print stacktrace on long semaphore wait (off by default supported only on linux)", "Print stacktrace on long semaphore wait (off by default supported only on linux)",
NULL, NULL, FALSE); NULL, NULL, FALSE);
/*
static MYSQL_SYSVAR_LONG(trim_pct, srv_trim_pct,
PLUGIN_VAR_OPCMDARG ,
"How many percent of compressed pages should be trimmed",
NULL, NULL, 100, 0, 100, 0);
*/
static MYSQL_SYSVAR_UINT(compression_level, page_zip_level, static MYSQL_SYSVAR_UINT(compression_level, page_zip_level,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG,
"Compression level used for zlib compression. 0 is no compression" "Compression level used for zlib compression. 0 is no compression"
", 1 is fastest, 9 is best compression and default is 6.", ", 1 is fastest, 9 is best compression and default is 6.",
NULL, NULL, DEFAULT_COMPRESSION_LEVEL, 0, 9, 0); NULL, NULL, DEFAULT_COMPRESSION_LEVEL, 0, 9, 0);
static MYSQL_SYSVAR_BOOL(compress_index_pages, srv_page_compress_index_pages,
PLUGIN_VAR_OPCMDARG,
"Use page compression also for index pages. Default FALSE.",
NULL, NULL, FALSE);
static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim, static MYSQL_SYSVAR_BOOL(use_trim, srv_use_trim,
PLUGIN_VAR_OPCMDARG, PLUGIN_VAR_OPCMDARG,
"Use trim. Default FALSE.", "Use trim. Default FALSE.",
@@ -18168,8 +18158,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(fake_changes), MYSQL_SYSVAR(fake_changes),
MYSQL_SYSVAR(locking_fake_changes), MYSQL_SYSVAR(locking_fake_changes),
MYSQL_SYSVAR(use_stacktrace), MYSQL_SYSVAR(use_stacktrace),
// MYSQL_SYSVAR(trim_pct),
MYSQL_SYSVAR(compress_index_pages),
MYSQL_SYSVAR(use_trim), MYSQL_SYSVAR(use_trim),
#ifdef HAVE_LZ4 #ifdef HAVE_LZ4
MYSQL_SYSVAR(use_lz4), MYSQL_SYSVAR(use_lz4),

View File

@@ -165,6 +165,7 @@ enum monitor_id_t {
MONITOR_OVLD_PAGE_CREATED, MONITOR_OVLD_PAGE_CREATED,
MONITOR_OVLD_PAGES_WRITTEN, MONITOR_OVLD_PAGES_WRITTEN,
MONITOR_OVLD_INDEX_PAGES_WRITTEN, MONITOR_OVLD_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_PAGES_READ, MONITOR_OVLD_PAGES_READ,
MONITOR_OVLD_BYTE_READ, MONITOR_OVLD_BYTE_READ,
MONITOR_OVLD_BYTE_WRITTEN, MONITOR_OVLD_BYTE_WRITTEN,

View File

@@ -111,6 +111,8 @@ struct srv_stats_t {
ulint_ctr_64_t page_compression_trim_sect4096; ulint_ctr_64_t page_compression_trim_sect4096;
/* Number of index pages written */ /* Number of index pages written */
ulint_ctr_64_t index_pages_written; ulint_ctr_64_t index_pages_written;
/* Number of non index pages written */
ulint_ctr_64_t non_index_pages_written;
/* Number of pages compressed with page compression */ /* Number of pages compressed with page compression */
ulint_ctr_64_t pages_page_compressed; ulint_ctr_64_t pages_page_compressed;
/* Number of TRIM operations induced by page compression */ /* Number of TRIM operations induced by page compression */
@@ -256,12 +258,6 @@ extern ibool srv_use_native_conditions;
#endif /* __WIN__ */ #endif /* __WIN__ */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/* Is page compression used only for index pages */
extern my_bool srv_page_compress_index_pages;
/* Frequency of trim operations */
extern long srv_trim_pct;
/* Use trim operation */ /* Use trim operation */
extern my_bool srv_use_trim; extern my_bool srv_use_trim;
@@ -1110,6 +1106,8 @@ struct export_var_t{
by page compression */ by page compression */
ib_int64_t innodb_index_pages_written; /*!< Number of index pages ib_int64_t innodb_index_pages_written; /*!< Number of index pages
written */ written */
ib_int64_t innodb_non_index_pages_written; /*!< Number of non index pages
written */
ib_int64_t innodb_pages_page_compressed;/*!< Number of pages ib_int64_t innodb_pages_page_compressed;/*!< Number of pages
compressed by page compression */ compressed by page compression */
ib_int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations ib_int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations

View File

@@ -4580,12 +4580,8 @@ found:
slot->page_compression = page_compression; slot->page_compression = page_compression;
/* If the space is page compressed and this is write operation /* If the space is page compressed and this is write operation
and either index compression is enabled or page is not a index then we compress the page */
page then we compress the page */ if (message1 && type == OS_FILE_WRITE && page_compression ) {
if (message1 &&
type == OS_FILE_WRITE &&
page_compression &&
(srv_page_compress_index_pages == true || !fil_page_is_index_page(slot->buf))) {
ulint real_len = len; ulint real_len = len;
byte* tmp = NULL; byte* tmp = NULL;

View File

@@ -296,6 +296,12 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON), MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_PAGES_WRITTEN}, MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_PAGES_WRITTEN},
{"buffer_non_index_pages_written", "buffer",
"Number of non index pages written (innodb_non_index_pages_written)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN},
{"buffer_pages_read", "buffer", {"buffer_pages_read", "buffer",
"Number of pages read (innodb_pages_read)", "Number of pages read (innodb_pages_read)",
static_cast<monitor_type_t>( static_cast<monitor_type_t>(
@@ -1593,11 +1599,16 @@ srv_mon_process_existing_counter(
value = stat.n_pages_written; value = stat.n_pages_written;
break; break;
/* innodb_index_pages_written, the number of page written */ /* innodb_index_pages_written, the number of index pages written */
case MONITOR_OVLD_INDEX_PAGES_WRITTEN: case MONITOR_OVLD_INDEX_PAGES_WRITTEN:
value = srv_stats.index_pages_written; value = srv_stats.index_pages_written;
break; break;
/* innodb_non_index_pages_written, the number of non index pages written */
case MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN:
value = srv_stats.non_index_pages_written;
break;
/* innodb_pages_read */ /* innodb_pages_read */
case MONITOR_OVLD_PAGES_READ: case MONITOR_OVLD_PAGES_READ:
buf_get_total_stat(&stat); buf_get_total_stat(&stat);

View File

@@ -161,10 +161,6 @@ use simulated aio we build below with threads.
Currently we support native aio on windows and linux */ Currently we support native aio on windows and linux */
UNIV_INTERN my_bool srv_use_native_aio = TRUE; UNIV_INTERN my_bool srv_use_native_aio = TRUE;
/* If this flag is TRUE, then we will use page compression
only for index pages */
UNIV_INTERN my_bool srv_page_compress_index_pages = FALSE;
UNIV_INTERN long srv_trim_pct = 100;
/* Default compression level if page compression is used and no compression /* Default compression level if page compression is used and no compression
level is set for the table*/ level is set for the table*/
UNIV_INTERN long srv_compress_zlib_level = 6; UNIV_INTERN long srv_compress_zlib_level = 6;
@@ -515,6 +511,7 @@ UNIV_INTERN ib_uint64_t srv_page_compression_saved = 0;
UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect512 = 0; UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect512 = 0;
UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect4096 = 0; UNIV_INTERN ib_uint64_t srv_page_compression_trim_sect4096 = 0;
UNIV_INTERN ib_uint64_t srv_index_pages_written = 0; UNIV_INTERN ib_uint64_t srv_index_pages_written = 0;
UNIV_INTERN ib_uint64_t srv_non_index_pages_written = 0;
UNIV_INTERN ib_uint64_t srv_pages_page_compressed = 0; UNIV_INTERN ib_uint64_t srv_pages_page_compressed = 0;
UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op = 0; UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op = 0;
UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op_saved = 0; UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op_saved = 0;
@@ -1866,6 +1863,7 @@ srv_export_innodb_status(void)
export_vars.innodb_page_compression_trim_sect512 = srv_stats.page_compression_trim_sect512; export_vars.innodb_page_compression_trim_sect512 = srv_stats.page_compression_trim_sect512;
export_vars.innodb_page_compression_trim_sect4096 = srv_stats.page_compression_trim_sect4096; export_vars.innodb_page_compression_trim_sect4096 = srv_stats.page_compression_trim_sect4096;
export_vars.innodb_index_pages_written = srv_stats.index_pages_written; export_vars.innodb_index_pages_written = srv_stats.index_pages_written;
export_vars.innodb_non_index_pages_written = srv_stats.non_index_pages_written;
export_vars.innodb_pages_page_compressed = srv_stats.pages_page_compressed; export_vars.innodb_pages_page_compressed = srv_stats.pages_page_compressed;
export_vars.innodb_page_compressed_trim_op = srv_stats.page_compressed_trim_op; export_vars.innodb_page_compressed_trim_op = srv_stats.page_compressed_trim_op;
export_vars.innodb_page_compressed_trim_op_saved = srv_stats.page_compressed_trim_op_saved; export_vars.innodb_page_compressed_trim_op_saved = srv_stats.page_compressed_trim_op_saved;