mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
MDEV-28542 Useless output in SHOW ENGINE INNODB STATUS
srv_printf_innodb_monitor(): Only display an ADAPTIVE HASH INDEX section if the adaptive hash index is enabled. ibuf_print(): Only display an INSERT BUFFER section if the change buffer is not empty.
This commit is contained in:
parent
643fd51db5
commit
12aeb9fa15
4 changed files with 51 additions and 53 deletions
|
@ -39,19 +39,13 @@ Table Op Msg_type Msg_text
|
|||
test.t1 check Error Unknown storage engine 'InnoDB'
|
||||
test.t1 check error Corrupt
|
||||
FOUND 1 /innodb_read_only prevents crash recovery/ in mysqld.1.err
|
||||
# restart: --innodb-force-recovery=5
|
||||
# restart: --innodb-force-recovery=5 --debug-dbug=d,crash_after_log_ibuf_upd_inplace
|
||||
SELECT * FROM t1 LIMIT 1;
|
||||
a b c
|
||||
1 X 1
|
||||
SHOW ENGINE INNODB STATUS;
|
||||
Type Name Status
|
||||
InnoDB insert 0, delete mark 0
|
||||
SET GLOBAL innodb_fast_shutdown=0;
|
||||
# restart
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
SHOW ENGINE INNODB STATUS;
|
||||
Type Name Status
|
||||
InnoDB
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -67,16 +67,12 @@ CHECK TABLE t1;
|
|||
let SEARCH_PATTERN=innodb_read_only prevents crash recovery;
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--let $restart_parameters= --innodb-force-recovery=5
|
||||
--let $restart_parameters= --innodb-force-recovery=5 --debug-dbug=d,crash_after_log_ibuf_upd_inplace
|
||||
--source include/start_mysqld.inc
|
||||
SELECT * FROM t1 LIMIT 1;
|
||||
replace_regex /.*operations:.* (insert.*), delete \d.*discarded .*/\1/;
|
||||
SHOW ENGINE INNODB STATUS;
|
||||
# Slow shutdown will not merge the changes due to innodb_force_recovery=5.
|
||||
SET GLOBAL innodb_fast_shutdown=0;
|
||||
--let $restart_parameters=
|
||||
--source include/restart_mysqld.inc
|
||||
CHECK TABLE t1;
|
||||
replace_regex /.*operations:.* insert [1-9][0-9]*, delete mark [1-9][0-9]*, delete \d.*discarded .*//;
|
||||
SHOW ENGINE INNODB STATUS;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1218,6 +1218,7 @@ static
|
|||
void
|
||||
ibuf_print_ops(
|
||||
/*===========*/
|
||||
const char* op_name,/*!< in: operation name */
|
||||
const Atomic_counter<ulint>* ops, /*!< in: operation counts */
|
||||
FILE* file) /*!< in: file where to print */
|
||||
{
|
||||
|
@ -1226,11 +1227,11 @@ ibuf_print_ops(
|
|||
"delete mark",
|
||||
"delete"
|
||||
};
|
||||
ulint i;
|
||||
|
||||
ut_a(UT_ARR_SIZE(op_names) == IBUF_OP_COUNT);
|
||||
static_assert(array_elements(op_names) == IBUF_OP_COUNT, "");
|
||||
fputs(op_name, file);
|
||||
|
||||
for (i = 0; i < IBUF_OP_COUNT; i++) {
|
||||
for (ulint i = 0; i < IBUF_OP_COUNT; i++) {
|
||||
fprintf(file, "%s " ULINTPF "%s", op_names[i],
|
||||
ulint{ops[i]}, (i < (IBUF_OP_COUNT - 1)) ? ", " : "");
|
||||
}
|
||||
|
@ -4547,23 +4548,28 @@ ibuf_print(
|
|||
/*=======*/
|
||||
FILE* file) /*!< in: file where to print */
|
||||
{
|
||||
mysql_mutex_lock(&ibuf_mutex);
|
||||
|
||||
fprintf(file,
|
||||
"Ibuf: size " ULINTPF ", free list len " ULINTPF ","
|
||||
" seg size " ULINTPF ", " ULINTPF " merges\n",
|
||||
ibuf.size,
|
||||
ibuf.free_list_len,
|
||||
ibuf.seg_size,
|
||||
ulint{ibuf.n_merges});
|
||||
mysql_mutex_lock(&ibuf_mutex);
|
||||
if (ibuf.empty)
|
||||
{
|
||||
mysql_mutex_unlock(&ibuf_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
fputs("merged operations:\n ", file);
|
||||
ibuf_print_ops(ibuf.n_merged_ops, file);
|
||||
const ulint size= ibuf.size;
|
||||
const ulint free_list_len= ibuf.free_list_len;
|
||||
const ulint seg_size= ibuf.seg_size;
|
||||
mysql_mutex_unlock(&ibuf_mutex);
|
||||
|
||||
fputs("discarded operations:\n ", file);
|
||||
ibuf_print_ops(ibuf.n_discarded_ops, file);
|
||||
|
||||
mysql_mutex_unlock(&ibuf_mutex);
|
||||
fprintf(file,
|
||||
"-------------\n"
|
||||
"INSERT BUFFER\n"
|
||||
"-------------\n"
|
||||
"size " ULINTPF ", free list len " ULINTPF ","
|
||||
" seg size " ULINTPF ", " ULINTPF " merges\n",
|
||||
size, free_list_len, seg_size, ulint{ibuf.n_merges});
|
||||
ibuf_print_ops("merged operations:\n", ibuf.n_merged_ops, file);
|
||||
ibuf_print_ops("discarded operations:\n", ibuf.n_discarded_ops, file);
|
||||
}
|
||||
|
||||
/** Check the insert buffer bitmaps on IMPORT TABLESPACE.
|
||||
|
|
|
@ -828,34 +828,36 @@ srv_printf_innodb_monitor(
|
|||
"--------\n", file);
|
||||
os_aio_print(file);
|
||||
|
||||
fputs("-------------------------------------\n"
|
||||
"INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
|
||||
"-------------------------------------\n", file);
|
||||
ibuf_print(file);
|
||||
|
||||
#ifdef BTR_CUR_HASH_ADAPT
|
||||
for (ulint i = 0; i < btr_ahi_parts && btr_search_enabled; ++i) {
|
||||
const auto part= &btr_search_sys.parts[i];
|
||||
part->latch.rd_lock(SRW_LOCK_CALL);
|
||||
ut_ad(part->heap->type == MEM_HEAP_FOR_BTR_SEARCH);
|
||||
fprintf(file, "Hash table size " ULINTPF
|
||||
", node heap has " ULINTPF " buffer(s)\n",
|
||||
part->table.n_cells,
|
||||
part->heap->base.count - !part->heap->free_block);
|
||||
part->latch.rd_unlock();
|
||||
}
|
||||
if (btr_search_enabled) {
|
||||
fputs("-------------------\n"
|
||||
"ADAPTIVE HASH INDEX\n"
|
||||
"-------------------\n", file);
|
||||
for (ulint i = 0; i < btr_ahi_parts; ++i) {
|
||||
const auto part= &btr_search_sys.parts[i];
|
||||
part->latch.rd_lock(SRW_LOCK_CALL);
|
||||
ut_ad(part->heap->type == MEM_HEAP_FOR_BTR_SEARCH);
|
||||
fprintf(file, "Hash table size " ULINTPF
|
||||
", node heap has " ULINTPF " buffer(s)\n",
|
||||
part->table.n_cells,
|
||||
part->heap->base.count
|
||||
- !part->heap->free_block);
|
||||
part->latch.rd_unlock();
|
||||
}
|
||||
|
||||
/* btr_cur_n_sea_old and btr_cur_n_non_sea_old are protected by
|
||||
srv_innodb_monitor_mutex (srv_refresh_innodb_monitor_stats) */
|
||||
const ulint with_ahi = btr_cur_n_sea, without_ahi = btr_cur_n_non_sea;
|
||||
fprintf(file,
|
||||
"%.2f hash searches/s, %.2f non-hash searches/s\n",
|
||||
static_cast<double>(with_ahi - btr_cur_n_sea_old)
|
||||
/ time_elapsed,
|
||||
static_cast<double>(without_ahi - btr_cur_n_non_sea_old)
|
||||
/ time_elapsed);
|
||||
btr_cur_n_sea_old = with_ahi;
|
||||
btr_cur_n_non_sea_old = without_ahi;
|
||||
const ulint with_ahi = btr_cur_n_sea;
|
||||
const ulint without_ahi = btr_cur_n_non_sea;
|
||||
fprintf(file,
|
||||
"%.2f hash searches/s, %.2f non-hash searches/s\n",
|
||||
static_cast<double>(with_ahi - btr_cur_n_sea_old)
|
||||
/ time_elapsed,
|
||||
static_cast<double>(without_ahi - btr_cur_n_non_sea_old)
|
||||
/ time_elapsed);
|
||||
btr_cur_n_sea_old = with_ahi;
|
||||
btr_cur_n_non_sea_old = without_ahi;
|
||||
}
|
||||
#endif /* BTR_CUR_HASH_ADAPT */
|
||||
|
||||
fputs("---\n"
|
||||
|
|
Loading…
Add table
Reference in a new issue