diff options
author | unknown <marko@hundin.mysql.fi> | 2004-04-06 16:14:43 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-04-06 16:14:43 +0300 |
commit | 80fe399fee3a7752aecdfc888edfcf56a2be7b0a (patch) | |
tree | f7bc427aa7ce4a54802d6e8931ca1dfe64c7bfa8 /innobase/buf/buf0buf.c | |
parent | d809c4413e9f991bde407690aafdaaa3eaae9232 (diff) | |
download | mariadb-git-80fe399fee3a7752aecdfc888edfcf56a2be7b0a.tar.gz |
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers
innobase/btr/btr0btr.c:
Output to stderr; quote table and index names
innobase/btr/btr0cur.c:
Output to stderr; quote table and index names
innobase/btr/btr0sea.c:
Output to stderr
innobase/buf/buf0buf.c:
Output to stderr; quote table and index names
innobase/buf/buf0flu.c:
Output to stderr
innobase/buf/buf0lru.c:
Output to stderr
innobase/buf/buf0rea.c:
Output to stderr
innobase/data/data0data.c:
Remove dtuple_validate() unless #ifdef UNIV_DEBUG
Remove unnecessary sprintf() calls
Output to stderr
innobase/data/data0type.c:
Output to stderr
innobase/dict/dict0boot.c:
Remove dummy call to printf()
innobase/dict/dict0crea.c:
Output diagnostic information to stream, not to memory
innobase/dict/dict0dict.c:
Output diagnostics to a file, not to a memory buffer
innobase/dict/dict0load.c:
Output to stderr; quote table and index names
innobase/eval/eval0eval.c:
Output to stderr
innobase/fil/fil0fil.c:
Output to stderr
innobase/fsp/fsp0fsp.c:
Output to stderr
Avoid sprintf()
innobase/fut/fut0lst.c:
Output to stderr
innobase/ha/ha0ha.c:
Output to stream, not to memory buffer
innobase/ibuf/ibuf0ibuf.c:
Output to stderr
Avoid sprintf()
innobase/include/buf0buf.h:
Output to stream, not to memory buffer
innobase/include/buf0buf.ic:
Use %p for displaying pointers
innobase/include/data0data.h:
Remove dtuple_sprintf()
innobase/include/dict0dict.h:
Output to stream, not to memory buffer
innobase/include/ha0ha.h:
Output to stream, not to memory buffer
innobase/include/ibuf0ibuf.h:
Output to stream, not to memory buffer
innobase/include/lock0lock.h:
Output to stream, not to memory buffer
innobase/include/log0log.h:
Output to stream, not to memory buffer
innobase/include/mtr0log.ic:
Output to stderr
Display pointers with %p
innobase/include/os0file.h:
Output to stream, not to memory buffer
innobase/include/rem0rec.h:
Remove rec_sprintf()
innobase/include/rem0rec.ic:
Output to stderr
innobase/include/row0sel.ic:
Output to stderr
innobase/include/row0upd.ic:
Quote table and index names
innobase/include/srv0srv.h:
Remove srv_sprintf_innodb_monitor()
innobase/include/sync0arr.h:
Output to stream, not to memory buffer
innobase/include/sync0sync.h:
Output to stream, not to memory buffer
innobase/include/trx0sys.h:
Output to stderr
innobase/include/trx0trx.h:
Output to stream, not to memory buffer
innobase/include/ut0ut.h:
Remove ut_sprintf_buf()
Add ut_print_name(), ut_print_namel() and ut_copy_file()
innobase/lock/lock0lock.c:
Output to stream, not to memory buffer
innobase/log/log0log.c:
Output to stderr
innobase/log/log0recv.c:
Output to stderr
innobase/mem/mem0dbg.c:
Output to stderr
innobase/mtr/mtr0log.c:
Display pointers with %p
innobase/mtr/mtr0mtr.c:
Output to stderr
innobase/os/os0file.c:
Output to stream, not to memory buffer
innobase/os/os0proc.c:
Output to stderr
innobase/os/os0thread.c:
Output to stderr
innobase/page/page0cur.c:
Output to stderr
innobase/page/page0page.c:
Avoid sprintf()
Output to stderr instead of stdout
innobase/pars/pars0opt.c:
Output to stderr instead of stdout
innobase/rem/rem0rec.c:
Remove rec_sprintf()
Output to stderr instead of stdout
innobase/row/row0ins.c:
Output diagnostics to stream instead of memory buffer
innobase/row/row0mysql.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0purge.c:
Output to stderr instead of stdout
innobase/row/row0row.c:
Quote table and index names
innobase/row/row0sel.c:
Output to stderr instead of stdout
Quote table and index names
innobase/row/row0umod.c:
Avoid sprintf()
Quote table and index names
innobase/row/row0undo.c:
Output to stderr instead of stdout
innobase/row/row0upd.c:
Avoid sprintf()
innobase/srv/srv0srv.c:
Output to stderr instead of stdout
innobase/srv/srv0start.c:
Handle srv_monitor_file
Make some global variables static
innobase/sync/sync0arr.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/sync/sync0rw.c:
Output to stderr instead of stdout
innobase/sync/sync0sync.c:
Output to stderr instead of stdout
Output to stream instead of memory buffer
innobase/trx/trx0purge.c:
Output to stderr instead of stdout
innobase/trx/trx0rec.c:
Quote index and table names
Avoid sprintf()
innobase/trx/trx0roll.c:
Quote identifier names
Output to stderr instead of stdout
innobase/trx/trx0sys.c:
Output to stderr instead of stdout
innobase/trx/trx0trx.c:
Output to stream instead of memory buffer
innobase/trx/trx0undo.c:
Output to stderr instead of stdout
innobase/ut/ut0ut.c:
Declare mysql_get_identifier_quote_char()
Remove ut_sprintf_buf()
Add ut_print_name() and ut_print_namel()
Add ut_copy_file()
sql/ha_innodb.cc:
innobase_mysql_print_thd(): output to stream, not to memory buffer
Add mysql_get_identifier_quote_char()
Remove unused function innobase_print_error()
Display pointers with %p
Buffer InnoDB output via files, not via statically allocated memory
Diffstat (limited to 'innobase/buf/buf0buf.c')
-rw-r--r-- | innobase/buf/buf0buf.c | 179 |
1 files changed, 73 insertions, 106 deletions
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c index e2661725912..b744430a76e 100644 --- a/innobase/buf/buf0buf.c +++ b/innobase/buf/buf0buf.c @@ -348,19 +348,12 @@ buf_page_print( dict_index_t* index; ulint checksum; ulint old_checksum; - char* buf; - - buf = mem_alloc(4 * UNIV_PAGE_SIZE); - - ut_sprintf_buf(buf, read_buf, UNIV_PAGE_SIZE); ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Page dump in ascii and hex (%lu bytes):\n%s", - (ulint)UNIV_PAGE_SIZE, buf); - fprintf(stderr, "InnoDB: End of page dump\n"); - - mem_free(buf); + fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n", + (ulint)UNIV_PAGE_SIZE); + ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE); + fputs("InnoDB: End of page dump\n", stderr); checksum = buf_calc_page_new_checksum(read_buf); old_checksum = buf_calc_page_old_checksum(read_buf); @@ -407,18 +400,17 @@ buf_page_print( index = dict_index_find_on_id_low( btr_page_get_index_id(read_buf)); if (index) { - fprintf(stderr, - "InnoDB: and table %s index %s\n", - index->table_name, - index->name); + fputs("InnoDB: (", stderr); + dict_index_name_print(stderr, index); + fputs(")\n", stderr); } } } else if (fil_page_get_type(read_buf) == FIL_PAGE_INODE) { - fprintf(stderr, "InnoDB: Page may be an 'inode' page\n"); + fputs("InnoDB: Page may be an 'inode' page\n", stderr); } else if (fil_page_get_type(read_buf) == FIL_PAGE_IBUF_FREE_LIST) { - fprintf(stderr, - "InnoDB: Page may be an insert buffer free list page\n"); + fputs("InnoDB: Page may be an insert buffer free list page\n", + stderr); } } @@ -1464,8 +1456,8 @@ buf_page_create( /* If we get here, the page was not in buf_pool: init it there */ if (buf_debug_prints) { - printf("Creating space %lu page %lu to buffer\n", space, - offset); + fprintf(stderr, "Creating space %lu page %lu to buffer\n", + space, offset); } block = free_block; @@ -1519,8 +1511,6 @@ buf_page_io_complete( /*=================*/ buf_block_t* block) /* in: pointer to the block in question */ { - dict_index_t* index; - dulint id; ulint io_type; ulint read_page_no; @@ -1551,17 +1541,17 @@ buf_page_io_complete( "InnoDB: Database page corruption on disk or a failed\n" "InnoDB: file read of page %lu.\n", block->offset); - fprintf(stderr, - "InnoDB: You may have to recover from a backup.\n"); + fputs( + "InnoDB: You may have to recover from a backup.\n", stderr); buf_page_print(block->frame); fprintf(stderr, "InnoDB: Database page corruption on disk or a failed\n" "InnoDB: file read of page %lu.\n", block->offset); - fprintf(stderr, - "InnoDB: You may have to recover from a backup.\n"); - fprintf(stderr, + fputs( + "InnoDB: You may have to recover from a backup.\n", stderr); + fputs( "InnoDB: It is also possible that your operating\n" "InnoDB: system has corrupted its own file cache\n" "InnoDB: and rebooting your computer removes the\n" @@ -1572,12 +1562,13 @@ buf_page_io_complete( "InnoDB: the corrupt table. You can use CHECK\n" "InnoDB: TABLE to scan your table for corruption.\n" "InnoDB: Look also at section 6.1 of\n" - "InnoDB: http://www.innodb.com/ibman.html about\n" - "InnoDB: forcing recovery.\n"); + "InnoDB: http://www.innodb.com/ibman.php about\n" + "InnoDB: forcing recovery.\n", stderr); if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { - fprintf(stderr, - "InnoDB: Ending processing because of a corrupt database page.\n"); + fputs( + "InnoDB: Ending processing because of a corrupt database page.\n", + stderr); exit(1); } } @@ -1619,7 +1610,7 @@ buf_page_io_complete( rw_lock_x_unlock_gen(&(block->read_lock), BUF_IO_READ); if (buf_debug_prints) { - printf("Has read "); + fputs("Has read ", stderr); } } else { ut_ad(io_type == BUF_IO_WRITE); @@ -1634,29 +1625,15 @@ buf_page_io_complete( buf_pool->n_pages_written++; if (buf_debug_prints) { - printf("Has written "); + fputs("Has written ", stderr); } } mutex_exit(&(buf_pool->mutex)); if (buf_debug_prints) { - printf("page space %lu page no %lu", block->space, - block->offset); - id = btr_page_get_index_id(block->frame); - - index = NULL; - /* The following can cause deadlocks if used: */ - /* - index = dict_index_get_if_in_cache(id); - - if (index) { - printf(" index name %s table %s", index->name, - index->table->name); - } - */ - - printf("\n"); + fprintf(stderr, "page space %lu page no %lu\n", + block->space, block->offset); } } @@ -1757,14 +1734,14 @@ buf_validate(void) } if (n_lru + n_free > buf_pool->curr_size) { - printf("n LRU %lu, n free %lu\n", n_lru, n_free); + fprintf(stderr, "n LRU %lu, n free %lu\n", n_lru, n_free); ut_error; } ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru); if (UT_LIST_GET_LEN(buf_pool->free) != n_free) { - printf("Free list len %lu, free blocks %lu\n", - UT_LIST_GET_LEN(buf_pool->free), n_free); + fprintf(stderr, "Free list len %lu, free blocks %lu\n", + UT_LIST_GET_LEN(buf_pool->free), n_free); ut_error; } ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush); @@ -1807,22 +1784,24 @@ buf_print(void) mutex_enter(&(buf_pool->mutex)); - printf("buf_pool size %lu \n", size); - printf("database pages %lu \n", UT_LIST_GET_LEN(buf_pool->LRU)); - printf("free pages %lu \n", UT_LIST_GET_LEN(buf_pool->free)); - printf("modified database pages %lu \n", - UT_LIST_GET_LEN(buf_pool->flush_list)); - - printf("n pending reads %lu \n", buf_pool->n_pend_reads); - - printf("n pending flush LRU %lu list %lu single page %lu\n", + fprintf(stderr, + "buf_pool size %lu \n" + "database pages %lu \n" + "free pages %lu \n" + "modified database pages %lu \n" + "n pending reads %lu \n" + "n pending flush LRU %lu list %lu single page %lu\n" + "pages read %lu, created %lu, written %lu\n", + size, + UT_LIST_GET_LEN(buf_pool->LRU), + UT_LIST_GET_LEN(buf_pool->free), + UT_LIST_GET_LEN(buf_pool->flush_list), + buf_pool->n_pend_reads, buf_pool->n_flush[BUF_FLUSH_LRU], buf_pool->n_flush[BUF_FLUSH_LIST], - buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]); - - printf("pages read %lu, created %lu, written %lu\n", - buf_pool->n_pages_read, buf_pool->n_pages_created, - buf_pool->n_pages_written); + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE], + buf_pool->n_pages_read, buf_pool->n_pages_created, + buf_pool->n_pages_written); /* Count the number of blocks belonging to each index in the buffer */ @@ -1865,15 +1844,16 @@ buf_print(void) for (i = 0; i < n_found; i++) { index = dict_index_get_if_in_cache(index_ids[i]); - printf("Block count for index %lu in buffer is about %lu", + fprintf(stderr, + "Block count for index %lu in buffer is about %lu", ut_dulint_get_low(index_ids[i]), counts[i]); if (index) { - printf(" index name %s table %s", index->name, - index->table->name); + putc(' ', stderr); + dict_index_name_print(stderr, index); } - printf("\n"); + putc('\n', stderr); } mem_free(index_ids); @@ -1924,44 +1904,29 @@ Prints info of the buffer i/o. */ void buf_print_io( /*=========*/ - char* buf, /* in/out: buffer where to print */ - char* buf_end)/* in: buffer end */ + FILE* file) /* in/out: buffer where to print */ { time_t current_time; double time_elapsed; ulint size; ut_ad(buf_pool); - - if (buf_end - buf < 400) { - - return; - } - size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE; mutex_enter(&(buf_pool->mutex)); - buf += sprintf(buf, - "Buffer pool size %lu\n", size); - buf += sprintf(buf, - "Free buffers %lu\n", UT_LIST_GET_LEN(buf_pool->free)); - buf += sprintf(buf, - "Database pages %lu\n", UT_LIST_GET_LEN(buf_pool->LRU)); -/* - buf += sprintf(buf, - "Lock heap buffers %lu\n", buf_pool->n_lock_heap_pages); - buf += sprintf(buf, - "Hash index buffers %lu\n", buf_pool->n_adaptive_hash_pages); -*/ - buf += sprintf(buf, - "Modified db pages %lu\n", - UT_LIST_GET_LEN(buf_pool->flush_list)); - - buf += sprintf(buf, "Pending reads %lu \n", buf_pool->n_pend_reads); - - buf += sprintf(buf, + fprintf(file, + "Buffer pool size %lu\n" + "Free buffers %lu\n" + "Database pages %lu\n" + "Modified db pages %lu\n" + "Pending reads %lu \n" "Pending writes: LRU %lu, flush list %lu, single page %lu\n", + size, + UT_LIST_GET_LEN(buf_pool->free), + UT_LIST_GET_LEN(buf_pool->LRU), + UT_LIST_GET_LEN(buf_pool->flush_list), + buf_pool->n_pend_reads, buf_pool->n_flush[BUF_FLUSH_LRU] + buf_pool->init_flush[BUF_FLUSH_LRU], buf_pool->n_flush[BUF_FLUSH_LIST] @@ -1973,10 +1938,11 @@ buf_print_io( buf_pool->last_printout_time); buf_pool->last_printout_time = current_time; - buf += sprintf(buf, "Pages read %lu, created %lu, written %lu\n", - buf_pool->n_pages_read, buf_pool->n_pages_created, - buf_pool->n_pages_written); - buf += sprintf(buf, "%.2f reads/s, %.2f creates/s, %.2f writes/s\n", + fprintf(file, + "Pages read %lu, created %lu, written %lu\n" + "%.2f reads/s, %.2f creates/s, %.2f writes/s\n", + buf_pool->n_pages_read, buf_pool->n_pages_created, + buf_pool->n_pages_written, (buf_pool->n_pages_read - buf_pool->n_pages_read_old) / time_elapsed, (buf_pool->n_pages_created - buf_pool->n_pages_created_old) @@ -1985,14 +1951,14 @@ buf_print_io( / time_elapsed); if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) { - buf += sprintf(buf, "Buffer pool hit rate %lu / 1000\n", + fprintf(file, "Buffer pool hit rate %lu / 1000\n", 1000 - ((1000 * (buf_pool->n_pages_read - buf_pool->n_pages_read_old)) / (buf_pool->n_page_gets - buf_pool->n_page_gets_old))); } else { - buf += sprintf(buf, - "No buffer pool page gets since the last printout\n"); + fputs("No buffer pool page gets since the last printout\n", + file); } buf_pool->n_page_gets_old = buf_pool->n_page_gets; @@ -2039,8 +2005,9 @@ buf_all_freed(void) if (!buf_flush_ready_for_replace(block)) { - /* printf("Page %lu %lu still fixed or dirty\n", - block->space, block->offset); */ + fprintf(stderr, + "Page %lu %lu still fixed or dirty\n", + block->space, block->offset); ut_error; } } |