Commit 80fe399f authored by unknown's avatar unknown

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
parent d809c441
This diff is collapsed.
...@@ -830,6 +830,24 @@ btr_cur_ins_lock_and_undo( ...@@ -830,6 +830,24 @@ btr_cur_ins_lock_and_undo(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
/*****************************************************************
Report information about a transaction. */
static
void
btr_cur_trx_report(
/*===============*/
const trx_t* trx, /* in: transaction */
const dict_index_t* index, /* in: index */
const char* op) /* in: operation */
{
fprintf(stderr, "Trx with id %lu %lu going to ",
ut_dulint_get_high(trx->id),
ut_dulint_get_low(trx->id));
fputs(op, stderr);
dict_index_name_print(stderr, index);
putc('\n', stderr);
}
/***************************************************************** /*****************************************************************
Tries to perform an insert to a page in an index tree, next to cursor. Tries to perform an insert to a page in an index tree, next to cursor.
It is assumed that mtr holds an x-latch on the page. The operation does It is assumed that mtr holds an x-latch on the page. The operation does
...@@ -877,18 +895,13 @@ btr_cur_optimistic_insert( ...@@ -877,18 +895,13 @@ btr_cur_optimistic_insert(
index = cursor->index; index = cursor->index;
if (!dtuple_check_typed_no_assert(entry)) { if (!dtuple_check_typed_no_assert(entry)) {
fprintf(stderr, fputs("InnoDB: Error in a tuple to insert into ", stderr);
"InnoDB: Error in a tuple to insert into table %s index %s\n", dict_index_name_print(stderr, index);
index->table_name, index->name);
} }
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), index, "insert into ");
"Trx with id %lu %lu going to insert to table %s index %s\n", dtuple_print(stderr, entry);
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
dtuple_print(entry);
} }
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
...@@ -981,20 +994,15 @@ calculate_sizes_again: ...@@ -981,20 +994,15 @@ calculate_sizes_again:
*rec = page_cur_tuple_insert(page_cursor, entry, mtr); *rec = page_cur_tuple_insert(page_cursor, entry, mtr);
if (!(*rec)) { if (!*rec) {
char* err_buf = mem_alloc(1000); fputs("InnoDB: Error: cannot insert tuple ", stderr);
dtuple_print(stderr, entry);
dtuple_sprintf(err_buf, 900, entry); fputs(" into ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, fprintf(stderr, "\nInnoDB: max insert size %lu\n",
"InnoDB: Error: cannot insert tuple %s to index %s of table %s\n" max_size);
"InnoDB: max insert size %lu\n", ut_error;
err_buf, index->name, index->table->name, max_size);
mem_free(err_buf);
} }
ut_a(*rec); /* <- We calculated above the record would fit */
} }
#ifdef BTR_CUR_HASH_ADAPT #ifdef BTR_CUR_HASH_ADAPT
...@@ -1010,7 +1018,8 @@ calculate_sizes_again: ...@@ -1010,7 +1018,8 @@ calculate_sizes_again:
lock_update_insert(*rec); lock_update_insert(*rec);
} }
/* printf("Insert to page %lu, max ins size %lu, rec %lu ind type %lu\n", /* fprintf(stderr, "Insert into page %lu, max ins size %lu,"
" rec %lu ind type %lu\n",
buf_frame_get_page_no(page), max_size, buf_frame_get_page_no(page), max_size,
rec_size + PAGE_DIR_SLOT_SIZE, type); rec_size + PAGE_DIR_SLOT_SIZE, type);
*/ */
...@@ -1361,12 +1370,8 @@ btr_cur_update_in_place( ...@@ -1361,12 +1370,8 @@ btr_cur_update_in_place(
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(trx, index, "update ");
"Trx with id %lu %lu going to update table %s index %s\n", rec_print(stderr, rec);
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
} }
/* Do lock checking and undo logging */ /* Do lock checking and undo logging */
...@@ -1465,12 +1470,8 @@ btr_cur_optimistic_update( ...@@ -1465,12 +1470,8 @@ btr_cur_optimistic_update(
index = cursor->index; index = cursor->index;
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), index, "update ");
"Trx with id %lu %lu going to update table %s index %s\n", rec_print(stderr, rec);
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
} }
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
...@@ -2012,12 +2013,8 @@ btr_cur_del_mark_set_clust_rec( ...@@ -2012,12 +2013,8 @@ btr_cur_del_mark_set_clust_rec(
index = cursor->index; index = cursor->index;
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), index, "del mark ");
"Trx with id %lu %lu going to del mark table %s index %s\n", rec_print(stderr, rec);
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
} }
ut_ad(index->type & DICT_CLUSTERED); ut_ad(index->type & DICT_CLUSTERED);
...@@ -2152,12 +2149,9 @@ btr_cur_del_mark_set_sec_rec( ...@@ -2152,12 +2149,9 @@ btr_cur_del_mark_set_sec_rec(
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
printf( btr_cur_trx_report(thr_get_trx(thr), cursor->index,
"Trx with id %lu %lu going to del mark table %s index %s\n", "del mark ");
ut_dulint_get_high(thr_get_trx(thr)->id), rec_print(stderr, rec);
ut_dulint_get_low(thr_get_trx(thr)->id),
cursor->index->table_name, cursor->index->name);
rec_print(rec);
} }
err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index, err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index,
......
...@@ -803,7 +803,7 @@ btr_search_guess_on_hash( ...@@ -803,7 +803,7 @@ btr_search_guess_on_hash(
success = FALSE; success = FALSE;
/* /*
printf("Tree id %lu, page index id %lu fold %lu\n", fprintf(stderr, "Tree id %lu, page index id %lu fold %lu\n",
ut_dulint_get_low(tree_id), ut_dulint_get_low(tree_id),
ut_dulint_get_low(btr_page_get_index_id(page)), ut_dulint_get_low(btr_page_get_index_id(page)),
fold); fold);
...@@ -1045,7 +1045,7 @@ btr_search_drop_page_hash_when_freed( ...@@ -1045,7 +1045,7 @@ btr_search_drop_page_hash_when_freed(
/* We assume that if the caller has a latch on the page, /* We assume that if the caller has a latch on the page,
then the caller has already dropped the hash index for the page, then the caller has already dropped the hash index for the page,
and we never get here. Therefore we can acquire the s-latch to and we never get here. Therefore we can acquire the s-latch to
the page without fearing a deadlock. */ the page without having to fear a deadlock. */
page = buf_page_get(space, page_no, RW_S_LATCH, &mtr); page = buf_page_get(space, page_no, RW_S_LATCH, &mtr);
...@@ -1515,8 +1515,9 @@ check_next_rec: ...@@ -1515,8 +1515,9 @@ check_next_rec:
ha_insert_for_fold(table, ins_fold, ins_rec); ha_insert_for_fold(table, ins_fold, ins_rec);
/* /*
printf("Hash insert for %s, fold %lu\n", fputs("Hash insert for ", stderr);
cursor->index->name, ins_fold); dict_index_name_print(stderr, cursor->index);
fprintf(stderr, " fold %lu\n", ins_fold);
*/ */
} else { } else {
ha_insert_for_fold(table, next_fold, next_rec); ha_insert_for_fold(table, next_fold, next_rec);
...@@ -1543,7 +1544,6 @@ btr_search_validate(void) ...@@ -1543,7 +1544,6 @@ btr_search_validate(void)
ulint n_page_dumps = 0; ulint n_page_dumps = 0;
ibool ok = TRUE; ibool ok = TRUE;
ulint i; ulint i;
char rec_str[500];
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
...@@ -1564,9 +1564,9 @@ btr_search_validate(void) ...@@ -1564,9 +1564,9 @@ btr_search_validate(void)
fprintf(stderr, fprintf(stderr,
" InnoDB: Error in an adaptive hash index pointer to page %lu\n" " InnoDB: Error in an adaptive hash index pointer to page %lu\n"
"ptr mem address %lu index id %lu %lu, node fold %lu, rec fold %lu\n", "ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n",
buf_frame_get_page_no(page), buf_frame_get_page_no(page),
(ulint)(node->data), node->data,
ut_dulint_get_high(btr_page_get_index_id(page)), ut_dulint_get_high(btr_page_get_index_id(page)),
ut_dulint_get_low(btr_page_get_index_id(page)), ut_dulint_get_low(btr_page_get_index_id(page)),
node->fold, rec_fold((rec_t*)(node->data), node->fold, rec_fold((rec_t*)(node->data),
...@@ -1574,16 +1574,12 @@ btr_search_validate(void) ...@@ -1574,16 +1574,12 @@ btr_search_validate(void)
block->curr_n_bytes, block->curr_n_bytes,
btr_page_get_index_id(page))); btr_page_get_index_id(page)));
rec_sprintf(rec_str, 450, (rec_t*)(node->data)); fputs("InnoDB: Record ", stderr);
rec_print(stderr, (rec_t*)(node->data));
fprintf(stderr, fprintf(stderr, "\nInnoDB: on that page."
"InnoDB: Record %s\n" "Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n"
"InnoDB: on that page.", rec_str);
fprintf(stderr,
"Page mem address %lu, is hashed %lu, n fields %lu, n bytes %lu\n"
"side %lu\n", "side %lu\n",
(ulint)page, block->is_hashed, block->curr_n_fields, page, block->is_hashed, block->curr_n_fields,
block->curr_n_bytes, block->curr_side); block->curr_n_bytes, block->curr_side);
if (n_page_dumps < 20) { if (n_page_dumps < 20) {
......
...@@ -348,19 +348,12 @@ buf_page_print( ...@@ -348,19 +348,12 @@ buf_page_print(
dict_index_t* index; dict_index_t* index;
ulint checksum; ulint checksum;
ulint old_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); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n",
" InnoDB: Page dump in ascii and hex (%lu bytes):\n%s", (ulint)UNIV_PAGE_SIZE);
(ulint)UNIV_PAGE_SIZE, buf); ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE);
fprintf(stderr, "InnoDB: End of page dump\n"); fputs("InnoDB: End of page dump\n", stderr);
mem_free(buf);
checksum = buf_calc_page_new_checksum(read_buf); checksum = buf_calc_page_new_checksum(read_buf);
old_checksum = buf_calc_page_old_checksum(read_buf); old_checksum = buf_calc_page_old_checksum(read_buf);
...@@ -407,18 +400,17 @@ buf_page_print( ...@@ -407,18 +400,17 @@ buf_page_print(
index = dict_index_find_on_id_low( index = dict_index_find_on_id_low(
btr_page_get_index_id(read_buf)); btr_page_get_index_id(read_buf));
if (index) { if (index) {
fprintf(stderr, fputs("InnoDB: (", stderr);
"InnoDB: and table %s index %s\n", dict_index_name_print(stderr, index);
index->table_name, fputs(")\n", stderr);
index->name);
} }
} }
} else if (fil_page_get_type(read_buf) == FIL_PAGE_INODE) { } 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) { } else if (fil_page_get_type(read_buf) == FIL_PAGE_IBUF_FREE_LIST) {
fprintf(stderr, fputs("InnoDB: Page may be an insert buffer free list page\n",
"InnoDB: Page may be an insert buffer free list page\n"); stderr);
} }
} }
...@@ -1464,8 +1456,8 @@ buf_page_create( ...@@ -1464,8 +1456,8 @@ buf_page_create(
/* If we get here, the page was not in buf_pool: init it there */ /* If we get here, the page was not in buf_pool: init it there */
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Creating space %lu page %lu to buffer\n", space, fprintf(stderr, "Creating space %lu page %lu to buffer\n",
offset); space, offset);
} }
block = free_block; block = free_block;
...@@ -1519,8 +1511,6 @@ buf_page_io_complete( ...@@ -1519,8 +1511,6 @@ buf_page_io_complete(
/*=================*/ /*=================*/
buf_block_t* block) /* in: pointer to the block in question */ buf_block_t* block) /* in: pointer to the block in question */
{ {
dict_index_t* index;
dulint id;
ulint io_type; ulint io_type;
ulint read_page_no; ulint read_page_no;
...@@ -1551,17 +1541,17 @@ buf_page_io_complete( ...@@ -1551,17 +1541,17 @@ buf_page_io_complete(
"InnoDB: Database page corruption on disk or a failed\n" "InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", block->offset); "InnoDB: file read of page %lu.\n", block->offset);
fprintf(stderr, fputs(
"InnoDB: You may have to recover from a backup.\n"); "InnoDB: You may have to recover from a backup.\n", stderr);
buf_page_print(block->frame); buf_page_print(block->frame);
fprintf(stderr, fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n" "InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", block->offset); "InnoDB: file read of page %lu.\n", block->offset);
fprintf(stderr, fputs(
"InnoDB: You may have to recover from a backup.\n"); "InnoDB: You may have to recover from a backup.\n", stderr);
fprintf(stderr, fputs(
"InnoDB: It is also possible that your operating\n" "InnoDB: It is also possible that your operating\n"
"InnoDB: system has corrupted its own file cache\n" "InnoDB: system has corrupted its own file cache\n"
"InnoDB: and rebooting your computer removes the\n" "InnoDB: and rebooting your computer removes the\n"
...@@ -1572,12 +1562,13 @@ buf_page_io_complete( ...@@ -1572,12 +1562,13 @@ buf_page_io_complete(
"InnoDB: the corrupt table. You can use CHECK\n" "InnoDB: the corrupt table. You can use CHECK\n"
"InnoDB: TABLE to scan your table for corruption.\n" "InnoDB: TABLE to scan your table for corruption.\n"
"InnoDB: Look also at section 6.1 of\n" "InnoDB: Look also at section 6.1 of\n"
"InnoDB: http://www.innodb.com/ibman.html about\n" "InnoDB: http://www.innodb.com/ibman.php about\n"
"InnoDB: forcing recovery.\n"); "InnoDB: forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fprintf(stderr, fputs(
"InnoDB: Ending processing because of a corrupt database page.\n"); "InnoDB: Ending processing because of a corrupt database page.\n",
stderr);
exit(1); exit(1);
} }
} }
...@@ -1619,7 +1610,7 @@ buf_page_io_complete( ...@@ -1619,7 +1610,7 @@ buf_page_io_complete(
rw_lock_x_unlock_gen(&(block->read_lock), BUF_IO_READ); rw_lock_x_unlock_gen(&(block->read_lock), BUF_IO_READ);
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Has read "); fputs("Has read ", stderr);
} }
} else { } else {
ut_ad(io_type == BUF_IO_WRITE); ut_ad(io_type == BUF_IO_WRITE);
...@@ -1634,29 +1625,15 @@ buf_page_io_complete( ...@@ -1634,29 +1625,15 @@ buf_page_io_complete(
buf_pool->n_pages_written++; buf_pool->n_pages_written++;
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Has written "); fputs("Has written ", stderr);
} }
} }
mutex_exit(&(buf_pool->mutex)); mutex_exit(&(buf_pool->mutex));
if (buf_debug_prints) { if (buf_debug_prints) {
printf("page space %lu page no %lu", block->space, fprintf(stderr, "page space %lu page no %lu\n",
block->offset); 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");
} }
} }
...@@ -1757,13 +1734,13 @@ buf_validate(void) ...@@ -1757,13 +1734,13 @@ buf_validate(void)
} }
if (n_lru + n_free > buf_pool->curr_size) { 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_error;
} }
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru); ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) { if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
printf("Free list len %lu, free blocks %lu\n", fprintf(stderr, "Free list len %lu, free blocks %lu\n",
UT_LIST_GET_LEN(buf_pool->free), n_free); UT_LIST_GET_LEN(buf_pool->free), n_free);
ut_error; ut_error;
} }
...@@ -1807,20 +1784,22 @@ buf_print(void) ...@@ -1807,20 +1784,22 @@ buf_print(void)
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
printf("buf_pool size %lu \n", size); fprintf(stderr,
printf("database pages %lu \n", UT_LIST_GET_LEN(buf_pool->LRU)); "buf_pool size %lu \n"
printf("free pages %lu \n", UT_LIST_GET_LEN(buf_pool->free)); "database pages %lu \n"
printf("modified database pages %lu \n", "free pages %lu \n"
UT_LIST_GET_LEN(buf_pool->flush_list)); "modified database pages %lu \n"
"n pending reads %lu \n"
printf("n pending reads %lu \n", buf_pool->n_pend_reads); "n pending flush LRU %lu list %lu single page %lu\n"
"pages read %lu, created %lu, written %lu\n",
printf("n pending flush LRU %lu list %lu single page %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_LRU],
buf_pool->n_flush[BUF_FLUSH_LIST], buf_pool->n_flush[BUF_FLUSH_LIST],
buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]); 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_read, buf_pool->n_pages_created,
buf_pool->n_pages_written); buf_pool->n_pages_written);
...@@ -1865,15 +1844,16 @@ buf_print(void) ...@@ -1865,15 +1844,16 @@ buf_print(void)
for (i = 0; i < n_found; i++) { for (i = 0; i < n_found; i++) {
index = dict_index_get_if_in_cache(index_ids[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]); ut_dulint_get_low(index_ids[i]), counts[i]);
if (index) { if (index) {
printf(" index name %s table %s", index->name, putc(' ', stderr);
index->table->name); dict_index_name_print(stderr, index);
} }
printf("\n"); putc('\n', stderr);
} }
mem_free(index_ids); mem_free(index_ids);
...@@ -1924,44 +1904,29 @@ Prints info of the buffer i/o. */ ...@@ -1924,44 +1904,29 @@ Prints info of the buffer i/o. */
void void
buf_print_io( buf_print_io(
/*=========*/ /*=========*/
char* buf, /* in/out: buffer where to print */ FILE* file) /* in/out: buffer where to print */
char* buf_end)/* in: buffer end */
{ {
time_t current_time; time_t current_time;
double time_elapsed; double time_elapsed;
ulint size; ulint size;
ut_ad(buf_pool); ut_ad(buf_pool);
if (buf_end - buf < 400) {
return;
}
size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE; size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE;
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
buf += sprintf(buf, fprintf(file,
"Buffer pool size %lu\n", size); "Buffer pool size %lu\n"
buf += sprintf(buf, "Free buffers %lu\n"
"Free buffers %lu\n", UT_LIST_GET_LEN(buf_pool->free)); "Database pages %lu\n"
buf += sprintf(buf, "Modified db pages %lu\n"
"Database pages %lu\n", UT_LIST_GET_LEN(buf_pool->LRU)); "Pending reads %lu \n"
/*
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,
"Pending writes: LRU %lu, flush list %lu, single page %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->n_flush[BUF_FLUSH_LRU]
+ buf_pool->init_flush[BUF_FLUSH_LRU], + buf_pool->init_flush[BUF_FLUSH_LRU],
buf_pool->n_flush[BUF_FLUSH_LIST] buf_pool->n_flush[BUF_FLUSH_LIST]
...@@ -1973,10 +1938,11 @@ buf_print_io( ...@@ -1973,10 +1938,11 @@ buf_print_io(
buf_pool->last_printout_time); buf_pool->last_printout_time);
buf_pool->last_printout_time = current_time; buf_pool->last_printout_time = current_time;
buf += sprintf(buf, "Pages read %lu, created %lu, written %lu\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_read, buf_pool->n_pages_created,
buf_pool->n_pages_written); buf_pool->n_pages_written,
buf += sprintf(buf, "%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
(buf_pool->n_pages_read - buf_pool->n_pages_read_old) (buf_pool->n_pages_read - buf_pool->n_pages_read_old)
/ time_elapsed, / time_elapsed,
(buf_pool->n_pages_created - buf_pool->n_pages_created_old) (buf_pool->n_pages_created - buf_pool->n_pages_created_old)
...@@ -1985,14 +1951,14 @@ buf_print_io( ...@@ -1985,14 +1951,14 @@ buf_print_io(
/ time_elapsed); / time_elapsed);
if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) { 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
- ((1000 * - ((1000 *
(buf_pool->n_pages_read - buf_pool->n_pages_read_old)) (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
/ (buf_pool->n_page_gets - buf_pool->n_page_gets_old))); / (buf_pool->n_page_gets - buf_pool->n_page_gets_old)));
} else { } else {
buf += sprintf(buf, fputs("No buffer pool page gets since the last printout\n",
"No buffer pool page gets since the last printout\n"); file);
} }
buf_pool->n_page_gets_old = buf_pool->n_page_gets; buf_pool->n_page_gets_old = buf_pool->n_page_gets;
...@@ -2039,8 +2005,9 @@ buf_all_freed(void) ...@@ -2039,8 +2005,9 @@ buf_all_freed(void)
if (!buf_flush_ready_for_replace(block)) { if (!buf_flush_ready_for_replace(block)) {
/* printf("Page %lu %lu still fixed or dirty\n", fprintf(stderr,
block->space, block->offset); */ "Page %lu %lu still fixed or dirty\n",
block->space, block->offset);
ut_error; ut_error;
} }
} }
......
...@@ -189,7 +189,7 @@ buf_flush_write_complete( ...@@ -189,7 +189,7 @@ buf_flush_write_complete(
buf_pool->LRU_flush_ended++; buf_pool->LRU_flush_ended++;
} }
/* printf("n pending flush %lu\n", /* fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[block->flush_type]); */ buf_pool->n_flush[block->flush_type]); */
if ((buf_pool->n_flush[block->flush_type] == 0) if ((buf_pool->n_flush[block->flush_type] == 0)
...@@ -411,8 +411,8 @@ buf_flush_write_block_low( ...@@ -411,8 +411,8 @@ buf_flush_write_block_low(
ut_ad(!ut_dulint_is_zero(block->newest_modification)); ut_ad(!ut_dulint_is_zero(block->newest_modification));
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
printf( fputs("Warning: cannot force log to disk in the log debug version!\n",
"Warning: cannot force log to disk in the log debug version!\n"); stderr);
#else #else
/* Force the log to the disk before writing the modified block */ /* Force the log to the disk before writing the modified block */
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE); log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
...@@ -489,7 +489,8 @@ buf_flush_try_page( ...@@ -489,7 +489,8 @@ buf_flush_try_page(
} }
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Flushing page space %lu, page no %lu \n", fprintf(stderr,
"Flushing page space %lu, page no %lu \n",
block->space, block->offset); block->space, block->offset);
} }
...@@ -548,7 +549,7 @@ buf_flush_try_page( ...@@ -548,7 +549,7 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE); rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
if (buf_debug_prints) { if (buf_debug_prints) {
printf( fprintf(stderr,
"Flushing single page space %lu, page no %lu \n", "Flushing single page space %lu, page no %lu \n",
block->space, block->offset); block->space, block->offset);
} }
...@@ -592,7 +593,7 @@ buf_flush_try_neighbors( ...@@ -592,7 +593,7 @@ buf_flush_try_neighbors(
high = offset + 1; high = offset + 1;
} }
/* printf("Flush area: low %lu high %lu\n", low, high); */ /* fprintf(stderr, "Flush area: low %lu high %lu\n", low, high); */
if (high > fil_space_get_size(space)) { if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space); high = fil_space_get_size(space);
...@@ -739,7 +740,7 @@ buf_flush_batch( ...@@ -739,7 +740,7 @@ buf_flush_batch(
page_count += page_count +=
buf_flush_try_neighbors(space, offset, buf_flush_try_neighbors(space, offset,
flush_type); flush_type);
/* printf( /* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n", "Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset, flush_type, offset,
page_count - old_page_count); */ page_count - old_page_count); */
...@@ -779,15 +780,12 @@ buf_flush_batch( ...@@ -779,15 +780,12 @@ buf_flush_batch(
buf_flush_buffered_writes(); buf_flush_buffered_writes();
if (buf_debug_prints && page_count > 0) { if (buf_debug_prints && page_count > 0) {
if (flush_type == BUF_FLUSH_LRU) { ut_a(flush_type == BUF_FLUSH_LRU
printf("Flushed %lu pages in LRU flush\n", || flush_type == BUF_FLUSH_LIST);
page_count); fprintf(stderr, flush_type == BUF_FLUSH_LRU
} else if (flush_type == BUF_FLUSH_LIST) { ? "Flushed %lu pages in LRU flush\n"
printf("Flushed %lu pages in flush list flush\n", : "Flushed %lu pages in flush list flush\n",
page_count); page_count);
} else {
ut_error;
}
} }
return(page_count); return(page_count);
......
...@@ -126,7 +126,7 @@ buf_LRU_search_and_free_block( ...@@ -126,7 +126,7 @@ buf_LRU_search_and_free_block(
if (buf_flush_ready_for_replace(block)) { if (buf_flush_ready_for_replace(block)) {
if (buf_debug_prints) { if (buf_debug_prints) {
printf( fprintf(stderr,
"Putting space %lu page %lu to free list\n", "Putting space %lu page %lu to free list\n",
block->space, block->offset); block->space, block->offset);
} }
...@@ -301,27 +301,21 @@ loop: ...@@ -301,27 +301,21 @@ loop:
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: difficult to find free blocks from\n" "InnoDB: Warning: difficult to find free blocks from\n"
"InnoDB: the buffer pool (%lu search iterations)! Consider\n" "InnoDB: the buffer pool (%lu search iterations)! Consider\n"
"InnoDB: increasing the buffer pool size.\n", "InnoDB: increasing the buffer pool size.\n"
n_iterations);
fprintf(stderr,
"InnoDB: It is also possible that in your Unix version\n" "InnoDB: It is also possible that in your Unix version\n"
"InnoDB: fsync is very slow, or completely frozen inside\n" "InnoDB: fsync is very slow, or completely frozen inside\n"
"InnoDB: the OS kernel. Then upgrading to a newer version\n" "InnoDB: the OS kernel. Then upgrading to a newer version\n"
"InnoDB: of your operating system may help. Look at the\n" "InnoDB: of your operating system may help. Look at the\n"
"InnoDB: number of fsyncs in diagnostic info below.\n"); "InnoDB: number of fsyncs in diagnostic info below.\n"
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
fprintf(stderr, "InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n"
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n", "InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n",
n_iterations,
fil_n_pending_log_flushes, fil_n_pending_log_flushes,
fil_n_pending_tablespace_flushes); fil_n_pending_tablespace_flushes,
fprintf(stderr,
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
os_n_file_reads, os_n_file_writes, os_n_fsyncs); os_n_file_reads, os_n_file_writes, os_n_fsyncs);
fprintf(stderr,
"InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n");
mon_value_was = srv_print_innodb_monitor; mon_value_was = srv_print_innodb_monitor;
started_monitor = TRUE; started_monitor = TRUE;
srv_print_innodb_monitor = TRUE; srv_print_innodb_monitor = TRUE;
...@@ -797,7 +791,7 @@ buf_LRU_print(void) ...@@ -797,7 +791,7 @@ buf_LRU_print(void)
ut_ad(buf_pool); ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
printf("Pool ulint clock %lu\n", buf_pool->ulint_clock); fprintf(stderr, "Pool ulint clock %lu\n", buf_pool->ulint_clock);
block = UT_LIST_GET_FIRST(buf_pool->LRU); block = UT_LIST_GET_FIRST(buf_pool->LRU);
...@@ -805,37 +799,37 @@ buf_LRU_print(void) ...@@ -805,37 +799,37 @@ buf_LRU_print(void)
while (block != NULL) { while (block != NULL) {
printf("BLOCK %lu ", block->offset); fprintf(stderr, "BLOCK %lu ", block->offset);
if (block->old) { if (block->old) {
printf("old "); fputs("old ", stderr);
} }
if (block->buf_fix_count) { if (block->buf_fix_count) {
printf("buffix count %lu ", block->buf_fix_count); fprintf(stderr, "buffix count %lu ",
block->buf_fix_count);
} }
if (block->io_fix) { if (block->io_fix) {
printf("io_fix %lu ", block->io_fix); fprintf(stderr, "io_fix %lu ", block->io_fix);
} }
if (ut_dulint_cmp(block->oldest_modification, if (ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero) > 0) { ut_dulint_zero) > 0) {
printf("modif. "); fputs("modif. ", stderr);
} }
printf("LRU pos %lu ", block->LRU_position);
frame = buf_block_get_frame(block); frame = buf_block_get_frame(block);
printf("type %lu ", fil_page_get_type(frame)); fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
printf("index id %lu ", ut_dulint_get_low( block->LRU_position,
btr_page_get_index_id(frame))); fil_page_get_type(frame),
ut_dulint_get_low(btr_page_get_index_id(frame)));
block = UT_LIST_GET_NEXT(LRU, block); block = UT_LIST_GET_NEXT(LRU, block);
len++; if (++len == 10) {
if (len % 10 == 0) { len = 0;
printf("\n"); putc('\n', stderr);
} }
} }
......
...@@ -81,7 +81,8 @@ buf_read_page_low( ...@@ -81,7 +81,8 @@ buf_read_page_low(
log mutex: the read must be handled before other reads log mutex: the read must be handled before other reads
which might incur ibuf operations and thus write to the log */ which might incur ibuf operations and thus write to the log */
printf("Log debug: reading replicate page in sync mode\n"); fputs("Log debug: reading replicate page in sync mode\n",
stderr);
sync = TRUE; sync = TRUE;
} }
...@@ -101,7 +102,8 @@ buf_read_page_low( ...@@ -101,7 +102,8 @@ buf_read_page_low(
if (block != NULL) { if (block != NULL) {
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Posting read request for page %lu, sync %lu\n", fprintf(stderr,
"Posting read request for page %lu, sync %lu\n",
offset, sync); offset, sync);
} }
...@@ -241,8 +243,8 @@ buf_read_ahead_random( ...@@ -241,8 +243,8 @@ buf_read_ahead_random(
os_aio_simulated_wake_handler_threads(); os_aio_simulated_wake_handler_threads();
if (buf_debug_prints && (count > 0)) { if (buf_debug_prints && (count > 0)) {
fprintf(stderr,
printf("Random read-ahead space %lu offset %lu pages %lu\n", "Random read-ahead space %lu offset %lu pages %lu\n",
space, offset, count); space, offset, count);
} }
...@@ -499,7 +501,7 @@ buf_read_ahead_linear( ...@@ -499,7 +501,7 @@ buf_read_ahead_linear(
buf_flush_free_margin(); buf_flush_free_margin();
if (buf_debug_prints && (count > 0)) { if (buf_debug_prints && (count > 0)) {
printf( fprintf(stderr,
"LINEAR read-ahead space %lu offset %lu pages %lu\n", "LINEAR read-ahead space %lu offset %lu pages %lu\n",
space, offset, count); space, offset, count);
} }
...@@ -548,7 +550,8 @@ buf_read_ibuf_merge_pages( ...@@ -548,7 +550,8 @@ buf_read_ibuf_merge_pages(
buf_flush_free_margin(); buf_flush_free_margin();
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Ibuf merge read-ahead space %lu pages %lu\n", fprintf(stderr,
"Ibuf merge read-ahead space %lu pages %lu\n",
space, n_stored); space, n_stored);
} }
} }
...@@ -611,6 +614,7 @@ buf_read_recv_pages( ...@@ -611,6 +614,7 @@ buf_read_recv_pages(
buf_flush_free_margin(); buf_flush_free_margin();
if (buf_debug_prints) { if (buf_debug_prints) {
printf("Recovery applies read-ahead pages %lu\n", n_stored); fprintf(stderr,
"Recovery applies read-ahead pages %lu\n", n_stored);
} }
} }
...@@ -12,7 +12,6 @@ Created 5/30/1994 Heikki Tuuri ...@@ -12,7 +12,6 @@ Created 5/30/1994 Heikki Tuuri
#include "data0data.ic" #include "data0data.ic"
#endif #endif
#include "ut0rnd.h"
#include "rem0rec.h" #include "rem0rec.h"
#include "rem0cmp.h" #include "rem0cmp.h"
#include "page0page.h" #include "page0page.h"
...@@ -22,8 +21,10 @@ Created 5/30/1994 Heikki Tuuri ...@@ -22,8 +21,10 @@ Created 5/30/1994 Heikki Tuuri
byte data_error; /* data pointers of tuple fields are initialized byte data_error; /* data pointers of tuple fields are initialized
to point here for error checking */ to point here for error checking */
#ifdef UNIV_DEBUG
ulint data_dummy; /* this is used to fool the compiler in ulint data_dummy; /* this is used to fool the compiler in
dtuple_validate */ dtuple_validate */
#endif /* UNIV_DEBUG */
/* Some non-inlined functions used in the MySQL interface: */ /* Some non-inlined functions used in the MySQL interface: */
void void
...@@ -210,16 +211,15 @@ dtuple_check_typed_no_assert( ...@@ -210,16 +211,15 @@ dtuple_check_typed_no_assert(
{ {
dfield_t* field; dfield_t* field;
ulint i; ulint i;
char err_buf[1000];
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) { if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: index entry has %lu fields\n", "InnoDB: Error: index entry has %lu fields\n",
dtuple_get_n_fields(tuple)); dtuple_get_n_fields(tuple));
dump:
dtuple_sprintf(err_buf, 900, tuple); fputs("InnoDB: Tuple contents: ", stderr);
fprintf(stderr, dtuple_print(stderr, tuple);
"InnoDB: Tuple contents: %s\n", err_buf); putc('\n', stderr);
return(FALSE); return(FALSE);
} }
...@@ -229,12 +229,7 @@ dtuple_check_typed_no_assert( ...@@ -229,12 +229,7 @@ dtuple_check_typed_no_assert(
field = dtuple_get_nth_field(tuple, i); field = dtuple_get_nth_field(tuple, i);
if (!dfield_check_typed_no_assert(field)) { if (!dfield_check_typed_no_assert(field)) {
goto dump;
dtuple_sprintf(err_buf, 900, tuple);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
return(FALSE);
} }
} }
...@@ -285,6 +280,7 @@ dtuple_check_typed( ...@@ -285,6 +280,7 @@ dtuple_check_typed(
return(TRUE); return(TRUE);
} }
#ifdef UNIV_DEBUG
/************************************************************** /**************************************************************
Validates the consistency of a tuple which must be complete, i.e, Validates the consistency of a tuple which must be complete, i.e,
all fields must have been set. */ all fields must have been set. */
...@@ -332,6 +328,7 @@ dtuple_validate( ...@@ -332,6 +328,7 @@ dtuple_validate(
return(TRUE); return(TRUE);
} }
#endif /* UNIV_DEBUG */
/***************************************************************** /*****************************************************************
Pretty prints a dfield value according to its data type. */ Pretty prints a dfield value according to its data type. */
...@@ -350,7 +347,7 @@ dfield_print( ...@@ -350,7 +347,7 @@ dfield_print(
data = dfield_get_data(dfield); data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) { if (len == UNIV_SQL_NULL) {
printf("NULL"); fputs("NULL", stderr);
return; return;
} }
...@@ -360,18 +357,12 @@ dfield_print( ...@@ -360,18 +357,12 @@ dfield_print(
if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) { if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) {
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
int c = *data++;
if (isprint((char)(*data))) { putc(isprint(c) ? c : ' ', stderr);
printf("%c", (char)*data);
} else {
printf(" ");
}
data++;
} }
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
ut_a(len == 4); /* only works for 32-bit integers */ ut_a(len == 4); /* only works for 32-bit integers */
printf("%i", (int)mach_read_from_4(data)); fprintf(stderr, "%d", (int)mach_read_from_4(data));
} else { } else {
ut_error; ut_error;
} }
...@@ -396,7 +387,7 @@ dfield_print_also_hex( ...@@ -396,7 +387,7 @@ dfield_print_also_hex(
data = dfield_get_data(dfield); data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) { if (len == UNIV_SQL_NULL) {
printf("NULL"); fputs("NULL", stderr);
return; return;
} }
...@@ -408,15 +399,12 @@ dfield_print_also_hex( ...@@ -408,15 +399,12 @@ dfield_print_also_hex(
print_also_hex = FALSE; print_also_hex = FALSE;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
int c = *data++;
if (isprint((char)(*data))) { if (!isprint(c)) {
printf("%c", (char)*data);
} else {
print_also_hex = TRUE; print_also_hex = TRUE;
printf(" "); c = ' ';
} }
putc(c, stderr);
data++;
} }
if (!print_also_hex) { if (!print_also_hex) {
...@@ -424,18 +412,18 @@ dfield_print_also_hex( ...@@ -424,18 +412,18 @@ dfield_print_also_hex(
return; return;
} }
printf(" Hex: "); fputs(" Hex: ", stderr);
data = dfield_get_data(dfield); data = dfield_get_data(dfield);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
printf("%02lx", (ulint)*data); fprintf(stderr, "%02lx", (ulint)*data);
data++; data++;
} }
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
ut_a(len == 4); /* inly works for 32-bit integers */ ut_a(len == 4); /* only works for 32-bit integers */
printf("%i", (int)mach_read_from_4(data)); fprintf(stderr, "%d", (int)mach_read_from_4(data));
} else { } else {
ut_error; ut_error;
} }
...@@ -447,6 +435,7 @@ The following function prints the contents of a tuple. */ ...@@ -447,6 +435,7 @@ The following function prints the contents of a tuple. */
void void
dtuple_print( dtuple_print(
/*=========*/ /*=========*/
FILE* f, /* in: output stream */
dtuple_t* tuple) /* in: tuple */ dtuple_t* tuple) /* in: tuple */
{ {
dfield_t* field; dfield_t* field;
...@@ -455,73 +444,24 @@ dtuple_print( ...@@ -455,73 +444,24 @@ dtuple_print(
n_fields = dtuple_get_n_fields(tuple); n_fields = dtuple_get_n_fields(tuple);
printf("DATA TUPLE: %lu fields;\n", n_fields); fprintf(f, "DATA TUPLE: %lu fields;\n", n_fields);
for (i = 0; i < n_fields; i++) {
printf(" %lu:", i);
field = dtuple_get_nth_field(tuple, i);
if (field->len != UNIV_SQL_NULL) {
ut_print_buf(field->data, field->len);
} else {
printf(" SQL NULL");
}
printf(";");
}
printf("\n");
dtuple_validate(tuple);
}
/**************************************************************
The following function prints the contents of a tuple to a buffer. */
ulint
dtuple_sprintf(
/*===========*/
/* out: printed length in bytes */
char* buf, /* in: print buffer */
ulint buf_len,/* in: buf length in bytes */
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
ulint n_fields;
ulint len;
ulint i;
len = 0;
n_fields = dtuple_get_n_fields(tuple);
for (i = 0; i < n_fields; i++) { for (i = 0; i < n_fields; i++) {
if (len + 30 > buf_len) { fprintf(f, " %lu:", i);
return(len);
}
len += sprintf(buf + len, " %lu:", i);
field = dtuple_get_nth_field(tuple, i); field = dtuple_get_nth_field(tuple, i);
if (field->len != UNIV_SQL_NULL) { if (field->len != UNIV_SQL_NULL) {
if (5 * field->len + len + 30 > buf_len) { ut_print_buf(f, field->data, field->len);
return(len);
}
len += ut_sprintf_buf(buf + len, field->data,
field->len);
} else { } else {
len += sprintf(buf + len, " SQL NULL"); fputs(" SQL NULL", f);
} }
len += sprintf(buf + len, ";"); putc(';', f);
} }
return(len); putc('\n', f);
ut_ad(dtuple_validate(tuple));
} }
/****************************************************************** /******************************************************************
...@@ -555,7 +495,6 @@ dtuple_convert_big_rec( ...@@ -555,7 +495,6 @@ dtuple_convert_big_rec(
ibool is_externally_stored; ibool is_externally_stored;
ulint i; ulint i;
ulint j; ulint j;
char err_buf[1000];
ut_a(dtuple_check_typed_no_assert(entry)); ut_a(dtuple_check_typed_no_assert(entry));
...@@ -564,10 +503,9 @@ dtuple_convert_big_rec( ...@@ -564,10 +503,9 @@ dtuple_convert_big_rec(
if (size > 1000000000) { if (size > 1000000000) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: tuple size very big: %lu\n", size); "InnoDB: Warning: tuple size very big: %lu\n", size);
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_sprintf(err_buf, 900, entry); dtuple_print(stderr, entry);
fprintf(stderr, putc('\n', stderr);
"InnoDB: Tuple contents: %s\n", err_buf);
} }
heap = mem_heap_create(size + dtuple_get_n_fields(entry) heap = mem_heap_create(size + dtuple_get_n_fields(entry)
......
...@@ -51,19 +51,19 @@ dtype_print( ...@@ -51,19 +51,19 @@ dtype_print(
mtype = type->mtype; mtype = type->mtype;
prtype = type->prtype; prtype = type->prtype;
if (mtype == DATA_VARCHAR) { if (mtype == DATA_VARCHAR) {
printf("DATA_VARCHAR"); fputs("DATA_VARCHAR", stderr);
} else if (mtype == DATA_CHAR) { } else if (mtype == DATA_CHAR) {
printf("DATA_CHAR"); fputs("DATA_CHAR", stderr);
} else if (mtype == DATA_BINARY) { } else if (mtype == DATA_BINARY) {
printf("DATA_BINARY"); fputs("DATA_BINARY", stderr);
} else if (mtype == DATA_INT) { } else if (mtype == DATA_INT) {
printf("DATA_INT"); fputs("DATA_INT", stderr);
} else if (mtype == DATA_MYSQL) { } else if (mtype == DATA_MYSQL) {
printf("DATA_MYSQL"); fputs("DATA_MYSQL", stderr);
} else if (mtype == DATA_SYS) { } else if (mtype == DATA_SYS) {
printf("DATA_SYS"); fputs("DATA_SYS", stderr);
} else { } else {
printf("type %lu", mtype); fprintf(stderr, "type %lu", mtype);
} }
len = type->len; len = type->len;
...@@ -71,24 +71,24 @@ dtype_print( ...@@ -71,24 +71,24 @@ dtype_print(
if ((type->mtype == DATA_SYS) if ((type->mtype == DATA_SYS)
|| (type->mtype == DATA_VARCHAR) || (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) { || (type->mtype == DATA_CHAR)) {
printf(" "); putc(' ', stderr);
if (prtype == DATA_ROW_ID) { if (prtype == DATA_ROW_ID) {
printf("DATA_ROW_ID"); fputs("DATA_ROW_ID", stderr);
len = DATA_ROW_ID_LEN; len = DATA_ROW_ID_LEN;
} else if (prtype == DATA_ROLL_PTR) { } else if (prtype == DATA_ROLL_PTR) {
printf("DATA_ROLL_PTR"); fputs("DATA_ROLL_PTR", stderr);
len = DATA_ROLL_PTR_LEN; len = DATA_ROLL_PTR_LEN;
} else if (prtype == DATA_TRX_ID) { } else if (prtype == DATA_TRX_ID) {
printf("DATA_TRX_ID"); fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN; len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) { } else if (prtype == DATA_MIX_ID) {
printf("DATA_MIX_ID"); fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) { } else if (prtype == DATA_ENGLISH) {
printf("DATA_ENGLISH"); fputs("DATA_ENGLISH", stderr);
} else { } else {
printf("prtype %lu", mtype); fprintf(stderr, "prtype %lu", mtype);
} }
} }
printf(" len %lu prec %lu", len, type->prec); fprintf(stderr, " len %lu prec %lu", len, type->prec);
} }
...@@ -71,7 +71,8 @@ dict_hdr_get_new_id( ...@@ -71,7 +71,8 @@ dict_hdr_get_new_id(
compile wrong */ compile wrong */
if (0 == ut_dulint_cmp(id, ut_dulint_max)) { if (0 == ut_dulint_cmp(id, ut_dulint_max)) {
printf("Max id\n"); /* TO DO: remove this code, or make it conditional */
ut_dbg_null_ptr = 0;
} }
id = ut_dulint_add(id, 1); id = ut_dulint_add(id, 1);
......
...@@ -25,11 +25,6 @@ Created 1/8/1996 Heikki Tuuri ...@@ -25,11 +25,6 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0roll.h" #include "trx0roll.h"
#include "usr0sess.h" #include "usr0sess.h"
/* Maximum lengths of identifiers in MySQL, in bytes */
#define MAX_TABLE_NAME_LEN 64
#define MAX_COLUMN_NAME_LEN 64
#define MAX_IDENTIFIER_LEN 255
/********************************************************************* /*********************************************************************
Based on a table object, this function builds the entry to be inserted Based on a table object, this function builds the entry to be inserted
in the SYS_TABLES system table. */ in the SYS_TABLES system table. */
...@@ -1105,7 +1100,7 @@ dict_create_add_foreigns_to_dictionary( ...@@ -1105,7 +1100,7 @@ dict_create_add_foreigns_to_dictionary(
ulint number = start_id + 1; ulint number = start_id + 1;
ulint len; ulint len;
ulint error; ulint error;
char* ebuf = dict_foreign_err_buf; FILE* ef = dict_foreign_err_file;
ulint i; ulint i;
char* sql; char* sql;
char* sqlend; char* sqlend;
...@@ -1223,14 +1218,17 @@ loop: ...@@ -1223,14 +1218,17 @@ loop:
if (error == DB_DUPLICATE_KEY) { if (error == DB_DUPLICATE_KEY) {
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf); rewind(ef);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN ut_print_timestamp(ef);
- MAX_TABLE_NAME_LEN - MAX_IDENTIFIER_LEN - 201); fputs(" Error in foreign key constraint creation for table ",
sprintf(ebuf + strlen(ebuf), ef);
" Error in foreign key constraint creation for table %s.\n" ut_print_name(ef, table->name);
"A foreign key constraint of name %s\n" fputs(".\nA foreign key constraint of name ", ef);
"already exists (note that internally InnoDB adds 'databasename/'\n" ut_print_name(ef, foreign->id);
"in front of the user-defined constraint name).\n", table->name, foreign->id); fputs("\nalready exists."
" (Note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n",
ef);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
...@@ -1243,12 +1241,12 @@ loop: ...@@ -1243,12 +1241,12 @@ loop:
"InnoDB: internal error number %lu\n", error); "InnoDB: internal error number %lu\n", error);
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf); ut_print_timestamp(ef);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN fputs(" Internal error in foreign key constraint creation"
- MAX_TABLE_NAME_LEN - 124); " for table ", ef);
sprintf(ebuf + strlen(ebuf), ut_print_name(ef, table->name);
" Internal error in foreign key constraint creation for table %s.\n" fputs(".\n"
"See the MySQL .err log in the datadir for more information.\n", table->name); "See the MySQL .err log in the datadir for more information.\n", ef);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
return(error); return(error);
......
This diff is collapsed.
...@@ -162,8 +162,9 @@ loop: ...@@ -162,8 +162,9 @@ loop:
mem_free(table_name); mem_free(table_name);
if (table == NULL) { if (table == NULL) {
fprintf(stderr, "InnoDB: Failed to load table %s\n", fputs("InnoDB: Failed to load table ", stderr);
table_name); ut_print_namel(stderr, field, len);
putc('\n', stderr);
} else { } else {
/* The table definition was corrupt if there /* The table definition was corrupt if there
is no index */ is no index */
...@@ -279,6 +280,27 @@ dict_load_columns( ...@@ -279,6 +280,27 @@ dict_load_columns(
mtr_commit(&mtr); mtr_commit(&mtr);
} }
/************************************************************************
Report that an index field or index for a table has been delete marked. */
static
void
dict_load_report_deleted_index(
char* name, /* in: table name */
ulint field) /* in: index field, or ULINT_UNDEFINED */
{
fputs("InnoDB: Error: data dictionary entry"
" for table ", stderr);
ut_print_name(stderr, name);
fputs(" is corrupt!\n", stderr);
if (field != ULINT_UNDEFINED) {
fprintf(stderr,
"InnoDB: Index field %lu is delete marked.\n", field);
}
else {
fputs("InnoDB: An index is delete marked.\n", stderr);
}
}
/************************************************************************ /************************************************************************
Loads definitions for index fields. */ Loads definitions for index fields. */
static static
...@@ -331,10 +353,7 @@ dict_load_fields( ...@@ -331,10 +353,7 @@ dict_load_fields(
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr)); ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
if (rec_get_deleted_flag(rec)) { if (rec_get_deleted_flag(rec)) {
fprintf(stderr, dict_load_report_deleted_index(table->name, i);
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n"
"InnoDB: An index field is delete marked.\n",
table->name);
} }
field = rec_get_nth_field(rec, 0, &len); field = rec_get_nth_field(rec, 0, &len);
...@@ -457,10 +476,8 @@ dict_load_indexes( ...@@ -457,10 +476,8 @@ dict_load_indexes(
} }
if (rec_get_deleted_flag(rec)) { if (rec_get_deleted_flag(rec)) {
fprintf(stderr, dict_load_report_deleted_index(table->name,
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n" ULINT_UNDEFINED);
"InnoDB: An index is delete marked.\n",
table->name);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -499,10 +516,12 @@ dict_load_indexes( ...@@ -499,10 +516,12 @@ dict_load_indexes(
if (page_no == FIL_NULL) { if (page_no == FIL_NULL) {
fprintf(stderr, fputs("InnoDB: Error: trying to load index ", stderr);
"InnoDB: Error: trying to load index %s for table %s\n" ut_print_name(stderr, name_buf);
"InnoDB: but the index tree has been freed!\n", fputs(" for table ", stderr);
name_buf, table->name); ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the index tree has been freed!\n", stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -513,10 +532,12 @@ dict_load_indexes( ...@@ -513,10 +532,12 @@ dict_load_indexes(
if ((type & DICT_CLUSTERED) == 0 if ((type & DICT_CLUSTERED) == 0
&& NULL == dict_table_get_first_index(table)) { && NULL == dict_table_get_first_index(table)) {
fprintf(stderr, fputs("InnoDB: Error: trying to load index ", stderr);
"InnoDB: Error: trying to load index %s for table %s\n" ut_print_namel(stderr, name_buf, name_len);
"InnoDB: but the first index was not clustered!\n", fputs(" for table ", stderr);
name_buf, table->name); ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the first index is not clustered!\n", stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -947,8 +968,10 @@ dict_load_foreign( ...@@ -947,8 +968,10 @@ dict_load_foreign(
|| rec_get_deleted_flag(rec)) { || rec_get_deleted_flag(rec)) {
/* Not found */ /* Not found */
fprintf(stderr, fputs("InnoDB: Error A: cannot load foreign constraint ",
"InnoDB: Error A: cannot load foreign constraint %s\n", id); stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -962,8 +985,10 @@ dict_load_foreign( ...@@ -962,8 +985,10 @@ dict_load_foreign(
/* Check if the id in record is the searched one */ /* Check if the id in record is the searched one */
if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) { if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
fprintf(stderr, fputs("InnoDB: Error B: cannot load foreign constraint ",
"InnoDB: Error B: cannot load foreign constraint %s\n", id); stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
......
...@@ -311,12 +311,13 @@ eval_predefined_2( ...@@ -311,12 +311,13 @@ eval_predefined_2(
arg = que_node_get_next(arg); arg = que_node_get_next(arg);
} }
printf("\n"); putc('\n', stderr);
} else if (func == PARS_ASSERT_TOKEN) { } else if (func == PARS_ASSERT_TOKEN) {
if (!eval_node_get_ibool_val(arg1)) { if (!eval_node_get_ibool_val(arg1)) {
printf("SQL assertion fails in a stored procedure!\n"); fputs("SQL assertion fails in a stored procedure!\n",
stderr);
} }
ut_a(eval_node_get_ibool_val(arg1)); ut_a(eval_node_get_ibool_val(arg1));
......
...@@ -1408,7 +1408,8 @@ fil_flush( ...@@ -1408,7 +1408,8 @@ fil_flush(
will not crash or trap even if we pass a handle will not crash or trap even if we pass a handle
to a closed file below in os_file_flush! */ to a closed file below in os_file_flush! */
/* printf("Flushing to file %s\n", node->name); */ /* fprintf(stderr, "Flushing to file %s\n",
node->name); */
os_file_flush(file); os_file_flush(file);
......
...@@ -1273,7 +1273,7 @@ fsp_alloc_free_page( ...@@ -1273,7 +1273,7 @@ fsp_alloc_free_page(
hint % FSP_EXTENT_SIZE, mtr); hint % FSP_EXTENT_SIZE, mtr);
if (free == ULINT_UNDEFINED) { if (free == ULINT_UNDEFINED) {
ut_print_buf(((byte*)descr) - 500, 1000); ut_print_buf(stderr, ((byte*)descr) - 500, 1000);
ut_error; ut_error;
} }
...@@ -1332,11 +1332,10 @@ fsp_free_page( ...@@ -1332,11 +1332,10 @@ fsp_free_page(
xdes_t* descr; xdes_t* descr;
ulint state; ulint state;
ulint frag_n_used; ulint frag_n_used;
char buf[1000];
ut_ad(mtr); ut_ad(mtr);
/* printf("Freeing page %lu in space %lu\n", page, space); */ /* fprintf(stderr, "Freeing page %lu in space %lu\n", page, space); */
header = fsp_get_space_header(space, mtr); header = fsp_get_space_header(space, mtr);
...@@ -1348,9 +1347,9 @@ fsp_free_page( ...@@ -1348,9 +1347,9 @@ fsp_free_page(
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: File space extent descriptor of page %lu has state %lu\n", "InnoDB: Error: File space extent descriptor of page %lu has state %lu\n",
page, state); page, state);
ut_sprintf_buf(buf, ((byte*)descr) - 50, 200); fputs("InnoDB: Dump of descriptor: ", stderr);
ut_print_buf(stderr, ((byte*)descr) - 50, 200);
fprintf(stderr, "InnoDB: Dump of descriptor: %s\n", buf); putc('\n', stderr);
if (state == XDES_FREE) { if (state == XDES_FREE) {
/* We put here some fault tolerance: if the page /* We put here some fault tolerance: if the page
...@@ -1362,14 +1361,12 @@ fsp_free_page( ...@@ -1362,14 +1361,12 @@ fsp_free_page(
ut_error; ut_error;
} }
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr) if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
== TRUE) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: File space extent descriptor of page %lu says it is free\n", "InnoDB: Error: File space extent descriptor of page %lu says it is free\n"
page); "InnoDB: Dump of descriptor: ", page);
ut_sprintf_buf(buf, ((byte*)descr) - 50, 200); ut_print_buf(stderr, ((byte*)descr) - 50, 200);
putc('\n', stderr);
fprintf(stderr, "InnoDB: Dump of descriptor: %s\n", buf);
/* We put here some fault tolerance: if the page /* We put here some fault tolerance: if the page
is already free, return without doing anything! */ is already free, return without doing anything! */
...@@ -1427,7 +1424,7 @@ fsp_free_extent( ...@@ -1427,7 +1424,7 @@ fsp_free_extent(
if (xdes_get_state(descr, mtr) == XDES_FREE) { if (xdes_get_state(descr, mtr) == XDES_FREE) {
ut_print_buf(((byte*)descr) - 500, 1000); ut_print_buf(stderr, (byte*)descr - 500, 1000);
ut_error; ut_error;
} }
...@@ -2672,7 +2669,6 @@ fseg_free_page_low( ...@@ -2672,7 +2669,6 @@ fseg_free_page_low(
ulint not_full_n_used; ulint not_full_n_used;
ulint state; ulint state;
ulint i; ulint i;
char errbuf[200];
#ifdef __WIN__ #ifdef __WIN__
dulint desm; dulint desm;
...@@ -2692,22 +2688,22 @@ fseg_free_page_low( ...@@ -2692,22 +2688,22 @@ fseg_free_page_low(
descr = xdes_get_descriptor(space, page, mtr); descr = xdes_get_descriptor(space, page, mtr);
ut_a(descr); ut_a(descr);
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr) if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
!= FALSE) { fputs("InnoDB: Dump of the tablespace extent descriptor: ",
ut_sprintf_buf(errbuf, descr, 40); stderr);
fprintf(stderr, ut_print_buf(stderr, descr, 40);
"InnoDB: Dump of the tablespace extent descriptor: %s\n", errbuf);
fprintf(stderr, fprintf(stderr, "\n"
"InnoDB: Serious error! InnoDB is trying to free page %lu\n" "InnoDB: Serious error! InnoDB is trying to free page %lu\n"
"InnoDB: though it is already marked as free in the tablespace!\n" "InnoDB: though it is already marked as free in the tablespace!\n"
"InnoDB: The tablespace free space info is corrupt.\n" "InnoDB: The tablespace free space info is corrupt.\n"
"InnoDB: You may need to dump your InnoDB tables and recreate the whole\n" "InnoDB: You may need to dump your InnoDB tables and recreate the whole\n"
"InnoDB: database!\n", page); "InnoDB: database!\n", page);
crash:
fprintf(stderr, fputs(
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n" "InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n"); "InnoDB: of http://www.innodb.com/ibman.php about forcing recovery.\n",
stderr);
ut_error; ut_error;
} }
...@@ -2751,12 +2747,12 @@ fseg_free_page_low( ...@@ -2751,12 +2747,12 @@ fseg_free_page_low(
mtr_read_dulint(descr + XDES_ID, mtr), mtr_read_dulint(descr + XDES_ID, mtr),
mtr_read_dulint(seg_inode + FSEG_ID, mtr))) { mtr_read_dulint(seg_inode + FSEG_ID, mtr))) {
ut_sprintf_buf(errbuf, descr, 40); fputs("InnoDB: Dump of the tablespace extent descriptor: ",
fprintf(stderr, stderr);
"InnoDB: Dump of the tablespace extent descriptor: %s\n", errbuf); ut_print_buf(stderr, descr, 40);
ut_sprintf_buf(errbuf, seg_inode, 40); fputs("\nInnoDB: Dump of the segment inode: ", stderr);
fprintf(stderr, ut_print_buf(stderr, seg_inode, 40);
"InnoDB: Dump of the segment inode: %s\n", errbuf); putc('\n', stderr);
#ifndef __WIN__ #ifndef __WIN__
...@@ -2794,11 +2790,7 @@ fseg_free_page_low( ...@@ -2794,11 +2790,7 @@ fseg_free_page_low(
ut_dulint_get_low(segm)); ut_dulint_get_low(segm));
#endif #endif
goto crash;
fprintf(stderr,
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n");
ut_error;
} }
not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
...@@ -3311,12 +3303,11 @@ fseg_print_low( ...@@ -3311,12 +3303,11 @@ fseg_print_low(
n_not_full = flst_get_len(inode + FSEG_NOT_FULL, mtr); n_not_full = flst_get_len(inode + FSEG_NOT_FULL, mtr);
n_full = flst_get_len(inode + FSEG_FULL, mtr); n_full = flst_get_len(inode + FSEG_FULL, mtr);
printf( fprintf(stderr,
"SEGMENT id %lu %lu space %lu; page %lu; res %lu used %lu; full ext %lu\n", "SEGMENT id %lu %lu space %lu; page %lu; res %lu used %lu; full ext %lu\n"
"fragm pages %lu; free extents %lu; not full extents %lu: pages %lu\n",
seg_id_high, seg_id_low, space, page_no, reserved, used, seg_id_high, seg_id_low, space, page_no, reserved, used,
n_full); n_full,
printf(
"fragm pages %lu; free extents %lu; not full extents %lu: pages %lu\n",
n_frag, n_free, n_not_full, n_used); n_frag, n_free, n_not_full, n_used);
} }
...@@ -3620,15 +3611,15 @@ fsp_print( ...@@ -3620,15 +3611,15 @@ fsp_print(
seg_id_low = ut_dulint_get_low(d_var); seg_id_low = ut_dulint_get_low(d_var);
seg_id_high = ut_dulint_get_high(d_var); seg_id_high = ut_dulint_get_high(d_var);
printf("FILE SPACE INFO: id %lu\n", space); fprintf(stderr,
"FILE SPACE INFO: id %lu\n"
printf("size %lu, free limit %lu, free extents %lu\n", "size %lu, free limit %lu, free extents %lu\n"
size, free_limit, n_free); "not full frag extents %lu: used pages %lu, full frag extents %lu\n"
printf( "first seg id not used %lu %lu\n",
"not full frag extents %lu: used pages %lu, full frag extents %lu\n", space,
n_free_frag, frag_n_used, n_full_frag); size, free_limit, n_free,
n_free_frag, frag_n_used, n_full_frag,
printf("first seg id not used %lu %lu\n", seg_id_high, seg_id_low); seg_id_high, seg_id_low);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -3707,5 +3698,5 @@ fsp_print( ...@@ -3707,5 +3698,5 @@ fsp_print(
mtr_commit(&mtr2); mtr_commit(&mtr2);
printf("NUMBER of file segments: %lu\n", n_segs); fprintf(stderr, "NUMBER of file segments: %lu\n", n_segs);
} }
...@@ -509,8 +509,9 @@ flst_print( ...@@ -509,8 +509,9 @@ flst_print(
len = flst_get_len(base, mtr); len = flst_get_len(base, mtr);
printf("FILE-BASED LIST:\n"); fprintf(stderr,
printf("Base node in space %lu page %lu byte offset %lu; len %lu\n", "FILE-BASED LIST:\n"
"Base node in space %lu page %lu byte offset %lu; len %lu\n",
buf_frame_get_space_id(frame), buf_frame_get_page_no(frame), buf_frame_get_space_id(frame), buf_frame_get_page_no(frame),
(ulint) (base - frame), len); (ulint) (base - frame), len);
} }
...@@ -264,8 +264,7 @@ Prints info of a hash table. */ ...@@ -264,8 +264,7 @@ Prints info of a hash table. */
void void
ha_print_info( ha_print_info(
/*==========*/ /*==========*/
char* buf, /* in/out: buffer where to print */ FILE* file, /* in: file where to print */
char* buf_end,/* in: buffer end */
hash_table_t* table) /* in: hash table */ hash_table_t* table) /* in: hash table */
{ {
hash_cell_t* cell; hash_cell_t* cell;
...@@ -273,10 +272,6 @@ ha_print_info( ...@@ -273,10 +272,6 @@ ha_print_info(
ulint n_bufs; ulint n_bufs;
ulint i; ulint i;
if (buf_end - buf < 200) {
return;
}
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);
...@@ -287,8 +282,9 @@ ha_print_info( ...@@ -287,8 +282,9 @@ ha_print_info(
} }
} }
buf += sprintf(buf, fprintf(file,
"Hash table size %lu, used cells %lu", hash_get_n_cells(table), cells); "Hash table size %lu, used cells %lu",
hash_get_n_cells(table), cells);
if (table->heaps == NULL && table->heap != NULL) { if (table->heaps == NULL && table->heap != NULL) {
...@@ -301,6 +297,6 @@ ha_print_info( ...@@ -301,6 +297,6 @@ ha_print_info(
n_bufs++; n_bufs++;
} }
buf += sprintf(buf, ", node heap has %lu buffer(s)\n", n_bufs); fprintf(file, ", node heap has %lu buffer(s)\n", n_bufs);
} }
} }
...@@ -409,7 +409,7 @@ ibuf_data_sizes_update( ...@@ -409,7 +409,7 @@ ibuf_data_sizes_update(
ibuf->size = ibuf->size + data->size - old_size; ibuf->size = ibuf->size + data->size - old_size;
/* printf("ibuf size %lu, space ibuf size %lu\n", ibuf->size, /* fprintf(stderr, "ibuf size %lu, space ibuf size %lu\n", ibuf->size,
data->size); */ data->size); */
} }
...@@ -438,7 +438,7 @@ ibuf_data_init_for_space( ...@@ -438,7 +438,7 @@ ibuf_data_init_for_space(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (space % 2 == 1) { if (space % 2 == 1) {
printf("No ibuf op in replicate space\n"); fputs("No ibuf op in replicate space\n", stderr);
return(NULL); return(NULL);
} }
...@@ -728,7 +728,8 @@ ibuf_set_free_bits_low( ...@@ -728,7 +728,8 @@ ibuf_set_free_bits_low(
bitmap_page = ibuf_bitmap_get_map_page(buf_frame_get_space_id(page), bitmap_page = ibuf_bitmap_get_map_page(buf_frame_get_space_id(page),
buf_frame_get_page_no(page), mtr); buf_frame_get_page_no(page), mtr);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
/* printf("Setting page no %lu free bits to %lu should be %lu\n", /* fprintf(stderr,
"Setting page no %lu free bits to %lu should be %lu\n",
buf_frame_get_page_no(page), val, buf_frame_get_page_no(page), val,
ibuf_index_page_calc_free(page)); */ ibuf_index_page_calc_free(page)); */
...@@ -782,7 +783,7 @@ ibuf_set_free_bits( ...@@ -782,7 +783,7 @@ ibuf_set_free_bits(
buf_frame_get_page_no(page), buf_frame_get_page_no(page),
IBUF_BITMAP_FREE, &mtr); IBUF_BITMAP_FREE, &mtr);
if (old_val != max_val) { if (old_val != max_val) {
/* printf( /* fprintf(stderr,
"Ibuf: page %lu old val %lu max val %lu\n", "Ibuf: page %lu old val %lu max val %lu\n",
buf_frame_get_page_no(page), old_val, max_val); */ buf_frame_get_page_no(page), old_val, max_val); */
} }
...@@ -791,7 +792,7 @@ ibuf_set_free_bits( ...@@ -791,7 +792,7 @@ ibuf_set_free_bits(
#endif #endif
} }
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
/* printf("Setting page no %lu free bits to %lu should be %lu\n", /* fprintf(stderr, "Setting page no %lu free bits to %lu should be %lu\n",
buf_frame_get_page_no(page), val, buf_frame_get_page_no(page), val,
ibuf_index_page_calc_free(page)); */ ibuf_index_page_calc_free(page)); */
...@@ -970,7 +971,7 @@ ibuf_page_low( ...@@ -970,7 +971,7 @@ ibuf_page_low(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (space % 2 != 0) { if (space % 2 != 0) {
printf("No ibuf in a replicate space\n"); fputs("No ibuf in a replicate space\n", stderr);
return(FALSE); return(FALSE);
} }
...@@ -1481,7 +1482,8 @@ ibuf_free_excess_pages( ...@@ -1481,7 +1482,8 @@ ibuf_free_excess_pages(
/* Not yet initialized */ /* Not yet initialized */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/*printf("Ibuf for space %lu not yet initialized\n", space); */ /*fprintf(stderr,
"Ibuf for space %lu not yet initialized\n", space); */
#endif #endif
return; return;
...@@ -1645,7 +1647,7 @@ ibuf_get_merge_page_nos( ...@@ -1645,7 +1647,7 @@ ibuf_get_merge_page_nos(
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
ut_a(*n_stored <= IBUF_MAX_N_PAGES_MERGED); ut_a(*n_stored <= IBUF_MAX_N_PAGES_MERGED);
#endif #endif
/* printf("Ibuf merge batch %lu pages %lu volume\n", *n_stored, /* fprintf(stderr, "Ibuf merge batch %lu pages %lu volume\n", *n_stored,
sum_volumes); */ sum_volumes); */
return(sum_volumes); return(sum_volumes);
} }
...@@ -1751,8 +1753,8 @@ loop: ...@@ -1751,8 +1753,8 @@ loop:
page_nos, &n_stored); page_nos, &n_stored);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
/* printf("Ibuf contract sync %lu pages %lu volume %lu\n", sync, /* fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
n_stored, sum_sizes); */ sync, n_stored, sum_sizes); */
#endif #endif
ibuf_exit(); ibuf_exit();
...@@ -2074,7 +2076,7 @@ ibuf_insert_low( ...@@ -2074,7 +2076,7 @@ ibuf_insert_low(
mutex_exit(&ibuf_mutex); mutex_exit(&ibuf_mutex);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
printf("Ibuf too big\n"); fputs("Ibuf too big\n", stderr);
#endif #endif
/* Use synchronous contract (== TRUE) */ /* Use synchronous contract (== TRUE) */
ibuf_contract(TRUE); ibuf_contract(TRUE);
...@@ -2302,8 +2304,8 @@ ibuf_insert( ...@@ -2302,8 +2304,8 @@ ibuf_insert(
if (err == DB_SUCCESS) { if (err == DB_SUCCESS) {
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
/* printf("Ibuf insert for page no %lu of index %s\n", page_no, /* fprintf(stderr, "Ibuf insert for page no %lu of index %s\n",
index->name); */ page_no, index->name); */
#endif #endif
return(TRUE); return(TRUE);
...@@ -2331,7 +2333,6 @@ ibuf_insert_to_index_page( ...@@ -2331,7 +2333,6 @@ ibuf_insert_to_index_page(
rec_t* rec; rec_t* rec;
page_t* bitmap_page; page_t* bitmap_page;
ulint old_bits; ulint old_bits;
char errbuf[1000];
ut_ad(ibuf_inside()); ut_ad(ibuf_inside());
ut_ad(dtuple_check_typed(entry)); ut_ad(dtuple_check_typed(entry));
...@@ -2361,16 +2362,13 @@ ibuf_insert_to_index_page( ...@@ -2361,16 +2362,13 @@ ibuf_insert_to_index_page(
"InnoDB: Error: Insert buffer insert fails; page free %lu, dtuple size %lu\n", "InnoDB: Error: Insert buffer insert fails; page free %lu, dtuple size %lu\n",
page_get_max_insert_size(page, 1), page_get_max_insert_size(page, 1),
rec_get_converted_size(entry)); rec_get_converted_size(entry));
fputs("InnoDB: Cannot insert index record ",
dtuple_sprintf(errbuf, 900, entry); stderr);
dtuple_print(stderr, entry);
fprintf(stderr, fputs(
"InnoDB: Cannot insert index record %s\n", errbuf); "\nInnoDB: The table where where this index record belongs\n"
fprintf(stderr,
"InnoDB: The table where where this index record belongs\n"
"InnoDB: is now probably corrupt. Please run CHECK TABLE on\n" "InnoDB: is now probably corrupt. Please run CHECK TABLE on\n"
"InnoDB: that table.\n"); "InnoDB: that table.\n", stderr);
bitmap_page = ibuf_bitmap_get_map_page( bitmap_page = ibuf_bitmap_get_map_page(
buf_frame_get_space_id(page), buf_frame_get_space_id(page),
...@@ -2384,8 +2382,8 @@ ibuf_insert_to_index_page( ...@@ -2384,8 +2382,8 @@ ibuf_insert_to_index_page(
fprintf(stderr, "Bitmap bits %lu\n", old_bits); fprintf(stderr, "Bitmap bits %lu\n", old_bits);
fprintf(stderr, fputs(
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n"); "InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n", stderr);
} }
} }
...@@ -2443,22 +2441,21 @@ ibuf_delete_rec( ...@@ -2443,22 +2441,21 @@ ibuf_delete_rec(
if (!success) { if (!success) {
fprintf(stderr, fprintf(stderr,
"InnoDB: ERROR: Send the output to heikki.tuuri@innodb.com\n"); "InnoDB: ERROR: Send the output to mysql@lists.mysql.com\n"
fprintf(stderr, "InnoDB: ibuf cursor restoration fails!\n"); "InnoDB: ibuf cursor restoration fails!\n"
fprintf(stderr, "InnoDB: ibuf record inserted to page %lu\n", "InnoDB: ibuf record inserted to page %lu\n", page_no);
page_no);
fflush(stderr); fflush(stderr);
rec_print(btr_pcur_get_rec(pcur)); rec_print(stderr, btr_pcur_get_rec(pcur));
rec_print(pcur->old_rec); rec_print(stderr, pcur->old_rec);
dtuple_print(search_tuple); dtuple_print(stderr, search_tuple);
rec_print(page_rec_get_next(btr_pcur_get_rec(pcur))); rec_print(stderr, page_rec_get_next(btr_pcur_get_rec(pcur)));
fflush(stdout); fflush(stderr);
mtr_commit(mtr); mtr_commit(mtr);
fprintf(stderr, "InnoDB: Validating insert buffer tree:\n"); fputs("InnoDB: Validating insert buffer tree:\n", stderr);
ut_a(btr_validate_tree(ibuf_data->index->tree)); ut_a(btr_validate_tree(ibuf_data->index->tree));
fprintf(stderr, "InnoDB: ibuf tree ok\n"); fprintf(stderr, "InnoDB: ibuf tree ok\n");
...@@ -2519,7 +2516,6 @@ ibuf_merge_or_delete_for_page( ...@@ -2519,7 +2516,6 @@ ibuf_merge_or_delete_for_page(
#endif #endif
ibool corruption_noticed = FALSE; ibool corruption_noticed = FALSE;
mtr_t mtr; mtr_t mtr;
char err_buf[500];
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
...@@ -2529,7 +2525,7 @@ ibuf_merge_or_delete_for_page( ...@@ -2529,7 +2525,7 @@ ibuf_merge_or_delete_for_page(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (space % 2 != 0) { if (space % 2 != 0) {
printf("No ibuf operation in a replicate space\n"); fputs("No ibuf operation in a replicate space\n", stderr);
return; return;
} }
...@@ -2579,8 +2575,8 @@ ibuf_merge_or_delete_for_page( ...@@ -2579,8 +2575,8 @@ ibuf_merge_or_delete_for_page(
mtr_start(&mtr); mtr_start(&mtr);
fprintf(stderr, fputs(" InnoDB: Dump of the ibuf bitmap page:\n",
" InnoDB: Dump of the ibuf bitmap page:\n"); stderr);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
&mtr); &mtr);
...@@ -2588,7 +2584,7 @@ ibuf_merge_or_delete_for_page( ...@@ -2588,7 +2584,7 @@ ibuf_merge_or_delete_for_page(
mtr_commit(&mtr); mtr_commit(&mtr);
fprintf(stderr, "\nInnoDB: Dump of the page:\n"); fputs("\nInnoDB: Dump of the page:\n", stderr);
buf_page_print(page); buf_page_print(page);
...@@ -2651,18 +2647,16 @@ loop: ...@@ -2651,18 +2647,16 @@ loop:
/* Do NOT merge to the 4.1 code base! */ /* Do NOT merge to the 4.1 code base! */
if (trx_sys_downgrading_from_4_1_1) { if (trx_sys_downgrading_from_4_1_1) {
fprintf(stderr, fputs(
"InnoDB: Fatal error: you are downgrading from >= 4.1.1 to 4.0, but\n" "InnoDB: Fatal error: you are downgrading from >= 4.1.1 to 4.0, but\n"
"InnoDB: the insert buffer was not empty.\n"); "InnoDB: the insert buffer was not empty.\n", stderr);
ut_error; ut_error;
} }
if (corruption_noticed) { if (corruption_noticed) {
rec_sprintf(err_buf, 450, ibuf_rec); fputs("InnoDB: Discarding record\n ", stderr);
rec_print(stderr, ibuf_rec);
fprintf(stderr, fputs("\n from the insert buffer!\n\n", stderr);
"InnoDB: Discarding record\n %s\n from the insert buffer!\n\n", err_buf);
} else if (page) { } else if (page) {
/* Now we have at pcur a record which should be /* Now we have at pcur a record which should be
inserted to the index page; NOTE that the call below inserted to the index page; NOTE that the call below
...@@ -2723,8 +2717,8 @@ reset_bit: ...@@ -2723,8 +2717,8 @@ reset_bit:
page_no, IBUF_BITMAP_FREE, &mtr); page_no, IBUF_BITMAP_FREE, &mtr);
ulint new_bits = ibuf_index_page_calc_free(page); ulint new_bits = ibuf_index_page_calc_free(page);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
/* printf("Old bits %lu new bits %lu max size %lu\n", old_bits, /* fprintf(stderr, "Old bits %lu new bits %lu max size %lu\n",
new_bits, old_bits, new_bits,
page_get_max_insert_size_after_reorganize(page, 1)); */ page_get_max_insert_size_after_reorganize(page, 1)); */
#endif #endif
if (old_bits != new_bits) { if (old_bits != new_bits) {
...@@ -2736,7 +2730,8 @@ reset_bit: ...@@ -2736,7 +2730,8 @@ reset_bit:
} }
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
/* printf("Ibuf merge %lu records volume %lu to page no %lu\n", /* fprintf(stderr,
"Ibuf merge %lu records volume %lu to page no %lu\n",
n_inserts, volume, page_no); */ n_inserts, volume, page_no); */
#endif #endif
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -2794,34 +2789,29 @@ Prints info of ibuf. */ ...@@ -2794,34 +2789,29 @@ Prints info of ibuf. */
void void
ibuf_print( ibuf_print(
/*=======*/ /*=======*/
char* buf, /* in/out: buffer where to print */ FILE* file) /* in: file where to print */
char* buf_end)/* in: buffer end */
{ {
ibuf_data_t* data; ibuf_data_t* data;
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
ulint i; ulint i;
#endif #endif
if (buf_end - buf < 500) {
return;
}
mutex_enter(&ibuf_mutex); mutex_enter(&ibuf_mutex);
data = UT_LIST_GET_FIRST(ibuf->data_list); data = UT_LIST_GET_FIRST(ibuf->data_list);
while (data) { while (data) {
buf += sprintf(buf, fprintf(file,
"Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\n", "Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\n"
data->space, data->size, data->free_list_len, data->seg_size);
buf += sprintf(buf,
"%lu inserts, %lu merged recs, %lu merges\n", "%lu inserts, %lu merged recs, %lu merges\n",
data->space, data->size, data->free_list_len, data->seg_size,
data->n_inserts, data->n_merged_recs, data->n_merges); data->n_inserts, data->n_merged_recs, data->n_merges);
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
for (i = 0; i < IBUF_COUNT_N_PAGES; i++) { for (i = 0; i < IBUF_COUNT_N_PAGES; i++) {
if (ibuf_count_get(data->space, i) > 0) { if (ibuf_count_get(data->space, i) > 0) {
printf("Ibuf count for page %lu is %lu\n", fprintf(stderr,
"Ibuf count for page %lu is %lu\n",
i, ibuf_count_get(data->space, i)); i, ibuf_count_get(data->space, i));
} }
} }
......
...@@ -483,8 +483,7 @@ Prints info of the buffer i/o. */ ...@@ -483,8 +483,7 @@ Prints info of the buffer i/o. */
void void
buf_print_io( buf_print_io(
/*=========*/ /*=========*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end);/* in: buffer end */
/************************************************************************* /*************************************************************************
Returns the ratio in percents of modified pages in the buffer pool / Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool. */ database pages in the buffer pool. */
......
...@@ -217,9 +217,9 @@ buf_block_align( ...@@ -217,9 +217,9 @@ buf_block_align(
|| block >= buf_pool->blocks + buf_pool->max_size) { || block >= buf_pool->blocks + buf_pool->max_size) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %lx\n" "InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, "InnoDB: buf pool start is at %p, number of pages %lu\n", ptr,
(ulint)frame_zero, buf_pool->max_size); frame_zero, buf_pool->max_size);
ut_error; ut_error;
} }
...@@ -251,9 +251,9 @@ buf_block_align_low( ...@@ -251,9 +251,9 @@ buf_block_align_low(
|| block >= buf_pool->blocks + buf_pool->max_size) { || block >= buf_pool->blocks + buf_pool->max_size) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %lx\n" "InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, "InnoDB: buf pool start is at %p, number of pages %lu\n", ptr,
(ulint)frame_zero, buf_pool->max_size); frame_zero, buf_pool->max_size);
ut_error; ut_error;
} }
...@@ -280,9 +280,9 @@ buf_frame_align( ...@@ -280,9 +280,9 @@ buf_frame_align(
|| ((ulint)frame > (ulint)(buf_pool_get_nth_block(buf_pool, || ((ulint)frame > (ulint)(buf_pool_get_nth_block(buf_pool,
buf_pool->max_size - 1)->frame))) { buf_pool->max_size - 1)->frame))) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %lx\n" "InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr, "InnoDB: buf pool start is at %p, number of pages %lu\n", ptr,
(ulint)(buf_pool->frame_zero), buf_pool->max_size); buf_pool->frame_zero, buf_pool->max_size);
ut_error; ut_error;
} }
......
...@@ -326,16 +326,7 @@ The following function prints the contents of a tuple. */ ...@@ -326,16 +326,7 @@ The following function prints the contents of a tuple. */
void void
dtuple_print( dtuple_print(
/*=========*/ /*=========*/
dtuple_t* tuple); /* in: tuple */ FILE* f, /* in: output stream */
/**************************************************************
The following function prints the contents of a tuple to a buffer. */
ulint
dtuple_sprintf(
/*===========*/
/* out: printed length in bytes */
char* buf, /* in: print buffer */
ulint buf_len,/* in: buf length in bytes */
dtuple_t* tuple); /* in: tuple */ dtuple_t* tuple); /* in: tuple */
/****************************************************************** /******************************************************************
Moves parts of long fields in entry to the big record vector so that Moves parts of long fields in entry to the big record vector so that
......
...@@ -331,19 +331,23 @@ dict_print_info_on_foreign_keys( ...@@ -331,19 +331,23 @@ dict_print_info_on_foreign_keys(
a format suitable to be inserted into a format suitable to be inserted into
a CREATE TABLE, otherwise in the format a CREATE TABLE, otherwise in the format
of SHOW TABLE STATUS */ of SHOW TABLE STATUS */
char* str, /* in/out: pointer to a string */ FILE* file, /* in: file where to print */
ulint len, /* in: space in str available for info */
dict_table_t* table); /* in: table */ dict_table_t* table); /* in: table */
/************************************************************************** /**************************************************************************
Sprintfs to a string info on a foreign key of a table in a format suitable Outputs info on a foreign key of a table in a format suitable for
for CREATE TABLE. */ CREATE TABLE. */
void
char*
dict_print_info_on_foreign_key_in_create_format( dict_print_info_on_foreign_key_in_create_format(
/*============================================*/ /*============================================*/
/* out: how far in buf we printed */ FILE* file, /* in: file where to print */
dict_foreign_t* foreign,/* in: foreign key constraint */ dict_foreign_t* foreign);/* in: foreign key constraint */
char* buf); /* in: buffer of at least 5000 bytes */ /************************************************************************
Displays the names of the index and the table. */
void
dict_index_name_print(
/*==================*/
FILE* file, /* in: output stream */
const dict_index_t* index); /* in: index to print */
/************************************************************************ /************************************************************************
Gets the first index on the table (the clustered index). */ Gets the first index on the table (the clustered index). */
UNIV_INLINE UNIV_INLINE
...@@ -846,13 +850,9 @@ dict_tables_have_same_db( ...@@ -846,13 +850,9 @@ dict_tables_have_same_db(
const char* name2); /* in: table name in the form const char* name2); /* in: table name in the form
dbname '/' tablename */ dbname '/' tablename */
/* The following len must be at least 10000 bytes! */
#define DICT_FOREIGN_ERR_BUF_LEN 10000
/* Buffers for storing detailed information about the latest foreign key /* Buffers for storing detailed information about the latest foreign key
and unique key errors */ and unique key errors */
extern char* dict_foreign_err_buf; extern FILE* dict_foreign_err_file;
extern char* dict_unique_err_buf;
extern mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */ extern mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */
extern dict_sys_t* dict_sys; /* the dictionary system */ extern dict_sys_t* dict_sys; /* the dictionary system */
......
...@@ -127,8 +127,7 @@ Prints info of a hash table. */ ...@@ -127,8 +127,7 @@ Prints info of a hash table. */
void void
ha_print_info( ha_print_info(
/*==========*/ /*==========*/
char* buf, /* in/out: buffer where to print */ FILE* file, /* in: file where to print */
char* buf_end,/* in: buffer end */
hash_table_t* table); /* in: hash table */ hash_table_t* table); /* in: hash table */
/* The hash table external chain node */ /* The hash table external chain node */
......
...@@ -262,8 +262,7 @@ Prints info of ibuf. */ ...@@ -262,8 +262,7 @@ Prints info of ibuf. */
void void
ibuf_print( ibuf_print(
/*=======*/ /*=======*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end);/* in: buffer end */
#define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO #define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO
#define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO #define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO
......
...@@ -20,6 +20,8 @@ Created 5/7/1996 Heikki Tuuri ...@@ -20,6 +20,8 @@ Created 5/7/1996 Heikki Tuuri
#include "hash0hash.h" #include "hash0hash.h"
extern ibool lock_print_waits; extern ibool lock_print_waits;
/* Buffer for storing information about the most recent deadlock error */
extern FILE* lock_latest_err_file;
/************************************************************************* /*************************************************************************
Gets the size of a lock struct. */ Gets the size of a lock struct. */
...@@ -468,8 +470,7 @@ Prints info of a table lock. */ ...@@ -468,8 +470,7 @@ Prints info of a table lock. */
void void
lock_table_print( lock_table_print(
/*=============*/ /*=============*/
char* buf, /* in/out: buffer where to print, must be at least FILE* file, /* in: file where to print */
500 bytes */
lock_t* lock); /* in: table type lock */ lock_t* lock); /* in: table type lock */
/************************************************************************* /*************************************************************************
Prints info of a record lock. */ Prints info of a record lock. */
...@@ -477,8 +478,7 @@ Prints info of a record lock. */ ...@@ -477,8 +478,7 @@ Prints info of a record lock. */
void void
lock_rec_print( lock_rec_print(
/*===========*/ /*===========*/
char* buf, /* in/out: buffer where to print, must be at least FILE* file, /* in: file where to print */
500 bytes */
lock_t* lock); /* in: record type lock */ lock_t* lock); /* in: record type lock */
/************************************************************************* /*************************************************************************
Prints info of locks for all transactions. */ Prints info of locks for all transactions. */
...@@ -486,8 +486,7 @@ Prints info of locks for all transactions. */ ...@@ -486,8 +486,7 @@ Prints info of locks for all transactions. */
void void
lock_print_info( lock_print_info(
/*============*/ /*============*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end);/* in: buffer end */
/************************************************************************* /*************************************************************************
Validates the lock queue on a table. */ Validates the lock queue on a table. */
......
...@@ -512,8 +512,7 @@ Prints info of the log. */ ...@@ -512,8 +512,7 @@ Prints info of the log. */
void void
log_print( log_print(
/*======*/ /*======*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end);/* in: buffer end */
/********************************************************** /**********************************************************
Peeks the current lsn. */ Peeks the current lsn. */
......
...@@ -165,8 +165,8 @@ mlog_write_initial_log_record_fast( ...@@ -165,8 +165,8 @@ mlog_write_initial_log_record_fast(
if (space != 0 || offset > 0x8FFFFFFF) { if (space != 0 || offset > 0x8FFFFFFF) {
fprintf(stderr, fprintf(stderr,
"InnoDB: error: buffer page pointer %lx has nonsensical space id %lu\n" "InnoDB: error: buffer page pointer %p has nonsensical space id %lu\n"
"InnoDB: or page no %lu\n", (ulint)ptr, space, offset); "InnoDB: or page no %lu\n", ptr, space, offset);
ut_error; ut_error;
} }
...@@ -178,7 +178,8 @@ mlog_write_initial_log_record_fast( ...@@ -178,7 +178,8 @@ mlog_write_initial_log_record_fast(
mtr->n_log_recs++; mtr->n_log_recs++;
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
/* printf("Adding to mtr log record type %lu space %lu page no %lu\n", /* fprintf(stderr,
"Adding to mtr log record type %lu space %lu page no %lu\n",
type, space, offset); */ type, space, offset); */
#endif #endif
......
...@@ -443,8 +443,7 @@ Prints info of the aio arrays. */ ...@@ -443,8 +443,7 @@ Prints info of the aio arrays. */
void void
os_aio_print( os_aio_print(
/*=========*/ /*=========*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end);/* in: buffer end */
/************************************************************************** /**************************************************************************
Refreshes the statistics used to print per-second averages. */ Refreshes the statistics used to print per-second averages. */
......
...@@ -390,16 +390,7 @@ Prints a physical record. */ ...@@ -390,16 +390,7 @@ Prints a physical record. */
void void
rec_print( rec_print(
/*======*/ /*======*/
rec_t* rec); /* in: physical record */ FILE* file, /* in: file where to print */
/*******************************************************************
Prints a physical record to a buffer. */
ulint
rec_sprintf(
/*========*/
/* out: printed length in bytes */
char* buf, /* in: buffer to print to */
ulint buf_len,/* in: buffer length */
rec_t* rec); /* in: physical record */ rec_t* rec); /* in: physical record */
#define REC_INFO_BITS 6 /* This is single byte bit-field */ #define REC_INFO_BITS 6 /* This is single byte bit-field */
......
...@@ -190,7 +190,7 @@ rec_set_bit_field_2( ...@@ -190,7 +190,7 @@ rec_set_bit_field_2(
+ (REC_N_OWNED_MASK << (8 * (REC_N_OWNED - 3))) + (REC_N_OWNED_MASK << (8 * (REC_N_OWNED - 3)))
+ (REC_INFO_BITS_MASK << (8 * (REC_INFO_BITS - 3)))); + (REC_INFO_BITS_MASK << (8 * (REC_INFO_BITS - 3))));
if (m != ut_dbg_zero + 0xFFFFFFFF) { if (m != ut_dbg_zero + 0xFFFFFFFF) {
printf("Sum of masks %lx\n", m); fprintf(stderr, "Sum of masks %lx\n", m);
ut_error; ut_error;
} }
} }
......
...@@ -77,12 +77,9 @@ open_step( ...@@ -77,12 +77,9 @@ open_step(
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
/* SQL error detected */ /* SQL error detected */
printf("SQL error %lu\n", err); fprintf(stderr, "SQL error %lu\n", err);
ut_error; ut_error;
que_thr_handle_error(thr, err, NULL, 0);
return(NULL);
} }
thr->run_node = que_node_get_parent(node); thr->run_node = que_node_get_parent(node);
......
...@@ -84,9 +84,11 @@ upd_field_set_field_no( ...@@ -84,9 +84,11 @@ upd_field_set_field_no(
if (field_no >= dict_index_get_n_fields(index)) { if (field_no >= dict_index_get_n_fields(index)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access field %lu in table %s\n" "InnoDB: Error: trying to access field %lu in ",
"InnoDB: index %s, but index has only %lu fields\n", field_no);
field_no, index->table_name, index->name, dict_index_name_print(stderr, index);
fprintf(stderr, "\n"
"InnoDB: but index only has %lu fields\n",
dict_index_get_n_fields(index)); dict_index_get_n_fields(index));
} }
......
...@@ -32,6 +32,11 @@ at a time */ ...@@ -32,6 +32,11 @@ at a time */
/* This is set to TRUE if the MySQL user has set it in MySQL */ /* This is set to TRUE if the MySQL user has set it in MySQL */
extern ibool srv_lower_case_table_names; extern ibool srv_lower_case_table_names;
/* Mutex for locking srv_monitor_file */
extern mutex_t srv_monitor_file_mutex;
/* Temporary file for innodb monitor output */
extern FILE* srv_monitor_file;
/* Server parameters which are read from the initfile */ /* Server parameters which are read from the initfile */
extern char* srv_data_home; extern char* srv_data_home;
...@@ -368,13 +373,12 @@ srv_error_monitor_thread( ...@@ -368,13 +373,12 @@ srv_error_monitor_thread(
void* arg); /* in: a dummy parameter required by void* arg); /* in: a dummy parameter required by
os_thread_create */ os_thread_create */
/********************************************************************** /**********************************************************************
Sprintfs to a buffer the output of the InnoDB Monitor. */ Outputs to a file the output of the InnoDB Monitor. */
void void
srv_sprintf_innodb_monitor( srv_printf_innodb_monitor(
/*=======================*/ /*======================*/
char* buf, /* in/out: buffer which must be at least 4 kB */ FILE* file); /* in: output stream */
ulint len); /* in: length of the buffer */
/* Types for the threads existing in the system. Threads of types 4 - 9 /* Types for the threads existing in the system. Threads of types 4 - 9
......
...@@ -114,8 +114,7 @@ Prints info of the wait array. */ ...@@ -114,8 +114,7 @@ Prints info of the wait array. */
void void
sync_array_print_info( sync_array_print_info(
/*==================*/ /*==================*/
char* buf, /* in/out: buffer where to print */ FILE* file, /* in: file where to print */
char* buf_end,/* in: buffer end */
sync_array_t* arr); /* in: wait array */ sync_array_t* arr); /* in: wait array */
......
...@@ -119,16 +119,14 @@ Prints wait info of the sync system. */ ...@@ -119,16 +119,14 @@ Prints wait info of the sync system. */
void void
sync_print_wait_info( sync_print_wait_info(
/*=================*/ /*=================*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end); /* in: buffer end */
/*********************************************************************** /***********************************************************************
Prints info of the sync system. */ Prints info of the sync system. */
void void
sync_print( sync_print(
/*=======*/ /*=======*/
char* buf, /* in/out: buffer where to print */ FILE* file); /* in: file where to print */
char* buf_end); /* in: buffer end */
/********************************************************************** /**********************************************************************
Checks that the mutex has been initialized. */ Checks that the mutex has been initialized. */
......
...@@ -269,7 +269,7 @@ void ...@@ -269,7 +269,7 @@ void
trx_sys_print_mysql_binlog_offset(void); trx_sys_print_mysql_binlog_offset(void);
/*===================================*/ /*===================================*/
/********************************************************************* /*********************************************************************
Prints to stdout the MySQL binlog info in the system header if the Prints to stderr the MySQL binlog info in the system header if the
magic number shows it valid. */ magic number shows it valid. */
void void
......
...@@ -280,8 +280,7 @@ own the kernel mutex. */ ...@@ -280,8 +280,7 @@ own the kernel mutex. */
void void
trx_print( trx_print(
/*======*/ /*======*/
char* buf, /* in/out: buffer where to print, must be at least FILE* f, /* in: output stream */
800 bytes */
trx_t* trx); /* in: transaction */ trx_t* trx); /* in: transaction */
......
...@@ -169,7 +169,7 @@ ut_print_timestamp( ...@@ -169,7 +169,7 @@ ut_print_timestamp(
/*===============*/ /*===============*/
FILE* file); /* in: file where to print */ FILE* file); /* in: file where to print */
/************************************************************** /**************************************************************
Sprintfs a timestamp to a buffer. */ Sprintfs a timestamp to a buffer, 13..14 chars plus terminating NUL. */
void void
ut_sprintf_timestamp( ut_sprintf_timestamp(
...@@ -199,19 +199,37 @@ Prints the contents of a memory buffer in hex and ascii. */ ...@@ -199,19 +199,37 @@ Prints the contents of a memory buffer in hex and ascii. */
void void
ut_print_buf( ut_print_buf(
/*=========*/ /*=========*/
byte* buf, /* in: memory buffer */ FILE* file, /* in: file where to print */
const byte* buf, /* in: memory buffer */
ulint len); /* in: length of the buffer */ ulint len); /* in: length of the buffer */
/*****************************************************************
Prints the contents of a memory buffer in hex and ascii. */
ulint /**************************************************************************
ut_sprintf_buf( Outputs a NUL-terminated string, quoted as an SQL identifier. */
/*===========*/
/* out: printed length in bytes */ void
char* str, /* in: buffer to print to */ ut_print_name(
byte* buf, /* in: memory buffer */ /*==========*/
ulint len); /* in: length of the buffer */ FILE* f, /* in: output stream */
const char* name); /* in: name to print */
/**************************************************************************
Outputs a fixed-length string, quoted as an SQL identifier. */
void
ut_print_namel(
/*==========*/
FILE* f, /* in: output stream */
const char* name, /* in: name to print */
ulint namelen);/* in: length of name */
/**************************************************************************
Catenate files. */
void
ut_copy_file(
/*=========*/
FILE* dest, /* in: output file */
FILE* src); /* in: input file to be appended to output */
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
#include "ut0ut.ic" #include "ut0ut.ic"
......
This diff is collapsed.
...@@ -517,7 +517,8 @@ log_group_calc_lsn_offset( ...@@ -517,7 +517,8 @@ log_group_calc_lsn_offset(
ut_a(offset < (((ib_longlong) 1) << 32)); /* offset must be < 4 GB */ ut_a(offset < (((ib_longlong) 1) << 32)); /* offset must be < 4 GB */
/* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n", /* fprintf(stderr,
"Offset is %lu gr_lsn_offset is %lu difference is %lu\n",
(ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference); (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference);
*/ */
...@@ -934,7 +935,8 @@ log_group_check_flush_completion( ...@@ -934,7 +935,8 @@ log_group_check_flush_completion(
if (!log_sys->one_flushed && group->n_pending_writes == 0) { if (!log_sys->one_flushed && group->n_pending_writes == 0) {
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Log flushed first to group %lu\n", group->id); fprintf(stderr,
"Log flushed first to group %lu\n", group->id);
} }
#endif /* UNIV_LOG_DEBUG */ #endif /* UNIV_LOG_DEBUG */
...@@ -947,7 +949,7 @@ log_group_check_flush_completion( ...@@ -947,7 +949,7 @@ log_group_check_flush_completion(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes && (group->n_pending_writes == 0)) { if (log_debug_writes && (group->n_pending_writes == 0)) {
printf("Log flushed to group %lu\n", group->id); fprintf(stderr, "Log flushed to group %lu\n", group->id);
} }
#endif /* UNIV_LOG_DEBUG */ #endif /* UNIV_LOG_DEBUG */
...@@ -1096,9 +1098,9 @@ log_group_file_header_flush( ...@@ -1096,9 +1098,9 @@ log_group_file_header_flush(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( fprintf(stderr,
"Writing log file header to group %lu file %lu\n", group->id, "Writing log file header to group %lu file %lu\n",
nth_file); group->id, nth_file);
} }
#endif /* UNIV_LOG_DEBUG */ #endif /* UNIV_LOG_DEBUG */
...@@ -1186,14 +1188,13 @@ loop: ...@@ -1186,14 +1188,13 @@ loop:
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( fprintf(stderr,
"Writing log file segment to group %lu offset %lu len %lu\n" "Writing log file segment to group %lu offset %lu len %lu\n"
"start lsn %lu %lu\n", "start lsn %lu %lu\n"
"First block n:o %lu last block n:o %lu\n",
group->id, next_offset, write_len, group->id, next_offset, write_len,
ut_dulint_get_high(start_lsn), ut_dulint_get_high(start_lsn),
ut_dulint_get_low(start_lsn)); ut_dulint_get_low(start_lsn),
printf(
"First block n:o %lu last block n:o %lu\n",
log_block_get_hdr_no(buf), log_block_get_hdr_no(buf),
log_block_get_hdr_no( log_block_get_hdr_no(
buf + write_len - OS_FILE_LOG_BLOCK_SIZE)); buf + write_len - OS_FILE_LOG_BLOCK_SIZE));
...@@ -1274,7 +1275,7 @@ loop: ...@@ -1274,7 +1275,7 @@ loop:
ut_ad(loop_count < 5); ut_ad(loop_count < 5);
if (loop_count > 2) { if (loop_count > 2) {
/* printf("Log loop count %lu\n", loop_count); */ /* fprintf(stderr, "Log loop count %lu\n", loop_count); */
} }
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
...@@ -1337,7 +1338,8 @@ loop: ...@@ -1337,7 +1338,8 @@ loop:
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Writing log from %lu %lu up to lsn %lu %lu\n", fprintf(stderr,
"Writing log from %lu %lu up to lsn %lu %lu\n",
ut_dulint_get_high(log_sys->written_to_all_lsn), ut_dulint_get_high(log_sys->written_to_all_lsn),
ut_dulint_get_low(log_sys->written_to_all_lsn), ut_dulint_get_low(log_sys->written_to_all_lsn),
ut_dulint_get_high(log_sys->lsn), ut_dulint_get_high(log_sys->lsn),
...@@ -1757,11 +1759,11 @@ log_reset_first_header_and_checkpoint( ...@@ -1757,11 +1759,11 @@ log_reset_first_header_and_checkpoint(
lsn = ut_dulint_add(start, LOG_BLOCK_HDR_SIZE); lsn = ut_dulint_add(start, LOG_BLOCK_HDR_SIZE);
/* Write the label of ibbackup --restore */ /* Write the label of ibbackup --restore */
sprintf((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, strcpy((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
"ibbackup "); "ibbackup ");
ut_sprintf_timestamp( ut_sprintf_timestamp(
(char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP (char*) hdr_buf + (LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
+ strlen("ibbackup ")); + (sizeof "ibbackup ") - 1));
buf = hdr_buf + LOG_CHECKPOINT_1; buf = hdr_buf + LOG_CHECKPOINT_1;
mach_write_to_8(buf + LOG_CHECKPOINT_NO, ut_dulint_zero); mach_write_to_8(buf + LOG_CHECKPOINT_NO, ut_dulint_zero);
...@@ -1904,7 +1906,7 @@ log_checkpoint( ...@@ -1904,7 +1906,7 @@ log_checkpoint(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Making checkpoint no %lu at lsn %lu %lu\n", fprintf(stderr, "Making checkpoint no %lu at lsn %lu %lu\n",
ut_dulint_get_low(log_sys->next_checkpoint_no), ut_dulint_get_low(log_sys->next_checkpoint_no),
ut_dulint_get_high(oldest_lsn), ut_dulint_get_high(oldest_lsn),
ut_dulint_get_low(oldest_lsn)); ut_dulint_get_low(oldest_lsn));
...@@ -2280,18 +2282,17 @@ loop: ...@@ -2280,18 +2282,17 @@ loop:
if (!ret) { if (!ret) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Cannot create or open archive log file %s.\n", "InnoDB: Cannot create or open archive log file %s.\n"
name); "InnoDB: Cannot continue operation.\n"
fprintf(stderr, "InnoDB: Cannot continue operation.\n"
"InnoDB: Check that the log archive directory exists,\n" "InnoDB: Check that the log archive directory exists,\n"
"InnoDB: you have access rights to it, and\n" "InnoDB: you have access rights to it, and\n"
"InnoDB: there is space available.\n"); "InnoDB: there is space available.\n", name);
exit(1); exit(1);
} }
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Created archive file %s\n", name); fprintf(stderr, "Created archive file %s\n", name);
} }
#endif /* UNIV_LOG_DEBUG */ #endif /* UNIV_LOG_DEBUG */
...@@ -2324,7 +2325,7 @@ loop: ...@@ -2324,7 +2325,7 @@ loop:
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( fprintf(stderr,
"Archiving starting at lsn %lu %lu, len %lu to group %lu\n", "Archiving starting at lsn %lu %lu, len %lu to group %lu\n",
ut_dulint_get_high(start_lsn), ut_dulint_get_high(start_lsn),
ut_dulint_get_low(start_lsn), ut_dulint_get_low(start_lsn),
...@@ -2423,7 +2424,8 @@ log_archive_write_complete_groups(void) ...@@ -2423,7 +2424,8 @@ log_archive_write_complete_groups(void)
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes && trunc_files) { if (log_debug_writes && trunc_files) {
printf("Complete file(s) archived to group %lu\n", fprintf(stderr,
"Complete file(s) archived to group %lu\n",
group->id); group->id);
} }
#endif /* UNIV_LOG_DEBUG */ #endif /* UNIV_LOG_DEBUG */
...@@ -2451,7 +2453,7 @@ log_archive_write_complete_groups(void) ...@@ -2451,7 +2453,7 @@ log_archive_write_complete_groups(void)
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Archiving writes completed\n"); fputs("Archiving writes completed\n", stderr);
} }
#endif /* UNIV_LOG_DEBUG */ #endif /* UNIV_LOG_DEBUG */
} }
...@@ -2472,7 +2474,7 @@ log_archive_check_completion_low(void) ...@@ -2472,7 +2474,7 @@ log_archive_check_completion_low(void)
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Archiving read completed\n"); fputs("Archiving read completed\n", stderr);
} }
#endif /* UNIV_LOG_DEBUG */ #endif /* UNIV_LOG_DEBUG */
...@@ -2620,7 +2622,8 @@ loop: ...@@ -2620,7 +2622,8 @@ loop:
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf("Archiving from lsn %lu %lu to lsn %lu %lu\n", fprintf(stderr,
"Archiving from lsn %lu %lu to lsn %lu %lu\n",
ut_dulint_get_high(log_sys->archived_lsn), ut_dulint_get_high(log_sys->archived_lsn),
ut_dulint_get_low(log_sys->archived_lsn), ut_dulint_get_low(log_sys->archived_lsn),
ut_dulint_get_high(limit_lsn), ut_dulint_get_high(limit_lsn),
...@@ -2727,7 +2730,7 @@ log_archive_close_groups( ...@@ -2727,7 +2730,7 @@ log_archive_close_groups(
#ifdef UNIV_LOG_DEBUG #ifdef UNIV_LOG_DEBUG
if (log_debug_writes) { if (log_debug_writes) {
printf( fprintf(stderr,
"Incrementing arch file no to %lu in log group %lu\n", "Incrementing arch file no to %lu in log group %lu\n",
group->archived_file_no + 2, group->id); group->archived_file_no + 2, group->id);
} }
...@@ -3262,20 +3265,15 @@ Prints info of the log. */ ...@@ -3262,20 +3265,15 @@ Prints info of the log. */
void void
log_print( log_print(
/*======*/ /*======*/
char* buf, /* in/out: buffer where to print */ FILE* file) /* in: file where to print */
char* buf_end)/* in: buffer end */
{ {
double time_elapsed; double time_elapsed;
time_t current_time; time_t current_time;
if (buf_end - buf < 300) {
return;
}
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
buf += sprintf(buf, "Log sequence number %lu %lu\n" fprintf(file,
"Log sequence number %lu %lu\n"
"Log flushed up to %lu %lu\n" "Log flushed up to %lu %lu\n"
"Last checkpoint at %lu %lu\n", "Last checkpoint at %lu %lu\n",
ut_dulint_get_high(log_sys->lsn), ut_dulint_get_high(log_sys->lsn),
...@@ -3289,7 +3287,7 @@ log_print( ...@@ -3289,7 +3287,7 @@ log_print(
time_elapsed = 0.001 + difftime(current_time, time_elapsed = 0.001 + difftime(current_time,
log_sys->last_printout_time); log_sys->last_printout_time);
buf += sprintf(buf, fprintf(file,
"%lu pending log writes, %lu pending chkp writes\n" "%lu pending log writes, %lu pending chkp writes\n"
"%lu log i/o's done, %.2f log i/o's/second\n", "%lu log i/o's done, %.2f log i/o's/second\n",
log_sys->n_pending_writes, log_sys->n_pending_writes,
......
...@@ -589,7 +589,7 @@ recv_read_cp_info_for_backup( ...@@ -589,7 +589,7 @@ recv_read_cp_info_for_backup(
*fsp_limit = 1000000000; *fsp_limit = 1000000000;
} }
/* printf("fsp limit %lu MB\n", *fsp_limit); */ /* fprintf(stderr, "fsp limit %lu MB\n", *fsp_limit); */
*cp_no = mach_read_from_8(cp_buf + LOG_CHECKPOINT_NO); *cp_no = mach_read_from_8(cp_buf + LOG_CHECKPOINT_NO);
...@@ -665,7 +665,7 @@ recv_scan_log_seg_for_backup( ...@@ -665,7 +665,7 @@ recv_scan_log_seg_for_backup(
if (no != log_block_convert_lsn_to_no(*scanned_lsn) if (no != log_block_convert_lsn_to_no(*scanned_lsn)
|| !log_block_checksum_is_ok_or_old_format(log_block)) { || !log_block_checksum_is_ok_or_old_format(log_block)) {
/* /*
printf( fprintf(stderr,
"Log block n:o %lu, scanned lsn n:o %lu\n", "Log block n:o %lu, scanned lsn n:o %lu\n",
no, log_block_convert_lsn_to_no(*scanned_lsn)); no, log_block_convert_lsn_to_no(*scanned_lsn));
*/ */
...@@ -673,7 +673,7 @@ recv_scan_log_seg_for_backup( ...@@ -673,7 +673,7 @@ recv_scan_log_seg_for_backup(
log_block += OS_FILE_LOG_BLOCK_SIZE; log_block += OS_FILE_LOG_BLOCK_SIZE;
/* /*
printf( fprintf(stderr,
"Next log block n:o %lu\n", "Next log block n:o %lu\n",
log_block_get_hdr_no(log_block)); log_block_get_hdr_no(log_block));
*/ */
...@@ -690,7 +690,8 @@ recv_scan_log_seg_for_backup( ...@@ -690,7 +690,8 @@ recv_scan_log_seg_for_backup(
/* Garbage from a log buffer flush which was made /* Garbage from a log buffer flush which was made
before the most recent database recovery */ before the most recent database recovery */
/* /*
printf("Scanned cp n:o %lu, block cp n:o %lu\n", fprintf(stderr,
"Scanned cp n:o %lu, block cp n:o %lu\n",
*scanned_checkpoint_no, *scanned_checkpoint_no,
log_block_get_checkpoint_no(log_block)); log_block_get_checkpoint_no(log_block));
*/ */
...@@ -708,7 +709,8 @@ recv_scan_log_seg_for_backup( ...@@ -708,7 +709,8 @@ recv_scan_log_seg_for_backup(
if (data_len < OS_FILE_LOG_BLOCK_SIZE) { if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
/* Log data ends here */ /* Log data ends here */
/* printf("Log block data len %lu\n", data_len); */ /* fprintf(stderr, "Log block data len %lu\n",
data_len); */
break; break;
} }
...@@ -1211,7 +1213,7 @@ recv_read_in_area( ...@@ -1211,7 +1213,7 @@ recv_read_in_area(
buf_read_recv_pages(FALSE, space, page_nos, n); buf_read_recv_pages(FALSE, space, page_nos, n);
/* /*
printf("Recv pages at %lu n %lu\n", page_nos[0], n); fprintf(stderr, "Recv pages at %lu n %lu\n", page_nos[0], n);
*/ */
return(n); return(n);
} }
...@@ -1398,16 +1400,16 @@ recv_apply_log_recs_for_backup( ...@@ -1398,16 +1400,16 @@ recv_apply_log_recs_for_backup(
} }
if (recv_max_parsed_page_no >= n_pages_total) { if (recv_max_parsed_page_no >= n_pages_total) {
printf( fprintf(stderr,
"InnoDB: Error: tablespace size %lu pages, but a log record on page %lu!\n" "InnoDB: Error: tablespace size %lu pages, but a log record on page %lu!\n"
"InnoDB: Are you sure you have specified all the ibdata files right in\n" "InnoDB: Are you sure you have specified all the ibdata files right in\n"
"InnoDB: the my.cnf file you gave as the argument to ibbackup --restore?\n", "InnoDB: the my.cnf file you gave as the argument to ibbackup --restore?\n",
n_pages_total, recv_max_parsed_page_no); n_pages_total, recv_max_parsed_page_no);
} }
printf( fputs(
"InnoDB: Starting an apply batch of log records to the database...\n" "InnoDB: Starting an apply batch of log records to the database...\n"
"InnoDB: Progress in percents: "); "InnoDB: Progress in percents: ", stderr);
for (i = 0; i < n_pages_total; i++) { for (i = 0; i < n_pages_total; i++) {
...@@ -1424,7 +1426,7 @@ recv_apply_log_recs_for_backup( ...@@ -1424,7 +1426,7 @@ recv_apply_log_recs_for_backup(
OS_FILE_READ_WRITE, OS_FILE_READ_WRITE,
&success); &success);
if (!success) { if (!success) {
printf( fprintf(stderr,
"InnoDB: Error: cannot open %lu'th data file\n", nth_file); "InnoDB: Error: cannot open %lu'th data file\n", nth_file);
exit(1); exit(1);
...@@ -1440,7 +1442,7 @@ recv_apply_log_recs_for_backup( ...@@ -1440,7 +1442,7 @@ recv_apply_log_recs_for_backup(
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT), nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
UNIV_PAGE_SIZE); UNIV_PAGE_SIZE);
if (!success) { if (!success) {
printf( fprintf(stderr,
"InnoDB: Error: cannot read page no %lu from %lu'th data file\n", "InnoDB: Error: cannot read page no %lu from %lu'th data file\n",
nth_page_in_file, nth_file); nth_page_in_file, nth_file);
...@@ -1468,7 +1470,7 @@ recv_apply_log_recs_for_backup( ...@@ -1468,7 +1470,7 @@ recv_apply_log_recs_for_backup(
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT), nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
UNIV_PAGE_SIZE); UNIV_PAGE_SIZE);
if (!success) { if (!success) {
printf( fprintf(stderr,
"InnoDB: Error: cannot write page no %lu to %lu'th data file\n", "InnoDB: Error: cannot write page no %lu to %lu'th data file\n",
nth_page_in_file, nth_file); nth_page_in_file, nth_file);
...@@ -1478,8 +1480,8 @@ recv_apply_log_recs_for_backup( ...@@ -1478,8 +1480,8 @@ recv_apply_log_recs_for_backup(
if ((100 * i) / n_pages_total if ((100 * i) / n_pages_total
!= (100 * (i + 1)) / n_pages_total) { != (100 * (i + 1)) / n_pages_total) {
printf("%lu ", (100 * i) / n_pages_total); fprintf(stderr, "%lu ", (100 * i) / n_pages_total);
fflush(stdout); fflush(stderr);
} }
nth_page_in_file++; nth_page_in_file++;
...@@ -1821,21 +1823,15 @@ recv_report_corrupt_log( ...@@ -1821,21 +1823,15 @@ recv_report_corrupt_log(
ulint space, /* in: space id, this may also be garbage */ ulint space, /* in: space id, this may also be garbage */
ulint page_no)/* in: page number, this may also be garbage */ ulint page_no)/* in: page number, this may also be garbage */
{ {
char* err_buf;
fprintf(stderr, fprintf(stderr,
"InnoDB: ############### CORRUPT LOG RECORD FOUND\n" "InnoDB: ############### CORRUPT LOG RECORD FOUND\n"
"InnoDB: Log record type %lu, space id %lu, page number %lu\n" "InnoDB: Log record type %lu, space id %lu, page number %lu\n"
"InnoDB: Log parsing proceeded successfully up to %lu %lu\n", "InnoDB: Log parsing proceeded successfully up to %lu %lu\n"
(ulint)type, space, page_no,
ut_dulint_get_high(recv_sys->recovered_lsn),
ut_dulint_get_low(recv_sys->recovered_lsn));
err_buf = ut_malloc(1000000);
fprintf(stderr,
"InnoDB: Previous log record type %lu, is multi %lu\n" "InnoDB: Previous log record type %lu, is multi %lu\n"
"InnoDB: Recv offset %lu, prev %lu\n", "InnoDB: Recv offset %lu, prev %lu\n",
(ulint)type, space, page_no,
ut_dulint_get_high(recv_sys->recovered_lsn),
ut_dulint_get_low(recv_sys->recovered_lsn),
recv_previous_parsed_rec_type, recv_previous_parsed_rec_type,
recv_previous_parsed_rec_is_multi, recv_previous_parsed_rec_is_multi,
(ulint)(ptr - recv_sys->buf), (ulint)(ptr - recv_sys->buf),
...@@ -1846,28 +1842,27 @@ recv_report_corrupt_log( ...@@ -1846,28 +1842,27 @@ recv_report_corrupt_log(
&& (ulint)(ptr - recv_sys->buf + 100 && (ulint)(ptr - recv_sys->buf + 100
- recv_previous_parsed_rec_offset) - recv_previous_parsed_rec_offset)
< 200000) { < 200000) {
fputs(
"InnoDB: Hex dump of corrupt log starting 100 bytes before the start\n"
"InnoDB: of the previous log rec,\n"
"InnoDB: and ending 100 bytes after the start of the corrupt rec:\n",
stderr);
ut_sprintf_buf(err_buf, ut_print_buf(stderr,
recv_sys->buf + recv_previous_parsed_rec_offset - 100, recv_sys->buf + recv_previous_parsed_rec_offset - 100,
ptr - recv_sys->buf + 200 - ptr - recv_sys->buf + 200 -
recv_previous_parsed_rec_offset); recv_previous_parsed_rec_offset);
fprintf(stderr, putc('\n', stderr);
"InnoDB: Hex dump of corrupt log starting 100 bytes before the start\n"
"InnoDB: of the previous log rec,\n"
"InnoDB: and ending 100 bytes after the start of the corrupt rec:\n%s\n",
err_buf);
} }
ut_free(err_buf); fputs(
fprintf(stderr,
"InnoDB: WARNING: the log file may have been corrupt and it\n" "InnoDB: WARNING: the log file may have been corrupt and it\n"
"InnoDB: is possible that the log scan did not proceed\n" "InnoDB: is possible that the log scan did not proceed\n"
"InnoDB: far enough in recovery! Please run CHECK TABLE\n" "InnoDB: far enough in recovery! Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n" "InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: If mysqld crashes after this recovery, look at\n" "InnoDB: If mysqld crashes after this recovery, look at\n"
"InnoDB: section 6.1 of http://www.innodb.com/ibman.html\n" "InnoDB: section 6.1 of http://www.innodb.com/ibman.php\n"
"InnoDB: about forcing recovery.\n"); "InnoDB: about forcing recovery.\n", stderr);
fflush(stderr); fflush(stderr);
} }
...@@ -2517,7 +2512,7 @@ recv_recovery_from_checkpoint_start( ...@@ -2517,7 +2512,7 @@ recv_recovery_from_checkpoint_start(
log_hdr_buf, max_cp_group); log_hdr_buf, max_cp_group);
if (0 == ut_memcmp(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, if (0 == ut_memcmp(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
(byte*)"ibbackup", ut_strlen((char*)"ibbackup"))) { (byte*)"ibbackup", (sizeof "ibbackup") - 1)) {
/* This log file was created by ibbackup --restore: print /* This log file was created by ibbackup --restore: print
a note to the user about it */ a note to the user about it */
...@@ -2865,25 +2860,35 @@ recv_reset_log_files_for_backup( ...@@ -2865,25 +2860,35 @@ recv_reset_log_files_for_backup(
ibool success; ibool success;
byte* buf; byte* buf;
ulint i; ulint i;
char name[5000]; ulint log_dir_len;
char* name;
static
char logfilename[] = "ib_logfile";
log_dir_len = strlen(log_dir);
/* reserve space for log_dir, "ib_logfile" and a number */
name = memcpy(mem_alloc(log_dir_len + ((sizeof logfilename) + 11)),
log_dir, log_dir_len);
memcpy(name + log_dir_len, logfilename, sizeof logfilename);
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE); buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
for (i = 0; i < n_log_files; i++) { for (i = 0; i < n_log_files; i++) {
sprintf(name, "%sib_logfile%lu", log_dir, i); sprintf(name + log_dir_len + sizeof logfilename, "%lu", i);
log_file = os_file_create_simple(name, OS_FILE_CREATE, log_file = os_file_create_simple(name, OS_FILE_CREATE,
OS_FILE_READ_WRITE, &success); OS_FILE_READ_WRITE, &success);
if (!success) { if (!success) {
printf( fprintf(stderr,
"InnoDB: Cannot create %s. Check that the file does not exist yet.\n", name); "InnoDB: Cannot create %s. Check that the file does not exist yet.\n", name);
exit(1); exit(1);
} }
printf( fprintf(stderr,
"Setting log file size to %lu %lu\n", ut_get_high32(log_file_size), "Setting log file size to %lu %lu\n",
ut_get_high32(log_file_size),
log_file_size & 0xFFFFFFFF); log_file_size & 0xFFFFFFFF);
success = os_file_set_size(name, log_file, success = os_file_set_size(name, log_file,
...@@ -2891,7 +2896,7 @@ recv_reset_log_files_for_backup( ...@@ -2891,7 +2896,7 @@ recv_reset_log_files_for_backup(
ut_get_high32(log_file_size)); ut_get_high32(log_file_size));
if (!success) { if (!success) {
printf( fprintf(stderr,
"InnoDB: Cannot set %s size to %lu %lu\n", name, ut_get_high32(log_file_size), "InnoDB: Cannot set %s size to %lu %lu\n", name, ut_get_high32(log_file_size),
log_file_size & 0xFFFFFFFF); log_file_size & 0xFFFFFFFF);
exit(1); exit(1);
...@@ -2908,12 +2913,12 @@ recv_reset_log_files_for_backup( ...@@ -2908,12 +2913,12 @@ recv_reset_log_files_for_backup(
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn); log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE, log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
LOG_BLOCK_HDR_SIZE); LOG_BLOCK_HDR_SIZE);
sprintf(name, "%sib_logfile%lu", log_dir, 0); strcpy(name + log_dir_len + sizeof logfilename, "0");
log_file = os_file_create_simple(name, OS_FILE_OPEN, log_file = os_file_create_simple(name, OS_FILE_OPEN,
OS_FILE_READ_WRITE, &success); OS_FILE_READ_WRITE, &success);
if (!success) { if (!success) {
printf("InnoDB: Cannot open %s.\n", name); fprintf(stderr, "InnoDB: Cannot open %s.\n", name);
exit(1); exit(1);
} }
...@@ -2923,6 +2928,7 @@ recv_reset_log_files_for_backup( ...@@ -2923,6 +2928,7 @@ recv_reset_log_files_for_backup(
os_file_flush(log_file); os_file_flush(log_file);
os_file_close(log_file); os_file_close(log_file);
mem_free(name);
ut_free(buf); ut_free(buf);
} }
......
...@@ -336,7 +336,7 @@ mem_hash_remove( ...@@ -336,7 +336,7 @@ mem_hash_remove(
} }
if (node == NULL) { if (node == NULL) {
printf( fprintf(stderr,
"Memory heap or buffer freed in %s line %lu did not exist.\n", "Memory heap or buffer freed in %s line %lu did not exist.\n",
file_name, line); file_name, line);
ut_error; ut_error;
...@@ -351,20 +351,18 @@ mem_hash_remove( ...@@ -351,20 +351,18 @@ mem_hash_remove(
mem_heap_validate_or_print(node->heap, NULL, FALSE, &error, &size, mem_heap_validate_or_print(node->heap, NULL, FALSE, &error, &size,
NULL, NULL); NULL, NULL);
if (error) { if (error) {
printf("Inconsistency in memory heap or buffer n:o %lu created\n", fprintf(stderr,
node->nth_heap); "Inconsistency in memory heap or buffer n:o %lu created\n"
printf("in %s line %lu and tried to free in %s line %lu.\n", "in %s line %lu and tried to free in %s line %lu.\n"
node->file_name, node->line, file_name, line); "Hex dump of 400 bytes around memory heap first block start:\n",
node->nth_heap, node->file_name, node->line,
printf( file_name, line);
"Hex dump of 400 bytes around memory heap first block start:\n"); ut_print_buf(stderr, (byte*)node->heap - 200, 400);
ut_print_buf((byte*)(node->heap) - 200, 400);
printf("\nDump of the mem heap:\n"); fputs("\nDump of the mem heap:\n", stderr);
mem_heap_validate_or_print(node->heap, NULL, TRUE, &error, &size, mem_heap_validate_or_print(node->heap, NULL, TRUE, &error,
NULL, NULL); &size, NULL, NULL);
ut_error; ut_error;
} }
...@@ -438,7 +436,7 @@ mem_heap_validate_or_print( ...@@ -438,7 +436,7 @@ mem_heap_validate_or_print(
} }
if (print) { if (print) {
printf("Memory heap:"); fputs("Memory heap:", stderr);
} }
while (block != NULL) { while (block != NULL) {
...@@ -456,7 +454,7 @@ mem_heap_validate_or_print( ...@@ -456,7 +454,7 @@ mem_heap_validate_or_print(
/* We can trace the fields of the block only in the debug /* We can trace the fields of the block only in the debug
version */ version */
if (print) { if (print) {
printf(" Block %ld:", block_count); fprintf(stderr, " Block %ld:", block_count);
} }
field = (byte*)block + mem_block_get_start(block); field = (byte*)block + mem_block_get_start(block);
...@@ -476,7 +474,7 @@ mem_heap_validate_or_print( ...@@ -476,7 +474,7 @@ mem_heap_validate_or_print(
len = mem_field_header_get_len(user_field); len = mem_field_header_get_len(user_field);
if (print) { if (print) {
ut_print_buf(user_field, len); ut_print_buf(stderr, user_field, len);
} }
total_len += len; total_len += len;
...@@ -545,7 +543,7 @@ mem_heap_print( ...@@ -545,7 +543,7 @@ mem_heap_print(
mem_heap_validate_or_print(heap, NULL, TRUE, &error, mem_heap_validate_or_print(heap, NULL, TRUE, &error,
&us_size, &phys_size, &n_blocks); &us_size, &phys_size, &n_blocks);
printf( fprintf(stderr,
"\nheap type: %lu; size: user size %lu; physical size %lu; blocks %lu.\n", "\nheap type: %lu; size: user size %lu; physical size %lu; blocks %lu.\n",
heap->type, us_size, phys_size, n_blocks); heap->type, us_size, phys_size, n_blocks);
ut_a(!error); ut_a(!error);
...@@ -659,9 +657,11 @@ mem_validate_no_assert(void) ...@@ -659,9 +657,11 @@ mem_validate_no_assert(void)
&ph_size, &n_blocks); &ph_size, &n_blocks);
if (error) { if (error) {
printf("\nERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"); fprintf(stderr,
printf("Inconsistency in memory heap or buffer created\n"); "\nERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"
printf("in %s line %lu.\n", node->file_name, node->line); "Inconsistency in memory heap or buffer created\n"
"in %s line %lu.\n",
node->file_name, node->line);
mutex_exit(&mem_hash_mutex); mutex_exit(&mem_hash_mutex);
...@@ -721,12 +721,10 @@ mem_analyze_corruption( ...@@ -721,12 +721,10 @@ mem_analyze_corruption(
ulint i; ulint i;
ulint dist; ulint dist;
ut_sprintf_buf(srv_fatal_errbuf, ptr - 250, 500); fputs("InnoDB: Apparent memory corruption: mem dump ", stderr);
fprintf(stderr, ut_print_buf(stderr, ptr - 250, 500);
"InnoDB: Apparent memory corruption: mem dump %s\n", srv_fatal_errbuf);
fprintf(stderr, fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr);
"InnoDB: Scanning backward trying to find previous allocated mem blocks\n");
p = ptr; p = ptr;
dist = 0; dist = 0;
......
...@@ -54,15 +54,15 @@ mlog_write_initial_log_record( ...@@ -54,15 +54,15 @@ mlog_write_initial_log_record(
byte* log_ptr; byte* log_ptr;
ut_ad(type <= MLOG_BIGGEST_TYPE); ut_ad(type <= MLOG_BIGGEST_TYPE);
ut_ad(type > MLOG_8BYTES);
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) { if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n", "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
(ulint)ptr);
ut_error; ut_error;
} }
log_ptr = mlog_open(mtr, 20); log_ptr = mlog_open(mtr, 11);
/* If no logging is requested, we may return now */ /* If no logging is requested, we may return now */
if (log_ptr == NULL) { if (log_ptr == NULL) {
...@@ -221,8 +221,7 @@ mlog_write_ulint( ...@@ -221,8 +221,7 @@ mlog_write_ulint(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) { if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n", "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
(ulint)ptr);
ut_error; ut_error;
} }
...@@ -268,8 +267,7 @@ mlog_write_dulint( ...@@ -268,8 +267,7 @@ mlog_write_dulint(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) { if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n", "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
(ulint)ptr);
ut_error; ut_error;
} }
...@@ -312,8 +310,7 @@ mlog_write_string( ...@@ -312,8 +310,7 @@ mlog_write_string(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) { if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n", "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
(ulint)ptr);
ut_error; ut_error;
} }
ut_ad(ptr && mtr); ut_ad(ptr && mtr);
......
...@@ -262,7 +262,8 @@ mtr_first_to_modify_page_after_backup( ...@@ -262,7 +262,8 @@ mtr_first_to_modify_page_after_backup(
block->frame), block->frame),
backup_lsn) <= 0) { backup_lsn) <= 0) {
printf("Page %lu newest %lu backup %lu\n", fprintf(stderr,
"Page %lu newest %lu backup %lu\n",
block->offset, block->offset,
ut_dulint_get_low( ut_dulint_get_low(
buf_frame_get_newest_modification( buf_frame_get_newest_modification(
...@@ -515,7 +516,7 @@ mtr_print( ...@@ -515,7 +516,7 @@ mtr_print(
/*======*/ /*======*/
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
printf( fprintf(stderr,
"Mini-transaction handle: memo size %lu bytes log size %lu bytes\n", "Mini-transaction handle: memo size %lu bytes log size %lu bytes\n",
dyn_array_get_data_size(&(mtr->memo)), dyn_array_get_data_size(&(mtr->memo)),
dyn_array_get_data_size(&(mtr->log))); dyn_array_get_data_size(&(mtr->log)));
......
...@@ -212,7 +212,7 @@ os_file_get_last_error(void) ...@@ -212,7 +212,7 @@ os_file_get_last_error(void)
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n" " InnoDB: Operating system error number %lu in a file operation.\n"
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n", "InnoDB: See http://www.innodb.com/ibman.php for installation help.\n",
err); err);
if (err == ERROR_PATH_NOT_FOUND) { if (err == ERROR_PATH_NOT_FOUND) {
...@@ -227,7 +227,7 @@ os_file_get_last_error(void) ...@@ -227,7 +227,7 @@ os_file_get_last_error(void)
"InnoDB: of the same name as a data file.\n"); "InnoDB: of the same name as a data file.\n");
} else { } else {
fprintf(stderr, fprintf(stderr,
"InnoDB: See section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: See section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n"); "InnoDB: about operating system error numbers.\n");
} }
} }
...@@ -251,7 +251,7 @@ os_file_get_last_error(void) ...@@ -251,7 +251,7 @@ os_file_get_last_error(void)
fprintf(stderr, fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n" " InnoDB: Operating system error number %lu in a file operation.\n"
"InnoDB: See http://www.innodb.com/ibman.html for installation help.\n", "InnoDB: See http://www.innodb.com/ibman.php for installation help.\n",
err); err);
if (err == ENOENT) { if (err == ENOENT) {
...@@ -270,7 +270,7 @@ os_file_get_last_error(void) ...@@ -270,7 +270,7 @@ os_file_get_last_error(void)
} }
fprintf(stderr, fprintf(stderr,
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n"); "InnoDB: about operating system error numbers.\n");
} }
} }
...@@ -733,7 +733,7 @@ try_again: ...@@ -733,7 +733,7 @@ try_again:
ut_error; ut_error;
} }
/* printf("Opening file %s, mode %s, type %s, purpose %s\n", /* fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
name, mode_str, type_str, purpose_str); */ name, mode_str, type_str, purpose_str); */
#ifdef O_SYNC #ifdef O_SYNC
/* We let O_SYNC only affect log files; note that we map O_DSYNC to /* We let O_SYNC only affect log files; note that we map O_DSYNC to
...@@ -742,7 +742,7 @@ try_again: ...@@ -742,7 +742,7 @@ try_again:
if (type == OS_LOG_FILE if (type == OS_LOG_FILE
&& srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) { && srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
/* printf("Using O_SYNC for file %s\n", name); */ /* fprintf(stderr, "Using O_SYNC for file %s\n", name); */
create_flag = create_flag | O_SYNC; create_flag = create_flag | O_SYNC;
} }
...@@ -752,7 +752,7 @@ try_again: ...@@ -752,7 +752,7 @@ try_again:
if (type != OS_LOG_FILE if (type != OS_LOG_FILE
&& srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) { && srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
/* printf("Using O_DIRECT for file %s\n", name); */ /* fprintf(stderr, "Using O_DIRECT for file %s\n", name); */
create_flag = create_flag | O_DIRECT; create_flag = create_flag | O_DIRECT;
} }
...@@ -1025,7 +1025,7 @@ os_file_flush( ...@@ -1025,7 +1025,7 @@ os_file_flush(
#ifdef HAVE_FDATASYNC #ifdef HAVE_FDATASYNC
ret = fdatasync(file); ret = fdatasync(file);
#else #else
/* printf("Flushing to file %lu\n", (ulint)file); */ /* fprintf(stderr, "Flushing to file %p\n", file); */
ret = fsync(file); ret = fsync(file);
#endif #endif
os_n_fsyncs++; os_n_fsyncs++;
...@@ -1382,7 +1382,7 @@ retry: ...@@ -1382,7 +1382,7 @@ retry:
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: File pointer positioning to file %s failed at\n" " InnoDB: Error: File pointer positioning to file %s failed at\n"
"InnoDB: offset %lu %lu. Operating system error number %lu.\n" "InnoDB: offset %lu %lu. Operating system error number %lu.\n"
"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: what the error number means.\n", "InnoDB: what the error number means.\n",
name, offset_high, offset, name, offset_high, offset,
(ulint)GetLastError()); (ulint)GetLastError());
...@@ -1440,7 +1440,7 @@ retry: ...@@ -1440,7 +1440,7 @@ retry:
} }
fprintf(stderr, fprintf(stderr,
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n"); "InnoDB: about operating system error numbers.\n");
os_has_said_disk_full = TRUE; os_has_said_disk_full = TRUE;
...@@ -1475,7 +1475,7 @@ retry: ...@@ -1475,7 +1475,7 @@ retry:
} }
fprintf(stderr, fprintf(stderr,
"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n" "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n"); "InnoDB: about operating system error numbers.\n");
os_has_said_disk_full = TRUE; os_has_said_disk_full = TRUE;
...@@ -1593,7 +1593,7 @@ os_aio_init( ...@@ -1593,7 +1593,7 @@ os_aio_init(
n_write_segs = (n_segments - 2) / 2; n_write_segs = (n_segments - 2) / 2;
n_read_segs = n_segments - 2 - n_write_segs; n_read_segs = n_segments - 2 - n_write_segs;
/* printf("Array n per seg %lu\n", n_per_seg); */ /* fprintf(stderr, "Array n per seg %lu\n", n_per_seg); */
os_aio_ibuf_array = os_aio_array_create(n_per_seg, 1); os_aio_ibuf_array = os_aio_array_create(n_per_seg, 1);
...@@ -1944,7 +1944,8 @@ loop: ...@@ -1944,7 +1944,8 @@ loop:
SIGRTMIN + 1 + os_aio_get_array_no(array); SIGRTMIN + 1 + os_aio_get_array_no(array);
/* TODO: How to choose the signal numbers? */ /* TODO: How to choose the signal numbers? */
/* /*
printf("AIO signal number %lu\n", (ulint) control->aio_sigevent.sigev_signo); fprintf(stderr, "AIO signal number %lu\n",
(ulint) control->aio_sigevent.sigev_signo);
*/ */
control->aio_sigevent.sigev_value.sival_ptr = slot; control->aio_sigevent.sigev_value.sival_ptr = slot;
#endif #endif
...@@ -2198,7 +2199,7 @@ try_again: ...@@ -2198,7 +2199,7 @@ try_again:
#elif defined(POSIX_ASYNC_IO) #elif defined(POSIX_ASYNC_IO)
slot->control.aio_lio_opcode = LIO_READ; slot->control.aio_lio_opcode = LIO_READ;
err = (ulint) aio_read(&(slot->control)); err = (ulint) aio_read(&(slot->control));
printf("Starting Posix aio read %lu\n", err); fprintf(stderr, "Starting POSIX aio read %lu\n", err);
#endif #endif
} else { } else {
if (!wake_later) { if (!wake_later) {
...@@ -2215,7 +2216,7 @@ try_again: ...@@ -2215,7 +2216,7 @@ try_again:
#elif defined(POSIX_ASYNC_IO) #elif defined(POSIX_ASYNC_IO)
slot->control.aio_lio_opcode = LIO_WRITE; slot->control.aio_lio_opcode = LIO_WRITE;
err = (ulint) aio_write(&(slot->control)); err = (ulint) aio_write(&(slot->control));
printf("Starting Posix aio write %lu\n", err); fprintf(stderr, "Starting POSIX aio write %lu\n", err);
#endif #endif
} else { } else {
if (!wake_later) { if (!wake_later) {
...@@ -2411,7 +2412,7 @@ os_aio_posix_handle( ...@@ -2411,7 +2412,7 @@ os_aio_posix_handle(
pthread_sigmask(0, NULL, &thr_sigset); pthread_sigmask(0, NULL, &thr_sigset);
for (i = 32 ; i < 40; i++) { for (i = 32 ; i < 40; i++) {
printf("%lu : %lu %lu\n", (ulint)i, fprintf(stderr, "%lu : %lu %lu\n", (ulint)i,
(ulint)sigismember(&proc_sigset, i), (ulint)sigismember(&proc_sigset, i),
(ulint)sigismember(&thr_sigset, i)); (ulint)sigismember(&thr_sigset, i));
} }
...@@ -2426,7 +2427,7 @@ os_aio_posix_handle( ...@@ -2426,7 +2427,7 @@ os_aio_posix_handle(
return(FALSE); return(FALSE);
} }
printf("Handling Posix aio\n"); fputs("Handling POSIX aio\n", stderr);
array = os_aio_get_array_from_no(array_no); array = os_aio_get_array_from_no(array_no);
...@@ -2719,9 +2720,9 @@ consecutive_loop: ...@@ -2719,9 +2720,9 @@ consecutive_loop:
ut_a(ret); ut_a(ret);
srv_set_io_thread_op_info(global_segment, "file i/o done"); srv_set_io_thread_op_info(global_segment, "file i/o done");
/* printf("aio: %lu consecutive %lu:th segment, first offs %lu blocks\n", /* fprintf(stderr,
n_consecutive, global_segment, slot->offset "aio: %lu consecutive %lu:th segment, first offs %lu blocks\n",
/ UNIV_PAGE_SIZE); */ n_consecutive, global_segment, slot->offset / UNIV_PAGE_SIZE); */
if (slot->type == OS_FILE_READ && n_consecutive > 1) { if (slot->type == OS_FILE_READ && n_consecutive > 1) {
/* Copy the combined buffer to individual buffers */ /* Copy the combined buffer to individual buffers */
...@@ -2847,8 +2848,7 @@ Prints info of the aio arrays. */ ...@@ -2847,8 +2848,7 @@ Prints info of the aio arrays. */
void void
os_aio_print( os_aio_print(
/*=========*/ /*=========*/
char* buf, /* in/out: buffer where to print */ FILE* file) /* in: file where to print */
char* buf_end)/* in: buffer end */
{ {
os_aio_array_t* array; os_aio_array_t* array;
os_aio_slot_t* slot; os_aio_slot_t* slot;
...@@ -2858,18 +2858,13 @@ os_aio_print( ...@@ -2858,18 +2858,13 @@ os_aio_print(
double avg_bytes_read; double avg_bytes_read;
ulint i; ulint i;
if (buf_end - buf < 1200) {
return;
}
for (i = 0; i < srv_n_file_io_threads; i++) { for (i = 0; i < srv_n_file_io_threads; i++) {
buf += sprintf(buf, "I/O thread %lu state: %s (%s)\n", i, fprintf(file, "I/O thread %lu state: %s (%s)\n", i,
srv_io_thread_op_info[i], srv_io_thread_op_info[i],
srv_io_thread_function[i]); srv_io_thread_function[i]);
} }
buf += sprintf(buf, "Pending normal aio reads:"); fputs("Pending normal aio reads:", file);
array = os_aio_read_array; array = os_aio_read_array;
loop: loop:
...@@ -2887,21 +2882,20 @@ loop: ...@@ -2887,21 +2882,20 @@ loop:
if (slot->reserved) { if (slot->reserved) {
n_reserved++; n_reserved++;
/* printf("Reserved slot, messages %lx %lx\n", /* fprintf(stderr, "Reserved slot, messages %p %p\n",
(ulint)slot->message1, slot->message1, slot->message2); */
(ulint)slot->message2); ut_a(slot->len > 0);
*/ ut_a(slot->len > 0);
} }
} }
ut_a(array->n_reserved == n_reserved); ut_a(array->n_reserved == n_reserved);
buf += sprintf(buf, " %lu", n_reserved); fprintf(file, " %lu", n_reserved);
os_mutex_exit(array->mutex); os_mutex_exit(array->mutex);
if (array == os_aio_read_array) { if (array == os_aio_read_array) {
buf += sprintf(buf, ", aio writes:"); fputs(", aio writes:", file);
array = os_aio_write_array; array = os_aio_write_array;
...@@ -2909,40 +2903,38 @@ loop: ...@@ -2909,40 +2903,38 @@ loop:
} }
if (array == os_aio_write_array) { if (array == os_aio_write_array) {
buf += sprintf(buf, ",\n ibuf aio reads:"); fputs(",\n ibuf aio reads:", file);
array = os_aio_ibuf_array; array = os_aio_ibuf_array;
goto loop; goto loop;
} }
if (array == os_aio_ibuf_array) { if (array == os_aio_ibuf_array) {
buf += sprintf(buf, ", log i/o's:"); fputs(", log i/o's:", file);
array = os_aio_log_array; array = os_aio_log_array;
goto loop; goto loop;
} }
if (array == os_aio_log_array) { if (array == os_aio_log_array) {
buf += sprintf(buf, ", sync i/o's:"); fputs(", sync i/o's:", file);
array = os_aio_sync_array; array = os_aio_sync_array;
goto loop; goto loop;
} }
buf += sprintf(buf, "\n"); putc('\n', file);
current_time = time(NULL); current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time, os_last_printout); time_elapsed = 0.001 + difftime(current_time, os_last_printout);
buf += sprintf(buf, fprintf(file,
"Pending flushes (fsync) log: %lu; buffer pool: %lu\n", "Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
fil_n_pending_log_flushes, fil_n_pending_tablespace_flushes);
buf += sprintf(buf,
"%lu OS file reads, %lu OS file writes, %lu OS fsyncs\n", "%lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
fil_n_pending_log_flushes, fil_n_pending_tablespace_flushes,
os_n_file_reads, os_n_file_writes, os_n_fsyncs); os_n_file_reads, os_n_file_writes, os_n_fsyncs);
if (os_file_n_pending_preads != 0 || os_file_n_pending_pwrites != 0) { if (os_file_n_pending_preads != 0 || os_file_n_pending_pwrites != 0) {
buf += sprintf(buf, fprintf(file,
"%lu pending preads, %lu pending pwrites\n", "%lu pending preads, %lu pending pwrites\n",
os_file_n_pending_preads, os_file_n_pending_pwrites); os_file_n_pending_preads, os_file_n_pending_pwrites);
} }
...@@ -2954,7 +2946,7 @@ loop: ...@@ -2954,7 +2946,7 @@ loop:
(os_n_file_reads - os_n_file_reads_old); (os_n_file_reads - os_n_file_reads_old);
} }
buf += sprintf(buf, fprintf(file,
"%.2f reads/s, %lu avg bytes/read, %.2f writes/s, %.2f fsyncs/s\n", "%.2f reads/s, %lu avg bytes/read, %.2f writes/s, %.2f fsyncs/s\n",
(os_n_file_reads - os_n_file_reads_old) (os_n_file_reads - os_n_file_reads_old)
/ time_elapsed, / time_elapsed,
......
...@@ -81,9 +81,8 @@ os_process_set_priority_boost( ...@@ -81,9 +81,8 @@ os_process_set_priority_boost(
/* Does not do anything currently! /* Does not do anything currently!
SetProcessPriorityBoost(GetCurrentProcess(), no_boost); SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
*/ */
printf( fputs("Warning: process priority boost setting currently not functional!\n",
"Warning: process priority boost setting currently not functional!\n" stderr);
);
#else #else
UT_NOT_USED(do_boost); UT_NOT_USED(do_boost);
#endif #endif
......
...@@ -187,7 +187,7 @@ os_thread_exit( ...@@ -187,7 +187,7 @@ os_thread_exit(
is cast as a DWORD */ is cast as a DWORD */
{ {
#ifdef UNIV_DEBUG_THREAD_CREATION #ifdef UNIV_DEBUG_THREAD_CREATION
printf("Thread exits, id %lu\n", fprintf(stderr, "Thread exits, id %lu\n",
os_thread_pf(os_thread_get_curr_id())); os_thread_pf(os_thread_get_curr_id()));
#endif #endif
os_mutex_enter(os_sync_mutex); os_mutex_enter(os_sync_mutex);
......
...@@ -704,14 +704,16 @@ page_cur_parse_insert_rec( ...@@ -704,14 +704,16 @@ page_cur_parse_insert_rec(
/* Build the inserted record to buf */ /* Build the inserted record to buf */
if (mismatch_index >= UNIV_PAGE_SIZE) { if (mismatch_index >= UNIV_PAGE_SIZE) {
printf("Is short %lu, info_bits %lu, offset %lu, o_offset %lu\n" fprintf(stderr,
"Is short %lu, info_bits %lu, offset %lu, "
"o_offset %lu\n"
"mismatch index %lu, end_seg_len %lu\n" "mismatch index %lu, end_seg_len %lu\n"
"parsed len %lu\n", "parsed len %lu\n",
is_short, info_bits, offset, origin_offset, is_short, info_bits, offset, origin_offset,
mismatch_index, end_seg_len, (ulint)(ptr - ptr2)); mismatch_index, end_seg_len, (ulint)(ptr - ptr2));
printf("Dump of 300 bytes of log:\n"); fputs("Dump of 300 bytes of log:\n", stderr);
ut_print_buf(ptr2, 300); ut_print_buf(stderr, ptr2, 300);
buf_page_print(page); buf_page_print(page);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -169,8 +169,8 @@ row_undo_search_clust_to_pcur( ...@@ -169,8 +169,8 @@ row_undo_search_clust_to_pcur(
is to make sure that some thread will eventually undo the is to make sure that some thread will eventually undo the
modification corresponding to node->roll_ptr. */ modification corresponding to node->roll_ptr. */
/* printf("--------------------undoing a previous version\n"); /* fputs("--------------------undoing a previous version\n",
*/ stderr); */
ret = FALSE; ret = FALSE;
} else { } else {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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