Skip to content

Commit

Permalink
Removed options innodb_compress_index_pages and innodb_trim_pct. Both…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
Jan Lindström committed Mar 12, 2014
1 parent e7df30b commit 3ea72a2
Show file tree
Hide file tree
Showing 14 changed files with 50 additions and 62 deletions.
2 changes: 2 additions & 0 deletions storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5487,6 +5487,8 @@ fil_io(
srv_stats.data_written.add(len);
if (fil_page_is_index_page((byte *)buf)) {
srv_stats.index_pages_written.inc();
} else {
srv_stats.non_index_pages_written.inc();
}
}

Expand Down
16 changes: 2 additions & 14 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,8 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_page_compression_trim_sect4096, SHOW_LONGLONG},
{"num_index_pages_written",
(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",
(char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG},
{"num_page_compressed_trim_op",
Expand Down Expand Up @@ -16786,18 +16788,6 @@ static MYSQL_SYSVAR_BOOL(trx_purge_view_update_only_debug,
NULL, NULL, FALSE);
#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,
PLUGIN_VAR_OPCMDARG,
"Use trim. Default FALSE.",
Expand Down Expand Up @@ -16976,8 +16966,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(limit_optimistic_insert_debug),
MYSQL_SYSVAR(trx_purge_view_update_only_debug),
#endif /* UNIV_DEBUG */
// MYSQL_SYSVAR(trim_pct),
MYSQL_SYSVAR(compress_index_pages),
MYSQL_SYSVAR(use_trim),
#ifdef HAVE_LZ4
MYSQL_SYSVAR(use_lz4),
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/include/srv0mon.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ enum monitor_id_t {
MONITOR_OVLD_PAGE_CREATED,
MONITOR_OVLD_PAGES_WRITTEN,
MONITOR_OVLD_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_PAGES_READ,
MONITOR_OVLD_BYTE_READ,
MONITOR_OVLD_BYTE_WRITTEN,
Expand Down
10 changes: 4 additions & 6 deletions storage/innobase/include/srv0srv.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ struct srv_stats_t {
ulint_ctr_64_t page_compression_trim_sect4096;
/* Number of 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 */
ulint_ctr_64_t pages_page_compressed;
/* Number of TRIM operations induced by page compression */
Expand Down Expand Up @@ -236,12 +238,6 @@ use simulated aio we build below with threads.
Currently we support native aio on windows and linux */
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 */
extern my_bool srv_use_trim;

Expand Down Expand Up @@ -901,6 +897,8 @@ struct export_var_t{
by page compression */
ib_int64_t innodb_index_pages_written; /*!< Number of index pages
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
compressed by page compression */
ib_int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations
Expand Down
8 changes: 2 additions & 6 deletions storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4464,12 +4464,8 @@ os_aio_array_reserve_slot(
slot->page_compression = page_compression;

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

Expand Down
13 changes: 12 additions & 1 deletion storage/innobase/srv/srv0mon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
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",
"Number of pages read (innodb_pages_read)",
static_cast<monitor_type_t>(
Expand Down Expand Up @@ -1593,11 +1599,16 @@ srv_mon_process_existing_counter(
value = stat.n_pages_written;
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:
value = srv_stats.index_pages_written;
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 */
case MONITOR_OVLD_PAGES_READ:
buf_get_total_stat(&stat);
Expand Down
6 changes: 2 additions & 4 deletions storage/innobase/srv/srv0srv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ use simulated aio we build below with threads.
Currently we support native aio on windows and linux */
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)
to the pages */
UNIV_INTERN my_bool srv_use_trim = FALSE;
Expand Down Expand Up @@ -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_sect4096 = 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_page_compressed_trim_op = 0;
UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op_saved = 0;
Expand Down Expand Up @@ -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_sect4096 = srv_stats.page_compression_trim_sect4096;
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_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;
Expand Down
2 changes: 2 additions & 0 deletions storage/xtradb/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5488,6 +5488,8 @@ _fil_io(
srv_stats.data_written.add(len);
if (fil_page_is_index_page((byte *)buf)) {
srv_stats.index_pages_written.inc();
} else {
srv_stats.non_index_pages_written.inc();
}
}

Expand Down
16 changes: 2 additions & 14 deletions storage/xtradb/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,8 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_page_compression_trim_sect4096, SHOW_LONGLONG},
{"num_index_pages_written",
(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",
(char*) &export_vars.innodb_pages_page_compressed, SHOW_LONGLONG},
{"num_page_compressed_trim_op",
Expand Down Expand Up @@ -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)",
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,
PLUGIN_VAR_RQCMDARG,
"Compression level used for zlib compression. 0 is no compression"
", 1 is fastest, 9 is best compression and default is 6.",
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,
PLUGIN_VAR_OPCMDARG,
"Use trim. Default FALSE.",
Expand Down Expand Up @@ -18168,8 +18158,6 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(fake_changes),
MYSQL_SYSVAR(locking_fake_changes),
MYSQL_SYSVAR(use_stacktrace),
// MYSQL_SYSVAR(trim_pct),
MYSQL_SYSVAR(compress_index_pages),
MYSQL_SYSVAR(use_trim),
#ifdef HAVE_LZ4
MYSQL_SYSVAR(use_lz4),
Expand Down
1 change: 1 addition & 0 deletions storage/xtradb/include/srv0mon.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ enum monitor_id_t {
MONITOR_OVLD_PAGE_CREATED,
MONITOR_OVLD_PAGES_WRITTEN,
MONITOR_OVLD_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN,
MONITOR_OVLD_PAGES_READ,
MONITOR_OVLD_BYTE_READ,
MONITOR_OVLD_BYTE_WRITTEN,
Expand Down
10 changes: 4 additions & 6 deletions storage/xtradb/include/srv0srv.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ struct srv_stats_t {
ulint_ctr_64_t page_compression_trim_sect4096;
/* Number of 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 */
ulint_ctr_64_t pages_page_compressed;
/* Number of TRIM operations induced by page compression */
Expand Down Expand Up @@ -256,12 +258,6 @@ extern ibool srv_use_native_conditions;
#endif /* __WIN__ */
#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 */
extern my_bool srv_use_trim;

Expand Down Expand Up @@ -1110,6 +1106,8 @@ struct export_var_t{
by page compression */
ib_int64_t innodb_index_pages_written; /*!< Number of index pages
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
compressed by page compression */
ib_int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations
Expand Down
8 changes: 2 additions & 6 deletions storage/xtradb/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4580,12 +4580,8 @@ os_aio_array_reserve_slot(
slot->page_compression = page_compression;

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

Expand Down
13 changes: 12 additions & 1 deletion storage/xtradb/srv/srv0mon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
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",
"Number of pages read (innodb_pages_read)",
static_cast<monitor_type_t>(
Expand Down Expand Up @@ -1593,11 +1599,16 @@ srv_mon_process_existing_counter(
value = stat.n_pages_written;
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:
value = srv_stats.index_pages_written;
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 */
case MONITOR_OVLD_PAGES_READ:
buf_get_total_stat(&stat);
Expand Down
6 changes: 2 additions & 4 deletions storage/xtradb/srv/srv0srv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ use simulated aio we build below with threads.
Currently we support native aio on windows and linux */
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
level is set for the table*/
UNIV_INTERN long srv_compress_zlib_level = 6;
Expand Down Expand Up @@ -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_sect4096 = 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_page_compressed_trim_op = 0;
UNIV_INTERN ib_uint64_t srv_page_compressed_trim_op_saved = 0;
Expand Down Expand Up @@ -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_sect4096 = srv_stats.page_compression_trim_sect4096;
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_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;
Expand Down

0 comments on commit 3ea72a2

Please sign in to comment.