Commit 2100eadf authored by vasil's avatar vasil

branches/5.1:

 
Fix Bug#36941 Performance problem in ha_print_info (SHOW INNODB STATUS)
by disabling some of the code in ha_print_info() in production builds.
 
Approved by:	Heikki (via IM)
parent 1c20025e
...@@ -331,11 +331,20 @@ ha_print_info( ...@@ -331,11 +331,20 @@ ha_print_info(
FILE* file, /* in: file where to print */ FILE* file, /* in: file where to print */
hash_table_t* table) /* in: hash table */ 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; hash_cell_t* cell;
ulint cells = 0; ulint cells = 0;
ulint n_bufs;
ulint i; ulint i;
#endif /* PRINT_USED_CELLS */
ulint n_bufs;
#ifdef PRINT_USED_CELLS
for (i = 0; i < hash_get_n_cells(table); i++) { for (i = 0; i < hash_get_n_cells(table); i++) {
cell = hash_get_nth_cell(table, i); cell = hash_get_nth_cell(table, i);
...@@ -345,10 +354,14 @@ ha_print_info( ...@@ -345,10 +354,14 @@ ha_print_info(
cells++; cells++;
} }
} }
#endif /* PRINT_USED_CELLS */
fprintf(file, "Hash table size %lu",
(ulong) hash_get_n_cells(table));
fprintf(file, #ifdef PRINT_USED_CELLS
"Hash table size %lu, used cells %lu", fprintf(file, ", used cells %lu", (ulong) cells);
(ulong) hash_get_n_cells(table), (ulong) cells); #endif /* PRINT_USED_CELLS */
if (table->heaps == NULL && table->heap != NULL) { if (table->heaps == NULL && table->heap != NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment