mirror of
https://github.com/MariaDB/server.git
synced 2025-04-01 04:45:37 +02:00
Skip btr_search_latches[] in SHOW ENGINE INNODB STATUS
ha_print_info(): Remove. srv_printf_innodb_monitor(): Do not acquire btr_search_latches[] Add the equivalent functionality that was part of the non-debug version of ha_print_info().
This commit is contained in:
parent
86c69263a4
commit
a3476a5de2
3 changed files with 22 additions and 68 deletions
storage/innobase
|
@ -489,62 +489,4 @@ ha_validate(
|
|||
return(ok);
|
||||
}
|
||||
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
|
||||
|
||||
/*************************************************************//**
|
||||
Prints info of a hash table. */
|
||||
void
|
||||
ha_print_info(
|
||||
/*==========*/
|
||||
FILE* file, /*!< in: file where to print */
|
||||
hash_table_t* table) /*!< in: hash table */
|
||||
{
|
||||
#ifdef UNIV_DEBUG
|
||||
/* Some of the code here is disabled for performance reasons in production
|
||||
builds, see http://bugs.mysql.com/36941 */
|
||||
#define PRINT_USED_CELLS
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
#ifdef PRINT_USED_CELLS
|
||||
hash_cell_t* cell;
|
||||
ulint cells = 0;
|
||||
ulint i;
|
||||
#endif /* PRINT_USED_CELLS */
|
||||
ulint n_bufs;
|
||||
|
||||
ut_ad(table);
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
#ifdef PRINT_USED_CELLS
|
||||
for (i = 0; i < hash_get_n_cells(table); i++) {
|
||||
|
||||
cell = hash_get_nth_cell(table, i);
|
||||
|
||||
if (cell->node) {
|
||||
|
||||
cells++;
|
||||
}
|
||||
}
|
||||
#endif /* PRINT_USED_CELLS */
|
||||
|
||||
fprintf(file, "Hash table size %lu",
|
||||
(ulong) hash_get_n_cells(table));
|
||||
|
||||
#ifdef PRINT_USED_CELLS
|
||||
fprintf(file, ", used cells %lu", (ulong) cells);
|
||||
#endif /* PRINT_USED_CELLS */
|
||||
|
||||
if (table->heaps == NULL && table->heap != NULL) {
|
||||
|
||||
/* This calculation is intended for the adaptive hash
|
||||
index: how many buffer frames we have reserved? */
|
||||
|
||||
n_bufs = UT_LIST_GET_LEN(table->heap->base) - 1;
|
||||
|
||||
if (table->heap->free_block) {
|
||||
n_bufs++;
|
||||
}
|
||||
|
||||
fprintf(file, ", node heap has %lu buffer(s)\n",
|
||||
(ulong) n_bufs);
|
||||
}
|
||||
}
|
||||
#endif /* BTR_CUR_HASH_ADAPT */
|
||||
|
|
|
@ -198,13 +198,6 @@ ha_validate(
|
|||
ulint start_index, /*!< in: start index */
|
||||
ulint end_index); /*!< in: end index */
|
||||
#endif /* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
|
||||
/*************************************************************//**
|
||||
Prints info of a hash table. */
|
||||
void
|
||||
ha_print_info(
|
||||
/*==========*/
|
||||
FILE* file, /*!< in: file where to print */
|
||||
hash_table_t* table); /*!< in: hash table */
|
||||
|
||||
/** The hash table external chain node */
|
||||
struct ha_node_t {
|
||||
|
|
|
@ -1323,9 +1323,28 @@ srv_printf_innodb_monitor(
|
|||
|
||||
#ifdef BTR_CUR_HASH_ADAPT
|
||||
for (ulint i = 0; i < btr_ahi_parts; ++i) {
|
||||
rw_lock_s_lock(btr_search_latches[i]);
|
||||
ha_print_info(file, btr_search_sys->hash_tables[i]);
|
||||
rw_lock_s_unlock(btr_search_latches[i]);
|
||||
const hash_table_t* table = btr_search_sys->hash_tables[i];
|
||||
|
||||
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||
/* this is only used for buf_pool->page_hash */
|
||||
ut_ad(!table->heaps);
|
||||
/* this is used for the adaptive hash index */
|
||||
ut_ad(table->heap);
|
||||
|
||||
const mem_heap_t* heap = table->heap;
|
||||
/* The heap may change during the following call,
|
||||
so the data displayed may be garbage. We intentionally
|
||||
avoid acquiring btr_search_latches[] so that the
|
||||
diagnostic output will not stop here even in case another
|
||||
thread hangs while holding btr_search_latches[].
|
||||
|
||||
This should be safe from crashes, because
|
||||
table->heap will be pointing to the same object
|
||||
for the full lifetime of the server. Even during
|
||||
btr_search_disable() the heap will stay valid. */
|
||||
fprintf(file, "Hash table size " ULINTPF
|
||||
", node heap has " ULINTPF " buffer(s)\n",
|
||||
table->n_cells, heap->base.count - !heap->free_block);
|
||||
}
|
||||
|
||||
fprintf(file,
|
||||
|
|
Loading…
Add table
Reference in a new issue