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(
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.
It is assumed that mtr holds an x-latch on the page. The operation does
......@@ -877,18 +895,13 @@ btr_cur_optimistic_insert(
index = cursor->index;
if (!dtuple_check_typed_no_assert(entry)) {
fprintf(stderr,
"InnoDB: Error in a tuple to insert into table %s index %s\n",
index->table_name, index->name);
fputs("InnoDB: Error in a tuple to insert into ", stderr);
dict_index_name_print(stderr, index);
}
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to insert to table %s index %s\n",
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);
btr_cur_trx_report(thr_get_trx(thr), index, "insert into ");
dtuple_print(stderr, entry);
}
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
......@@ -981,20 +994,15 @@ btr_cur_optimistic_insert(
*rec = page_cur_tuple_insert(page_cursor, entry, mtr);
if (!(*rec)) {
char* err_buf = mem_alloc(1000);
dtuple_sprintf(err_buf, 900, entry);
fprintf(stderr,
"InnoDB: Error: cannot insert tuple %s to index %s of table %s\n"
"InnoDB: max insert size %lu\n",
err_buf, index->name, index->table->name, max_size);
mem_free(err_buf);
if (!*rec) {
fputs("InnoDB: Error: cannot insert tuple ", stderr);
dtuple_print(stderr, entry);
fputs(" into ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, "\nInnoDB: max insert size %lu\n",
max_size);
ut_error;
}
ut_a(*rec); /* <- We calculated above the record would fit */
}
#ifdef BTR_CUR_HASH_ADAPT
......@@ -1010,7 +1018,8 @@ btr_cur_optimistic_insert(
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,
rec_size + PAGE_DIR_SLOT_SIZE, type);
*/
......@@ -1361,12 +1370,8 @@ btr_cur_update_in_place(
trx = thr_get_trx(thr);
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to update table %s index %s\n",
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);
btr_cur_trx_report(trx, index, "update ");
rec_print(stderr, rec);
}
/* Do lock checking and undo logging */
......@@ -1465,12 +1470,8 @@ btr_cur_optimistic_update(
index = cursor->index;
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to update table %s index %s\n",
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);
btr_cur_trx_report(thr_get_trx(thr), index, "update ");
rec_print(stderr, rec);
}
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
......@@ -2012,12 +2013,8 @@ btr_cur_del_mark_set_clust_rec(
index = cursor->index;
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to del mark table %s index %s\n",
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);
btr_cur_trx_report(thr_get_trx(thr), index, "del mark ");
rec_print(stderr, rec);
}
ut_ad(index->type & DICT_CLUSTERED);
......@@ -2152,12 +2149,9 @@ btr_cur_del_mark_set_sec_rec(
rec = btr_cur_get_rec(cursor);
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to del mark table %s index %s\n",
ut_dulint_get_high(thr_get_trx(thr)->id),
ut_dulint_get_low(thr_get_trx(thr)->id),
cursor->index->table_name, cursor->index->name);
rec_print(rec);
btr_cur_trx_report(thr_get_trx(thr), cursor->index,
"del mark ");
rec_print(stderr, rec);
}
err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index,
......
......@@ -803,7 +803,7 @@ btr_search_guess_on_hash(
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(btr_page_get_index_id(page)),
fold);
......@@ -1045,7 +1045,7 @@ btr_search_drop_page_hash_when_freed(
/* We assume that if the caller has a latch on 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
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);
......@@ -1515,8 +1515,9 @@ btr_search_update_hash_on_insert(
ha_insert_for_fold(table, ins_fold, ins_rec);
/*
printf("Hash insert for %s, fold %lu\n",
cursor->index->name, ins_fold);
fputs("Hash insert for ", stderr);
dict_index_name_print(stderr, cursor->index);
fprintf(stderr, " fold %lu\n", ins_fold);
*/
} else {
ha_insert_for_fold(table, next_fold, next_rec);
......@@ -1543,7 +1544,6 @@ btr_search_validate(void)
ulint n_page_dumps = 0;
ibool ok = TRUE;
ulint i;
char rec_str[500];
rw_lock_x_lock(&btr_search_latch);
......@@ -1564,9 +1564,9 @@ btr_search_validate(void)
fprintf(stderr,
" 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",
buf_frame_get_page_no(page),
(ulint)(node->data),
"ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n",
buf_frame_get_page_no(page),
node->data,
ut_dulint_get_high(btr_page_get_index_id(page)),
ut_dulint_get_low(btr_page_get_index_id(page)),
node->fold, rec_fold((rec_t*)(node->data),
......@@ -1574,16 +1574,12 @@ btr_search_validate(void)
block->curr_n_bytes,
btr_page_get_index_id(page)));
rec_sprintf(rec_str, 450, (rec_t*)(node->data));
fprintf(stderr,
"InnoDB: Record %s\n"
"InnoDB: on that page.", rec_str);
fprintf(stderr,
"Page mem address %lu, is hashed %lu, n fields %lu, n bytes %lu\n"
fputs("InnoDB: Record ", stderr);
rec_print(stderr, (rec_t*)(node->data));
fprintf(stderr, "\nInnoDB: on that page."
"Page mem address %p, is hashed %lu, n fields %lu, n bytes %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);
if (n_page_dumps < 20) {
......
......@@ -348,19 +348,12 @@ buf_page_print(
dict_index_t* index;
ulint checksum;
ulint old_checksum;
char* buf;
buf = mem_alloc(4 * UNIV_PAGE_SIZE);
ut_sprintf_buf(buf, read_buf, UNIV_PAGE_SIZE);
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Page dump in ascii and hex (%lu bytes):\n%s",
(ulint)UNIV_PAGE_SIZE, buf);
fprintf(stderr, "InnoDB: End of page dump\n");
mem_free(buf);
fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n",
(ulint)UNIV_PAGE_SIZE);
ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE);
fputs("InnoDB: End of page dump\n", stderr);
checksum = buf_calc_page_new_checksum(read_buf);
old_checksum = buf_calc_page_old_checksum(read_buf);
......@@ -407,18 +400,17 @@ buf_page_print(
index = dict_index_find_on_id_low(
btr_page_get_index_id(read_buf));
if (index) {
fprintf(stderr,
"InnoDB: and table %s index %s\n",
index->table_name,
index->name);
fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, index);
fputs(")\n", stderr);
}
}
} else if (fil_page_get_type(read_buf) == FIL_PAGE_INODE) {
fprintf(stderr, "InnoDB: Page may be an 'inode' page\n");
fputs("InnoDB: Page may be an 'inode' page\n", stderr);
} else if (fil_page_get_type(read_buf) == FIL_PAGE_IBUF_FREE_LIST) {
fprintf(stderr,
"InnoDB: Page may be an insert buffer free list page\n");
fputs("InnoDB: Page may be an insert buffer free list page\n",
stderr);
}
}
......@@ -1464,8 +1456,8 @@ buf_page_create(
/* If we get here, the page was not in buf_pool: init it there */
if (buf_debug_prints) {
printf("Creating space %lu page %lu to buffer\n", space,
offset);
fprintf(stderr, "Creating space %lu page %lu to buffer\n",
space, offset);
}
block = free_block;
......@@ -1519,8 +1511,6 @@ buf_page_io_complete(
/*=================*/
buf_block_t* block) /* in: pointer to the block in question */
{
dict_index_t* index;
dulint id;
ulint io_type;
ulint read_page_no;
......@@ -1551,17 +1541,17 @@ buf_page_io_complete(
"InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", block->offset);
fprintf(stderr,
"InnoDB: You may have to recover from a backup.\n");
fputs(
"InnoDB: You may have to recover from a backup.\n", stderr);
buf_page_print(block->frame);
fprintf(stderr,
"InnoDB: Database page corruption on disk or a failed\n"
"InnoDB: file read of page %lu.\n", block->offset);
fprintf(stderr,
"InnoDB: You may have to recover from a backup.\n");
fprintf(stderr,
fputs(
"InnoDB: You may have to recover from a backup.\n", stderr);
fputs(
"InnoDB: It is also possible that your operating\n"
"InnoDB: system has corrupted its own file cache\n"
"InnoDB: and rebooting your computer removes the\n"
......@@ -1572,12 +1562,13 @@ buf_page_io_complete(
"InnoDB: the corrupt table. You can use CHECK\n"
"InnoDB: TABLE to scan your table for corruption.\n"
"InnoDB: Look also at section 6.1 of\n"
"InnoDB: http://www.innodb.com/ibman.html about\n"
"InnoDB: forcing recovery.\n");
"InnoDB: http://www.innodb.com/ibman.php about\n"
"InnoDB: forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fprintf(stderr,
"InnoDB: Ending processing because of a corrupt database page.\n");
fputs(
"InnoDB: Ending processing because of a corrupt database page.\n",
stderr);
exit(1);
}
}
......@@ -1619,7 +1610,7 @@ buf_page_io_complete(
rw_lock_x_unlock_gen(&(block->read_lock), BUF_IO_READ);
if (buf_debug_prints) {
printf("Has read ");
fputs("Has read ", stderr);
}
} else {
ut_ad(io_type == BUF_IO_WRITE);
......@@ -1634,29 +1625,15 @@ buf_page_io_complete(
buf_pool->n_pages_written++;
if (buf_debug_prints) {
printf("Has written ");
fputs("Has written ", stderr);
}
}
mutex_exit(&(buf_pool->mutex));
if (buf_debug_prints) {
printf("page space %lu page no %lu", block->space,
block->offset);
id = btr_page_get_index_id(block->frame);
index = NULL;
/* The following can cause deadlocks if used: */
/*
index = dict_index_get_if_in_cache(id);
if (index) {
printf(" index name %s table %s", index->name,
index->table->name);
}
*/
printf("\n");
fprintf(stderr, "page space %lu page no %lu\n",
block->space, block->offset);
}
}
......@@ -1757,14 +1734,14 @@ buf_validate(void)
}
if (n_lru + n_free > buf_pool->curr_size) {
printf("n LRU %lu, n free %lu\n", n_lru, n_free);
fprintf(stderr, "n LRU %lu, n free %lu\n", n_lru, n_free);
ut_error;
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
printf("Free list len %lu, free blocks %lu\n",
UT_LIST_GET_LEN(buf_pool->free), n_free);
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
UT_LIST_GET_LEN(buf_pool->free), n_free);
ut_error;
}
ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
......@@ -1807,22 +1784,24 @@ buf_print(void)
mutex_enter(&(buf_pool->mutex));
printf("buf_pool size %lu \n", size);
printf("database pages %lu \n", UT_LIST_GET_LEN(buf_pool->LRU));
printf("free pages %lu \n", UT_LIST_GET_LEN(buf_pool->free));
printf("modified database pages %lu \n",
UT_LIST_GET_LEN(buf_pool->flush_list));
printf("n pending reads %lu \n", buf_pool->n_pend_reads);
printf("n pending flush LRU %lu list %lu single page %lu\n",
fprintf(stderr,
"buf_pool size %lu \n"
"database pages %lu \n"
"free pages %lu \n"
"modified database pages %lu \n"
"n pending reads %lu \n"
"n pending flush LRU %lu list %lu single page %lu\n"
"pages read %lu, created %lu, written %lu\n",
size,
UT_LIST_GET_LEN(buf_pool->LRU),
UT_LIST_GET_LEN(buf_pool->free),
UT_LIST_GET_LEN(buf_pool->flush_list),
buf_pool->n_pend_reads,
buf_pool->n_flush[BUF_FLUSH_LRU],
buf_pool->n_flush[BUF_FLUSH_LIST],
buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
printf("pages read %lu, created %lu, written %lu\n",
buf_pool->n_pages_read, buf_pool->n_pages_created,
buf_pool->n_pages_written);
buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE],
buf_pool->n_pages_read, buf_pool->n_pages_created,
buf_pool->n_pages_written);
/* Count the number of blocks belonging to each index in the buffer */
......@@ -1865,15 +1844,16 @@ buf_print(void)
for (i = 0; i < n_found; i++) {
index = dict_index_get_if_in_cache(index_ids[i]);
printf("Block count for index %lu in buffer is about %lu",
fprintf(stderr,
"Block count for index %lu in buffer is about %lu",
ut_dulint_get_low(index_ids[i]), counts[i]);
if (index) {
printf(" index name %s table %s", index->name,
index->table->name);
putc(' ', stderr);
dict_index_name_print(stderr, index);
}
printf("\n");
putc('\n', stderr);
}
mem_free(index_ids);
......@@ -1924,44 +1904,29 @@ Prints info of the buffer i/o. */
void
buf_print_io(
/*=========*/
char* buf, /* in/out: buffer where to print */
char* buf_end)/* in: buffer end */
FILE* file) /* in/out: buffer where to print */
{
time_t current_time;
double time_elapsed;
ulint size;
ut_ad(buf_pool);
if (buf_end - buf < 400) {
return;
}
size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE;
mutex_enter(&(buf_pool->mutex));
buf += sprintf(buf,
"Buffer pool size %lu\n", size);
buf += sprintf(buf,
"Free buffers %lu\n", UT_LIST_GET_LEN(buf_pool->free));
buf += sprintf(buf,
"Database pages %lu\n", UT_LIST_GET_LEN(buf_pool->LRU));
/*
buf += sprintf(buf,
"Lock heap buffers %lu\n", buf_pool->n_lock_heap_pages);
buf += sprintf(buf,
"Hash index buffers %lu\n", buf_pool->n_adaptive_hash_pages);
*/
buf += sprintf(buf,
"Modified db pages %lu\n",
UT_LIST_GET_LEN(buf_pool->flush_list));
buf += sprintf(buf, "Pending reads %lu \n", buf_pool->n_pend_reads);
buf += sprintf(buf,
fprintf(file,
"Buffer pool size %lu\n"
"Free buffers %lu\n"
"Database pages %lu\n"
"Modified db pages %lu\n"
"Pending reads %lu \n"
"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
size,
UT_LIST_GET_LEN(buf_pool->free),
UT_LIST_GET_LEN(buf_pool->LRU),
UT_LIST_GET_LEN(buf_pool->flush_list),
buf_pool->n_pend_reads,
buf_pool->n_flush[BUF_FLUSH_LRU]
+ buf_pool->init_flush[BUF_FLUSH_LRU],
buf_pool->n_flush[BUF_FLUSH_LIST]
......@@ -1973,10 +1938,11 @@ buf_print_io(
buf_pool->last_printout_time);
buf_pool->last_printout_time = current_time;
buf += sprintf(buf, "Pages read %lu, created %lu, written %lu\n",
buf_pool->n_pages_read, buf_pool->n_pages_created,
buf_pool->n_pages_written);
buf += sprintf(buf, "%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
fprintf(file,
"Pages read %lu, created %lu, written %lu\n"
"%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
buf_pool->n_pages_read, buf_pool->n_pages_created,
buf_pool->n_pages_written,
(buf_pool->n_pages_read - buf_pool->n_pages_read_old)
/ time_elapsed,
(buf_pool->n_pages_created - buf_pool->n_pages_created_old)
......@@ -1985,14 +1951,14 @@ buf_print_io(
/ time_elapsed);
if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
buf += sprintf(buf, "Buffer pool hit rate %lu / 1000\n",
fprintf(file, "Buffer pool hit rate %lu / 1000\n",
1000
- ((1000 *
(buf_pool->n_pages_read - buf_pool->n_pages_read_old))
/ (buf_pool->n_page_gets - buf_pool->n_page_gets_old)));
} else {
buf += sprintf(buf,
"No buffer pool page gets since the last printout\n");
fputs("No buffer pool page gets since the last printout\n",
file);
}
buf_pool->n_page_gets_old = buf_pool->n_page_gets;
......@@ -2039,8 +2005,9 @@ buf_all_freed(void)
if (!buf_flush_ready_for_replace(block)) {
/* printf("Page %lu %lu still fixed or dirty\n",
block->space, block->offset); */
fprintf(stderr,
"Page %lu %lu still fixed or dirty\n",
block->space, block->offset);
ut_error;
}
}
......
......@@ -189,7 +189,7 @@ buf_flush_write_complete(
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]); */
if ((buf_pool->n_flush[block->flush_type] == 0)
......@@ -411,8 +411,8 @@ buf_flush_write_block_low(
ut_ad(!ut_dulint_is_zero(block->newest_modification));
#ifdef UNIV_LOG_DEBUG
printf(
"Warning: cannot force log to disk in the log debug version!\n");
fputs("Warning: cannot force log to disk in the log debug version!\n",
stderr);
#else
/* Force the log to the disk before writing the modified block */
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
......@@ -489,8 +489,9 @@ buf_flush_try_page(
}
if (buf_debug_prints) {
printf("Flushing page space %lu, page no %lu \n",
block->space, block->offset);
fprintf(stderr,
"Flushing page space %lu, page no %lu \n",
block->space, block->offset);
}
buf_flush_write_block_low(block);
......@@ -548,7 +549,7 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
if (buf_debug_prints) {
printf(
fprintf(stderr,
"Flushing single page space %lu, page no %lu \n",
block->space, block->offset);
}
......@@ -592,7 +593,7 @@ buf_flush_try_neighbors(
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)) {
high = fil_space_get_size(space);
......@@ -739,7 +740,7 @@ buf_flush_batch(
page_count +=
buf_flush_try_neighbors(space, offset,
flush_type);
/* printf(
/* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,
page_count - old_page_count); */
......@@ -779,15 +780,12 @@ buf_flush_batch(
buf_flush_buffered_writes();
if (buf_debug_prints && page_count > 0) {
if (flush_type == BUF_FLUSH_LRU) {
printf("Flushed %lu pages in LRU flush\n",
page_count);
} else if (flush_type == BUF_FLUSH_LIST) {
printf("Flushed %lu pages in flush list flush\n",
page_count);
} else {
ut_error;
}
ut_a(flush_type == BUF_FLUSH_LRU
|| flush_type == BUF_FLUSH_LIST);
fprintf(stderr, flush_type == BUF_FLUSH_LRU
? "Flushed %lu pages in LRU flush\n"
: "Flushed %lu pages in flush list flush\n",
page_count);
}
return(page_count);
......
......@@ -126,7 +126,7 @@ buf_LRU_search_and_free_block(
if (buf_flush_ready_for_replace(block)) {
if (buf_debug_prints) {
printf(
fprintf(stderr,
"Putting space %lu page %lu to free list\n",
block->space, block->offset);
}
......@@ -301,26 +301,20 @@ buf_LRU_get_free_block(void)
fprintf(stderr,
"InnoDB: Warning: difficult to find free blocks from\n"
"InnoDB: the buffer pool (%lu search iterations)! Consider\n"
"InnoDB: increasing the buffer pool size.\n",
n_iterations);
fprintf(stderr,
"InnoDB: increasing the buffer pool size.\n"
"InnoDB: It is also possible that in your Unix version\n"
"InnoDB: fsync is very slow, or completely frozen inside\n"
"InnoDB: the OS kernel. Then upgrading to a newer version\n"
"InnoDB: of your operating system may help. Look at the\n"
"InnoDB: number of fsyncs in diagnostic info below.\n");
fprintf(stderr,
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n",
fil_n_pending_log_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);
fprintf(stderr,
"InnoDB: number of fsyncs in diagnostic info below.\n"
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n"
"InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n");
"InnoDB: diagnostics to the standard output.\n",
n_iterations,
fil_n_pending_log_flushes,
fil_n_pending_tablespace_flushes,
os_n_file_reads, os_n_file_writes, os_n_fsyncs);
mon_value_was = srv_print_innodb_monitor;
started_monitor = TRUE;
......@@ -797,7 +791,7 @@ buf_LRU_print(void)
ut_ad(buf_pool);
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);
......@@ -805,37 +799,37 @@ buf_LRU_print(void)
while (block != NULL) {
printf("BLOCK %lu ", block->offset);
fprintf(stderr, "BLOCK %lu ", block->offset);
if (block->old) {
printf("old ");
fputs("old ", stderr);
}
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) {
printf("io_fix %lu ", block->io_fix);
fprintf(stderr, "io_fix %lu ", block->io_fix);
}
if (ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero) > 0) {
printf("modif. ");
fputs("modif. ", stderr);
}
printf("LRU pos %lu ", block->LRU_position);
frame = buf_block_get_frame(block);
printf("type %lu ", fil_page_get_type(frame));
printf("index id %lu ", ut_dulint_get_low(
btr_page_get_index_id(frame)));
fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
block->LRU_position,
fil_page_get_type(frame),
ut_dulint_get_low(btr_page_get_index_id(frame)));
block = UT_LIST_GET_NEXT(LRU, block);
len++;
if (len % 10 == 0) {
printf("\n");
if (++len == 10) {
len = 0;
putc('\n', stderr);
}
}
......
......@@ -81,7 +81,8 @@ buf_read_page_low(
log mutex: the read must be handled before other reads
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;
}
......@@ -101,7 +102,8 @@ buf_read_page_low(
if (block != NULL) {
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);
}
......@@ -241,8 +243,8 @@ buf_read_ahead_random(
os_aio_simulated_wake_handler_threads();
if (buf_debug_prints && (count > 0)) {
printf("Random read-ahead space %lu offset %lu pages %lu\n",
fprintf(stderr,
"Random read-ahead space %lu offset %lu pages %lu\n",
space, offset, count);
}
......@@ -499,7 +501,7 @@ buf_read_ahead_linear(
buf_flush_free_margin();
if (buf_debug_prints && (count > 0)) {
printf(
fprintf(stderr,
"LINEAR read-ahead space %lu offset %lu pages %lu\n",
space, offset, count);
}
......@@ -548,7 +550,8 @@ buf_read_ibuf_merge_pages(
buf_flush_free_margin();
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);
}
}
......@@ -611,6 +614,7 @@ buf_read_recv_pages(
buf_flush_free_margin();
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
#include "data0data.ic"
#endif
#include "ut0rnd.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "page0page.h"
......@@ -22,8 +21,10 @@ Created 5/30/1994 Heikki Tuuri
byte data_error; /* data pointers of tuple fields are initialized
to point here for error checking */
#ifdef UNIV_DEBUG
ulint data_dummy; /* this is used to fool the compiler in
dtuple_validate */
#endif /* UNIV_DEBUG */
/* Some non-inlined functions used in the MySQL interface: */
void
......@@ -210,16 +211,15 @@ dtuple_check_typed_no_assert(
{
dfield_t* field;
ulint i;
char err_buf[1000];
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
fprintf(stderr,
"InnoDB: Error: index entry has %lu fields\n",
dtuple_get_n_fields(tuple));
dtuple_sprintf(err_buf, 900, tuple);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
dump:
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, tuple);
putc('\n', stderr);
return(FALSE);
}
......@@ -229,12 +229,7 @@ dtuple_check_typed_no_assert(
field = dtuple_get_nth_field(tuple, i);
if (!dfield_check_typed_no_assert(field)) {
dtuple_sprintf(err_buf, 900, tuple);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
return(FALSE);
goto dump;
}
}
......@@ -285,6 +280,7 @@ dtuple_check_typed(
return(TRUE);
}
#ifdef UNIV_DEBUG
/**************************************************************
Validates the consistency of a tuple which must be complete, i.e,
all fields must have been set. */
......@@ -332,6 +328,7 @@ dtuple_validate(
return(TRUE);
}
#endif /* UNIV_DEBUG */
/*****************************************************************
Pretty prints a dfield value according to its data type. */
......@@ -350,7 +347,7 @@ dfield_print(
data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) {
printf("NULL");
fputs("NULL", stderr);
return;
}
......@@ -360,18 +357,12 @@ dfield_print(
if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) {
for (i = 0; i < len; i++) {
if (isprint((char)(*data))) {
printf("%c", (char)*data);
} else {
printf(" ");
}
data++;
int c = *data++;
putc(isprint(c) ? c : ' ', stderr);
}
} else if (mtype == DATA_INT) {
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 {
ut_error;
}
......@@ -396,7 +387,7 @@ dfield_print_also_hex(
data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) {
printf("NULL");
fputs("NULL", stderr);
return;
}
......@@ -408,15 +399,12 @@ dfield_print_also_hex(
print_also_hex = FALSE;
for (i = 0; i < len; i++) {
if (isprint((char)(*data))) {
printf("%c", (char)*data);
} else {
int c = *data++;
if (!isprint(c)) {
print_also_hex = TRUE;
printf(" ");
c = ' ';
}
data++;
putc(c, stderr);
}
if (!print_also_hex) {
......@@ -424,18 +412,18 @@ dfield_print_also_hex(
return;
}
printf(" Hex: ");
fputs(" Hex: ", stderr);
data = dfield_get_data(dfield);
for (i = 0; i < len; i++) {
printf("%02lx", (ulint)*data);
fprintf(stderr, "%02lx", (ulint)*data);
data++;
}
} else if (mtype == DATA_INT) {
ut_a(len == 4); /* inly works for 32-bit integers */
printf("%i", (int)mach_read_from_4(data));
ut_a(len == 4); /* only works for 32-bit integers */
fprintf(stderr, "%d", (int)mach_read_from_4(data));
} else {
ut_error;
}
......@@ -447,6 +435,7 @@ The following function prints the contents of a tuple. */
void
dtuple_print(
/*=========*/
FILE* f, /* in: output stream */
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
......@@ -455,73 +444,24 @@ dtuple_print(
n_fields = dtuple_get_n_fields(tuple);
printf("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);
fprintf(f, "DATA TUPLE: %lu fields;\n", n_fields);
for (i = 0; i < n_fields; i++) {
if (len + 30 > buf_len) {
return(len);
}
len += sprintf(buf + len, " %lu:", i);
fprintf(f, " %lu:", i);
field = dtuple_get_nth_field(tuple, i);
if (field->len != UNIV_SQL_NULL) {
if (5 * field->len + len + 30 > buf_len) {
return(len);
}
len += ut_sprintf_buf(buf + len, field->data,
field->len);
ut_print_buf(f, field->data, field->len);
} 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(
ibool is_externally_stored;
ulint i;
ulint j;
char err_buf[1000];
ut_a(dtuple_check_typed_no_assert(entry));
......@@ -564,10 +503,9 @@ dtuple_convert_big_rec(
if (size > 1000000000) {
fprintf(stderr,
"InnoDB: Warning: tuple size very big: %lu\n", size);
dtuple_sprintf(err_buf, 900, entry);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, entry);
putc('\n', stderr);
}
heap = mem_heap_create(size + dtuple_get_n_fields(entry)
......
......@@ -51,19 +51,19 @@ dtype_print(
mtype = type->mtype;
prtype = type->prtype;
if (mtype == DATA_VARCHAR) {
printf("DATA_VARCHAR");
fputs("DATA_VARCHAR", stderr);
} else if (mtype == DATA_CHAR) {
printf("DATA_CHAR");
fputs("DATA_CHAR", stderr);
} else if (mtype == DATA_BINARY) {
printf("DATA_BINARY");
fputs("DATA_BINARY", stderr);
} else if (mtype == DATA_INT) {
printf("DATA_INT");
fputs("DATA_INT", stderr);
} else if (mtype == DATA_MYSQL) {
printf("DATA_MYSQL");
fputs("DATA_MYSQL", stderr);
} else if (mtype == DATA_SYS) {
printf("DATA_SYS");
fputs("DATA_SYS", stderr);
} else {
printf("type %lu", mtype);
fprintf(stderr, "type %lu", mtype);
}
len = type->len;
......@@ -71,24 +71,24 @@ dtype_print(
if ((type->mtype == DATA_SYS)
|| (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) {
printf(" ");
putc(' ', stderr);
if (prtype == DATA_ROW_ID) {
printf("DATA_ROW_ID");
fputs("DATA_ROW_ID", stderr);
len = DATA_ROW_ID_LEN;
} else if (prtype == DATA_ROLL_PTR) {
printf("DATA_ROLL_PTR");
fputs("DATA_ROLL_PTR", stderr);
len = DATA_ROLL_PTR_LEN;
} else if (prtype == DATA_TRX_ID) {
printf("DATA_TRX_ID");
fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) {
printf("DATA_MIX_ID");
fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) {
printf("DATA_ENGLISH");
fputs("DATA_ENGLISH", stderr);
} 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(
compile wrong */
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);
......
......@@ -25,11 +25,6 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0roll.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
in the SYS_TABLES system table. */
......@@ -1105,7 +1100,7 @@ dict_create_add_foreigns_to_dictionary(
ulint number = start_id + 1;
ulint len;
ulint error;
char* ebuf = dict_foreign_err_buf;
FILE* ef = dict_foreign_err_file;
ulint i;
char* sql;
char* sqlend;
......@@ -1223,14 +1218,17 @@ dict_create_add_foreigns_to_dictionary(
if (error == DB_DUPLICATE_KEY) {
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN
- MAX_TABLE_NAME_LEN - MAX_IDENTIFIER_LEN - 201);
sprintf(ebuf + strlen(ebuf),
" Error in foreign key constraint creation for table %s.\n"
"A foreign key constraint of name %s\n"
"already exists (note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n", table->name, foreign->id);
rewind(ef);
ut_print_timestamp(ef);
fputs(" Error in foreign key constraint creation for table ",
ef);
ut_print_name(ef, table->name);
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, 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);
......@@ -1243,12 +1241,12 @@ dict_create_add_foreigns_to_dictionary(
"InnoDB: internal error number %lu\n", error);
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN
- MAX_TABLE_NAME_LEN - 124);
sprintf(ebuf + strlen(ebuf),
" Internal error in foreign key constraint creation for table %s.\n"
"See the MySQL .err log in the datadir for more information.\n", table->name);
ut_print_timestamp(ef);
fputs(" Internal error in foreign key constraint creation"
" for table ", ef);
ut_print_name(ef, table->name);
fputs(".\n"
"See the MySQL .err log in the datadir for more information.\n", ef);
mutex_exit(&dict_foreign_err_mutex);
return(error);
......
This diff is collapsed.
......@@ -162,8 +162,9 @@ dict_print(void)
mem_free(table_name);
if (table == NULL) {
fprintf(stderr, "InnoDB: Failed to load table %s\n",
table_name);
fputs("InnoDB: Failed to load table ", stderr);
ut_print_namel(stderr, field, len);
putc('\n', stderr);
} else {
/* The table definition was corrupt if there
is no index */
......@@ -279,6 +280,27 @@ dict_load_columns(
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. */
static
......@@ -331,10 +353,7 @@ dict_load_fields(
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
if (rec_get_deleted_flag(rec)) {
fprintf(stderr,
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n"
"InnoDB: An index field is delete marked.\n",
table->name);
dict_load_report_deleted_index(table->name, i);
}
field = rec_get_nth_field(rec, 0, &len);
......@@ -457,10 +476,8 @@ dict_load_indexes(
}
if (rec_get_deleted_flag(rec)) {
fprintf(stderr,
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n"
"InnoDB: An index is delete marked.\n",
table->name);
dict_load_report_deleted_index(table->name,
ULINT_UNDEFINED);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -499,11 +516,13 @@ dict_load_indexes(
if (page_no == FIL_NULL) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s for table %s\n"
"InnoDB: but the index tree has been freed!\n",
name_buf, table->name);
fputs("InnoDB: Error: trying to load index ", stderr);
ut_print_name(stderr, name_buf);
fputs(" for table ", stderr);
ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the index tree has been freed!\n", stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -513,10 +532,12 @@ dict_load_indexes(
if ((type & DICT_CLUSTERED) == 0
&& NULL == dict_table_get_first_index(table)) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s for table %s\n"
"InnoDB: but the first index was not clustered!\n",
name_buf, table->name);
fputs("InnoDB: Error: trying to load index ", stderr);
ut_print_namel(stderr, name_buf, name_len);
fputs(" for table ", stderr);
ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the first index is not clustered!\n", stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -947,8 +968,10 @@ dict_load_foreign(
|| rec_get_deleted_flag(rec)) {
/* Not found */
fprintf(stderr,
"InnoDB: Error A: cannot load foreign constraint %s\n", id);
fputs("InnoDB: Error A: cannot load foreign constraint ",
stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -962,8 +985,10 @@ dict_load_foreign(
/* Check if the id in record is the searched one */
if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
fprintf(stderr,
"InnoDB: Error B: cannot load foreign constraint %s\n", id);
fputs("InnoDB: Error B: cannot load foreign constraint ",
stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......
......@@ -311,12 +311,13 @@ eval_predefined_2(
arg = que_node_get_next(arg);
}
printf("\n");
putc('\n', stderr);
} else if (func == PARS_ASSERT_TOKEN) {
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));
......
......@@ -1408,8 +1408,9 @@ fil_flush(
will not crash or trap even if we pass a handle
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);
mutex_enter(&(system->mutex));
......
......@@ -1273,7 +1273,7 @@ fsp_alloc_free_page(
hint % FSP_EXTENT_SIZE, mtr);
if (free == ULINT_UNDEFINED) {
ut_print_buf(((byte*)descr) - 500, 1000);
ut_print_buf(stderr, ((byte*)descr) - 500, 1000);
ut_error;
}
......@@ -1332,11 +1332,10 @@ fsp_free_page(
xdes_t* descr;
ulint state;
ulint frag_n_used;
char buf[1000];
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);
......@@ -1348,9 +1347,9 @@ fsp_free_page(
fprintf(stderr,
"InnoDB: Error: File space extent descriptor of page %lu has state %lu\n",
page, state);
ut_sprintf_buf(buf, ((byte*)descr) - 50, 200);
fprintf(stderr, "InnoDB: Dump of descriptor: %s\n", buf);
fputs("InnoDB: Dump of descriptor: ", stderr);
ut_print_buf(stderr, ((byte*)descr) - 50, 200);
putc('\n', stderr);
if (state == XDES_FREE) {
/* We put here some fault tolerance: if the page
......@@ -1362,14 +1361,12 @@ fsp_free_page(
ut_error;
}
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)
== TRUE) {
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
fprintf(stderr,
"InnoDB: Error: File space extent descriptor of page %lu says it is free\n",
page);
ut_sprintf_buf(buf, ((byte*)descr) - 50, 200);
fprintf(stderr, "InnoDB: Dump of descriptor: %s\n", buf);
"InnoDB: Error: File space extent descriptor of page %lu says it is free\n"
"InnoDB: Dump of descriptor: ", page);
ut_print_buf(stderr, ((byte*)descr) - 50, 200);
putc('\n', stderr);
/* We put here some fault tolerance: if the page
is already free, return without doing anything! */
......@@ -1427,7 +1424,7 @@ fsp_free_extent(
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;
}
......@@ -2672,7 +2669,6 @@ fseg_free_page_low(
ulint not_full_n_used;
ulint state;
ulint i;
char errbuf[200];
#ifdef __WIN__
dulint desm;
......@@ -2692,22 +2688,22 @@ fseg_free_page_low(
descr = xdes_get_descriptor(space, page, mtr);
ut_a(descr);
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)
!= FALSE) {
ut_sprintf_buf(errbuf, descr, 40);
fprintf(stderr,
"InnoDB: Dump of the tablespace extent descriptor: %s\n", errbuf);
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
stderr);
ut_print_buf(stderr, descr, 40);
fprintf(stderr,
fprintf(stderr, "\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: The tablespace free space info is corrupt.\n"
"InnoDB: You may need to dump your InnoDB tables and recreate the whole\n"
"InnoDB: database!\n", page);
fprintf(stderr,
crash:
fputs(
"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;
}
......@@ -2751,12 +2747,12 @@ fseg_free_page_low(
mtr_read_dulint(descr + XDES_ID, mtr),
mtr_read_dulint(seg_inode + FSEG_ID, mtr))) {
ut_sprintf_buf(errbuf, descr, 40);
fprintf(stderr,
"InnoDB: Dump of the tablespace extent descriptor: %s\n", errbuf);
ut_sprintf_buf(errbuf, seg_inode, 40);
fprintf(stderr,
"InnoDB: Dump of the segment inode: %s\n", errbuf);
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
stderr);
ut_print_buf(stderr, descr, 40);
fputs("\nInnoDB: Dump of the segment inode: ", stderr);
ut_print_buf(stderr, seg_inode, 40);
putc('\n', stderr);
#ifndef __WIN__
......@@ -2794,11 +2790,7 @@ fseg_free_page_low(
ut_dulint_get_low(segm));
#endif
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;
goto crash;
}
not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
......@@ -3311,12 +3303,11 @@ fseg_print_low(
n_not_full = flst_get_len(inode + FSEG_NOT_FULL, mtr);
n_full = flst_get_len(inode + FSEG_FULL, mtr);
printf(
"SEGMENT id %lu %lu space %lu; page %lu; res %lu used %lu; full ext %lu\n",
fprintf(stderr,
"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,
n_full);
printf(
"fragm pages %lu; free extents %lu; not full extents %lu: pages %lu\n",
n_full,
n_frag, n_free, n_not_full, n_used);
}
......@@ -3620,15 +3611,15 @@ fsp_print(
seg_id_low = ut_dulint_get_low(d_var);
seg_id_high = ut_dulint_get_high(d_var);
printf("FILE SPACE INFO: id %lu\n", space);
printf("size %lu, free limit %lu, free extents %lu\n",
size, free_limit, n_free);
printf(
"not full frag extents %lu: used pages %lu, full frag extents %lu\n",
n_free_frag, frag_n_used, n_full_frag);
printf("first seg id not used %lu %lu\n", seg_id_high, seg_id_low);
fprintf(stderr,
"FILE SPACE INFO: id %lu\n"
"size %lu, free limit %lu, free extents %lu\n"
"not full frag extents %lu: used pages %lu, full frag extents %lu\n"
"first seg id not used %lu %lu\n",
space,
size, free_limit, n_free,
n_free_frag, frag_n_used, n_full_frag,
seg_id_high, seg_id_low);
mtr_commit(&mtr);
......@@ -3707,5 +3698,5 @@ fsp_print(
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(
len = flst_get_len(base, mtr);
printf("FILE-BASED LIST:\n");
printf("Base node in space %lu page %lu byte offset %lu; len %lu\n",
fprintf(stderr,
"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),
(ulint) (base - frame), len);
}
......@@ -264,18 +264,13 @@ Prints info of a hash table. */
void
ha_print_info(
/*==========*/
char* buf, /* in/out: buffer where to print */
char* buf_end,/* in: buffer end */
FILE* file, /* in: file where to print */
hash_table_t* table) /* in: hash table */
{
hash_cell_t* cell;
ulint cells = 0;
ulint n_bufs;
ulint i;
if (buf_end - buf < 200) {
return;
}
for (i = 0; i < hash_get_n_cells(table); i++) {
......@@ -287,8 +282,9 @@ ha_print_info(
}
}
buf += sprintf(buf,
"Hash table size %lu, used cells %lu", hash_get_n_cells(table), cells);
fprintf(file,
"Hash table size %lu, used cells %lu",
hash_get_n_cells(table), cells);
if (table->heaps == NULL && table->heap != NULL) {
......@@ -301,6 +297,6 @@ ha_print_info(
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(
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); */
}
......@@ -438,7 +438,7 @@ ibuf_data_init_for_space(
#ifdef UNIV_LOG_DEBUG
if (space % 2 == 1) {
printf("No ibuf op in replicate space\n");
fputs("No ibuf op in replicate space\n", stderr);
return(NULL);
}
......@@ -728,7 +728,8 @@ ibuf_set_free_bits_low(
bitmap_page = ibuf_bitmap_get_map_page(buf_frame_get_space_id(page),
buf_frame_get_page_no(page), mtr);
#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,
ibuf_index_page_calc_free(page)); */
......@@ -782,7 +783,7 @@ ibuf_set_free_bits(
buf_frame_get_page_no(page),
IBUF_BITMAP_FREE, &mtr);
if (old_val != max_val) {
/* printf(
/* fprintf(stderr,
"Ibuf: page %lu old val %lu max val %lu\n",
buf_frame_get_page_no(page), old_val, max_val); */
}
......@@ -791,7 +792,7 @@ ibuf_set_free_bits(
#endif
}
#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,
ibuf_index_page_calc_free(page)); */
......@@ -970,7 +971,7 @@ ibuf_page_low(
#ifdef UNIV_LOG_DEBUG
if (space % 2 != 0) {
printf("No ibuf in a replicate space\n");
fputs("No ibuf in a replicate space\n", stderr);
return(FALSE);
}
......@@ -1481,7 +1482,8 @@ ibuf_free_excess_pages(
/* Not yet initialized */
#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
return;
......@@ -1645,7 +1647,7 @@ ibuf_get_merge_page_nos(
#ifdef UNIV_IBUF_DEBUG
ut_a(*n_stored <= IBUF_MAX_N_PAGES_MERGED);
#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); */
return(sum_volumes);
}
......@@ -1751,8 +1753,8 @@ ibuf_contract_ext(
page_nos, &n_stored);
#ifdef UNIV_IBUF_DEBUG
/* printf("Ibuf contract sync %lu pages %lu volume %lu\n", sync,
n_stored, sum_sizes); */
/* fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
sync, n_stored, sum_sizes); */
#endif
ibuf_exit();
......@@ -2074,7 +2076,7 @@ ibuf_insert_low(
mutex_exit(&ibuf_mutex);
#ifdef UNIV_IBUF_DEBUG
printf("Ibuf too big\n");
fputs("Ibuf too big\n", stderr);
#endif
/* Use synchronous contract (== TRUE) */
ibuf_contract(TRUE);
......@@ -2302,8 +2304,8 @@ ibuf_insert(
if (err == DB_SUCCESS) {
#ifdef UNIV_IBUF_DEBUG
/* printf("Ibuf insert for page no %lu of index %s\n", page_no,
index->name); */
/* fprintf(stderr, "Ibuf insert for page no %lu of index %s\n",
page_no, index->name); */
#endif
return(TRUE);
......@@ -2331,7 +2333,6 @@ ibuf_insert_to_index_page(
rec_t* rec;
page_t* bitmap_page;
ulint old_bits;
char errbuf[1000];
ut_ad(ibuf_inside());
ut_ad(dtuple_check_typed(entry));
......@@ -2361,16 +2362,13 @@ ibuf_insert_to_index_page(
"InnoDB: Error: Insert buffer insert fails; page free %lu, dtuple size %lu\n",
page_get_max_insert_size(page, 1),
rec_get_converted_size(entry));
dtuple_sprintf(errbuf, 900, entry);
fprintf(stderr,
"InnoDB: Cannot insert index record %s\n", errbuf);
fprintf(stderr,
"InnoDB: The table where where this index record belongs\n"
fputs("InnoDB: Cannot insert index record ",
stderr);
dtuple_print(stderr, entry);
fputs(
"\nInnoDB: The table where where this index record belongs\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(
buf_frame_get_space_id(page),
......@@ -2384,8 +2382,8 @@ ibuf_insert_to_index_page(
fprintf(stderr, "Bitmap bits %lu\n", old_bits);
fprintf(stderr,
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n");
fputs(
"InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n", stderr);
}
}
......@@ -2443,22 +2441,21 @@ ibuf_delete_rec(
if (!success) {
fprintf(stderr,
"InnoDB: ERROR: Send the output to heikki.tuuri@innodb.com\n");
fprintf(stderr, "InnoDB: ibuf cursor restoration fails!\n");
fprintf(stderr, "InnoDB: ibuf record inserted to page %lu\n",
page_no);
"InnoDB: ERROR: Send the output to mysql@lists.mysql.com\n"
"InnoDB: ibuf cursor restoration fails!\n"
"InnoDB: ibuf record inserted to page %lu\n", page_no);
fflush(stderr);
rec_print(btr_pcur_get_rec(pcur));
rec_print(pcur->old_rec);
dtuple_print(search_tuple);
rec_print(stderr, btr_pcur_get_rec(pcur));
rec_print(stderr, pcur->old_rec);
dtuple_print(stderr, search_tuple);
rec_print(page_rec_get_next(btr_pcur_get_rec(pcur)));
fflush(stdout);
rec_print(stderr, page_rec_get_next(btr_pcur_get_rec(pcur)));
fflush(stderr);
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));
fprintf(stderr, "InnoDB: ibuf tree ok\n");
......@@ -2519,7 +2516,6 @@ ibuf_merge_or_delete_for_page(
#endif
ibool corruption_noticed = FALSE;
mtr_t mtr;
char err_buf[500];
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
......@@ -2529,7 +2525,7 @@ ibuf_merge_or_delete_for_page(
#ifdef UNIV_LOG_DEBUG
if (space % 2 != 0) {
printf("No ibuf operation in a replicate space\n");
fputs("No ibuf operation in a replicate space\n", stderr);
return;
}
......@@ -2579,8 +2575,8 @@ ibuf_merge_or_delete_for_page(
mtr_start(&mtr);
fprintf(stderr,
" InnoDB: Dump of the ibuf bitmap page:\n");
fputs(" InnoDB: Dump of the ibuf bitmap page:\n",
stderr);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
&mtr);
......@@ -2588,7 +2584,7 @@ ibuf_merge_or_delete_for_page(
mtr_commit(&mtr);
fprintf(stderr, "\nInnoDB: Dump of the page:\n");
fputs("\nInnoDB: Dump of the page:\n", stderr);
buf_page_print(page);
......@@ -2651,18 +2647,16 @@ ibuf_merge_or_delete_for_page(
/* Do NOT merge to the 4.1 code base! */
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: the insert buffer was not empty.\n");
"InnoDB: the insert buffer was not empty.\n", stderr);
ut_error;
}
if (corruption_noticed) {
rec_sprintf(err_buf, 450, ibuf_rec);
fprintf(stderr,
"InnoDB: Discarding record\n %s\n from the insert buffer!\n\n", err_buf);
fputs("InnoDB: Discarding record\n ", stderr);
rec_print(stderr, ibuf_rec);
fputs("\n from the insert buffer!\n\n", stderr);
} else if (page) {
/* Now we have at pcur a record which should be
inserted to the index page; NOTE that the call below
......@@ -2723,8 +2717,8 @@ ibuf_merge_or_delete_for_page(
page_no, IBUF_BITMAP_FREE, &mtr);
ulint new_bits = ibuf_index_page_calc_free(page);
#ifdef UNIV_IBUF_DEBUG
/* printf("Old bits %lu new bits %lu max size %lu\n", old_bits,
new_bits,
/* fprintf(stderr, "Old bits %lu new bits %lu max size %lu\n",
old_bits, new_bits,
page_get_max_insert_size_after_reorganize(page, 1)); */
#endif
if (old_bits != new_bits) {
......@@ -2736,7 +2730,8 @@ ibuf_merge_or_delete_for_page(
}
#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); */
#endif
mtr_commit(&mtr);
......@@ -2794,34 +2789,29 @@ Prints info of ibuf. */
void
ibuf_print(
/*=======*/
char* buf, /* in/out: buffer where to print */
char* buf_end)/* in: buffer end */
FILE* file) /* in: file where to print */
{
ibuf_data_t* data;
#ifdef UNIV_IBUF_DEBUG
ulint i;
#endif
if (buf_end - buf < 500) {
return;
}
mutex_enter(&ibuf_mutex);
data = UT_LIST_GET_FIRST(ibuf->data_list);
while (data) {
buf += sprintf(buf,
"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,
fprintf(file,
"Ibuf for space %lu: size %lu, free list len %lu, seg size %lu,\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);
#ifdef UNIV_IBUF_DEBUG
for (i = 0; i < IBUF_COUNT_N_PAGES; i++) {
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));
}
}
......
......@@ -483,8 +483,7 @@ Prints info of the buffer i/o. */
void
buf_print_io(
/*=========*/
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
FILE* file); /* in: file where to print */
/*************************************************************************
Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool. */
......
......@@ -217,9 +217,9 @@ buf_block_align(
|| block >= buf_pool->blocks + buf_pool->max_size) {
fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %lx\n"
"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr,
(ulint)frame_zero, buf_pool->max_size);
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, number of pages %lu\n", ptr,
frame_zero, buf_pool->max_size);
ut_error;
}
......@@ -251,9 +251,9 @@ buf_block_align_low(
|| block >= buf_pool->blocks + buf_pool->max_size) {
fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %lx\n"
"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr,
(ulint)frame_zero, buf_pool->max_size);
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, number of pages %lu\n", ptr,
frame_zero, buf_pool->max_size);
ut_error;
}
......@@ -280,9 +280,9 @@ buf_frame_align(
|| ((ulint)frame > (ulint)(buf_pool_get_nth_block(buf_pool,
buf_pool->max_size - 1)->frame))) {
fprintf(stderr,
"InnoDB: Error: trying to access a stray pointer %lx\n"
"InnoDB: buf pool start is at %lx, number of pages %lu\n", (ulint)ptr,
(ulint)(buf_pool->frame_zero), buf_pool->max_size);
"InnoDB: Error: trying to access a stray pointer %p\n"
"InnoDB: buf pool start is at %p, number of pages %lu\n", ptr,
buf_pool->frame_zero, buf_pool->max_size);
ut_error;
}
......
......@@ -326,16 +326,7 @@ The following function prints the contents of a tuple. */
void
dtuple_print(
/*=========*/
dtuple_t* tuple); /* in: 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 */
FILE* f, /* in: output stream */
dtuple_t* tuple); /* in: tuple */
/******************************************************************
Moves parts of long fields in entry to the big record vector so that
......
......@@ -331,19 +331,23 @@ dict_print_info_on_foreign_keys(
a format suitable to be inserted into
a CREATE TABLE, otherwise in the format
of SHOW TABLE STATUS */
char* str, /* in/out: pointer to a string */
ulint len, /* in: space in str available for info */
FILE* file, /* in: file where to print */
dict_table_t* table); /* in: table */
/**************************************************************************
Sprintfs to a string info on a foreign key of a table in a format suitable
for CREATE TABLE. */
char*
Outputs info on a foreign key of a table in a format suitable for
CREATE TABLE. */
void
dict_print_info_on_foreign_key_in_create_format(
/*============================================*/
/* out: how far in buf we printed */
dict_foreign_t* foreign,/* in: foreign key constraint */
char* buf); /* in: buffer of at least 5000 bytes */
FILE* file, /* in: file where to print */
dict_foreign_t* foreign);/* in: foreign key constraint */
/************************************************************************
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). */
UNIV_INLINE
......@@ -846,13 +850,9 @@ dict_tables_have_same_db(
const char* name2); /* in: table name in the form
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
and unique key errors */
extern char* dict_foreign_err_buf;
extern char* dict_unique_err_buf;
extern FILE* dict_foreign_err_file;
extern mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */
extern dict_sys_t* dict_sys; /* the dictionary system */
......
......@@ -127,8 +127,7 @@ Prints info of a hash table. */
void
ha_print_info(
/*==========*/
char* buf, /* in/out: buffer where to print */
char* buf_end,/* in: buffer end */
FILE* file, /* in: file where to print */
hash_table_t* table); /* in: hash table */
/* The hash table external chain node */
......
......@@ -262,8 +262,7 @@ Prints info of ibuf. */
void
ibuf_print(
/*=======*/
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
FILE* file); /* in: file where to print */
#define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO
#define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO
......
......@@ -20,6 +20,8 @@ Created 5/7/1996 Heikki Tuuri
#include "hash0hash.h"
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. */
......@@ -468,8 +470,7 @@ Prints info of a table lock. */
void
lock_table_print(
/*=============*/
char* buf, /* in/out: buffer where to print, must be at least
500 bytes */
FILE* file, /* in: file where to print */
lock_t* lock); /* in: table type lock */
/*************************************************************************
Prints info of a record lock. */
......@@ -477,8 +478,7 @@ Prints info of a record lock. */
void
lock_rec_print(
/*===========*/
char* buf, /* in/out: buffer where to print, must be at least
500 bytes */
FILE* file, /* in: file where to print */
lock_t* lock); /* in: record type lock */
/*************************************************************************
Prints info of locks for all transactions. */
......@@ -486,8 +486,7 @@ Prints info of locks for all transactions. */
void
lock_print_info(
/*============*/
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
FILE* file); /* in: file where to print */
/*************************************************************************
Validates the lock queue on a table. */
......
......@@ -512,8 +512,7 @@ Prints info of the log. */
void
log_print(
/*======*/
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
FILE* file); /* in: file where to print */
/**********************************************************
Peeks the current lsn. */
......
......@@ -165,8 +165,8 @@ mlog_write_initial_log_record_fast(
if (space != 0 || offset > 0x8FFFFFFF) {
fprintf(stderr,
"InnoDB: error: buffer page pointer %lx has nonsensical space id %lu\n"
"InnoDB: or page no %lu\n", (ulint)ptr, space, offset);
"InnoDB: error: buffer page pointer %p has nonsensical space id %lu\n"
"InnoDB: or page no %lu\n", ptr, space, offset);
ut_error;
}
......@@ -178,7 +178,8 @@ mlog_write_initial_log_record_fast(
mtr->n_log_recs++;
#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); */
#endif
......
......@@ -443,8 +443,7 @@ Prints info of the aio arrays. */
void
os_aio_print(
/*=========*/
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
FILE* file); /* in: file where to print */
/**************************************************************************
Refreshes the statistics used to print per-second averages. */
......
......@@ -390,16 +390,7 @@ Prints a physical record. */
void
rec_print(
/*======*/
rec_t* rec); /* in: physical record */
/*******************************************************************
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 */
FILE* file, /* in: file where to print */
rec_t* rec); /* in: physical record */
#define REC_INFO_BITS 6 /* This is single byte bit-field */
......
......@@ -190,7 +190,7 @@ rec_set_bit_field_2(
+ (REC_N_OWNED_MASK << (8 * (REC_N_OWNED - 3)))
+ (REC_INFO_BITS_MASK << (8 * (REC_INFO_BITS - 3))));
if (m != ut_dbg_zero + 0xFFFFFFFF) {
printf("Sum of masks %lx\n", m);
fprintf(stderr, "Sum of masks %lx\n", m);
ut_error;
}
}
......
......@@ -77,12 +77,9 @@ open_step(
if (err != DB_SUCCESS) {
/* SQL error detected */
printf("SQL error %lu\n", err);
fprintf(stderr, "SQL error %lu\n", err);
ut_error;
que_thr_handle_error(thr, err, NULL, 0);
return(NULL);
}
thr->run_node = que_node_get_parent(node);
......
......@@ -84,9 +84,11 @@ upd_field_set_field_no(
if (field_no >= dict_index_get_n_fields(index)) {
fprintf(stderr,
"InnoDB: Error: trying to access field %lu in table %s\n"
"InnoDB: index %s, but index has only %lu fields\n",
field_no, index->table_name, index->name,
"InnoDB: Error: trying to access field %lu in ",
field_no);
dict_index_name_print(stderr, index);
fprintf(stderr, "\n"
"InnoDB: but index only has %lu fields\n",
dict_index_get_n_fields(index));
}
......
......@@ -32,6 +32,11 @@ at a time */
/* This is set to TRUE if the MySQL user has set it in MySQL */
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 */
extern char* srv_data_home;
......@@ -368,13 +373,12 @@ srv_error_monitor_thread(
void* arg); /* in: a dummy parameter required by
os_thread_create */
/**********************************************************************
Sprintfs to a buffer the output of the InnoDB Monitor. */
Outputs to a file the output of the InnoDB Monitor. */
void
srv_sprintf_innodb_monitor(
/*=======================*/
char* buf, /* in/out: buffer which must be at least 4 kB */
ulint len); /* in: length of the buffer */
srv_printf_innodb_monitor(
/*======================*/
FILE* file); /* in: output stream */
/* Types for the threads existing in the system. Threads of types 4 - 9
......
......@@ -114,8 +114,7 @@ Prints info of the wait array. */
void
sync_array_print_info(
/*==================*/
char* buf, /* in/out: buffer where to print */
char* buf_end,/* in: buffer end */
FILE* file, /* in: file where to print */
sync_array_t* arr); /* in: wait array */
......
......@@ -119,16 +119,14 @@ Prints wait info of the sync system. */
void
sync_print_wait_info(
/*=================*/
char* buf, /* in/out: buffer where to print */
char* buf_end); /* in: buffer end */
FILE* file); /* in: file where to print */
/***********************************************************************
Prints info of the sync system. */
void
sync_print(
/*=======*/
char* buf, /* in/out: buffer where to print */
char* buf_end); /* in: buffer end */
FILE* file); /* in: file where to print */
/**********************************************************************
Checks that the mutex has been initialized. */
......
......@@ -269,7 +269,7 @@ 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. */
void
......
......@@ -280,8 +280,7 @@ own the kernel mutex. */
void
trx_print(
/*======*/
char* buf, /* in/out: buffer where to print, must be at least
800 bytes */
FILE* f, /* in: output stream */
trx_t* trx); /* in: transaction */
......
......@@ -169,7 +169,7 @@ ut_print_timestamp(
/*===============*/
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
ut_sprintf_timestamp(
......@@ -199,19 +199,37 @@ Prints the contents of a memory buffer in hex and ascii. */
void
ut_print_buf(
/*=========*/
byte* buf, /* in: memory buffer */
ulint len); /* in: length of the buffer */
/*****************************************************************
Prints the contents of a memory buffer in hex and ascii. */
FILE* file, /* in: file where to print */
const byte* buf, /* in: memory buffer */
ulint len); /* in: length of the buffer */
ulint
ut_sprintf_buf(
/*===========*/
/* out: printed length in bytes */
char* str, /* in: buffer to print to */
byte* buf, /* in: memory buffer */
ulint len); /* in: length of the buffer */
/**************************************************************************
Outputs a NUL-terminated string, quoted as an SQL identifier. */
void
ut_print_name(
/*==========*/
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
#include "ut0ut.ic"
......
This diff is collapsed.
......@@ -517,7 +517,8 @@ log_group_calc_lsn_offset(
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);
*/
......@@ -934,7 +935,8 @@ log_group_check_flush_completion(
if (!log_sys->one_flushed && group->n_pending_writes == 0) {
#ifdef UNIV_LOG_DEBUG
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 */
......@@ -947,7 +949,7 @@ log_group_check_flush_completion(
#ifdef UNIV_LOG_DEBUG
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 */
......@@ -1096,9 +1098,9 @@ log_group_file_header_flush(
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
"Writing log file header to group %lu file %lu\n", group->id,
nth_file);
fprintf(stderr,
"Writing log file header to group %lu file %lu\n",
group->id, nth_file);
}
#endif /* UNIV_LOG_DEBUG */
......@@ -1186,14 +1188,13 @@ log_group_write_buf(
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
fprintf(stderr,
"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,
ut_dulint_get_high(start_lsn),
ut_dulint_get_low(start_lsn));
printf(
"First block n:o %lu last block n:o %lu\n",
ut_dulint_get_low(start_lsn),
log_block_get_hdr_no(buf),
log_block_get_hdr_no(
buf + write_len - OS_FILE_LOG_BLOCK_SIZE));
......@@ -1274,7 +1275,7 @@ log_write_up_to(
ut_ad(loop_count < 5);
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));
......@@ -1337,7 +1338,8 @@ log_write_up_to(
#ifdef UNIV_LOG_DEBUG
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_low(log_sys->written_to_all_lsn),
ut_dulint_get_high(log_sys->lsn),
......@@ -1757,11 +1759,11 @@ log_reset_first_header_and_checkpoint(
lsn = ut_dulint_add(start, LOG_BLOCK_HDR_SIZE);
/* 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 ");
ut_sprintf_timestamp(
(char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
+ strlen("ibbackup "));
(char*) hdr_buf + (LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
+ (sizeof "ibbackup ") - 1));
buf = hdr_buf + LOG_CHECKPOINT_1;
mach_write_to_8(buf + LOG_CHECKPOINT_NO, ut_dulint_zero);
......@@ -1904,7 +1906,7 @@ log_checkpoint(
#ifdef UNIV_LOG_DEBUG
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_high(oldest_lsn),
ut_dulint_get_low(oldest_lsn));
......@@ -2279,19 +2281,18 @@ log_group_archive(
}
if (!ret) {
fprintf(stderr,
"InnoDB: Cannot create or open archive log file %s.\n",
name);
fprintf(stderr, "InnoDB: Cannot continue operation.\n"
"InnoDB: Check that the log archive directory exists,\n"
"InnoDB: you have access rights to it, and\n"
"InnoDB: there is space available.\n");
exit(1);
fprintf(stderr,
"InnoDB: Cannot create or open archive log file %s.\n"
"InnoDB: Cannot continue operation.\n"
"InnoDB: Check that the log archive directory exists,\n"
"InnoDB: you have access rights to it, and\n"
"InnoDB: there is space available.\n", name);
exit(1);
}
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Created archive file %s\n", name);
fprintf(stderr, "Created archive file %s\n", name);
}
#endif /* UNIV_LOG_DEBUG */
......@@ -2324,7 +2325,7 @@ log_group_archive(
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
fprintf(stderr,
"Archiving starting at lsn %lu %lu, len %lu to group %lu\n",
ut_dulint_get_high(start_lsn),
ut_dulint_get_low(start_lsn),
......@@ -2423,7 +2424,8 @@ log_archive_write_complete_groups(void)
#ifdef UNIV_LOG_DEBUG
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);
}
#endif /* UNIV_LOG_DEBUG */
......@@ -2451,7 +2453,7 @@ log_archive_write_complete_groups(void)
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Archiving writes completed\n");
fputs("Archiving writes completed\n", stderr);
}
#endif /* UNIV_LOG_DEBUG */
}
......@@ -2472,7 +2474,7 @@ log_archive_check_completion_low(void)
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf("Archiving read completed\n");
fputs("Archiving read completed\n", stderr);
}
#endif /* UNIV_LOG_DEBUG */
......@@ -2620,7 +2622,8 @@ log_archive_do(
#ifdef UNIV_LOG_DEBUG
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_low(log_sys->archived_lsn),
ut_dulint_get_high(limit_lsn),
......@@ -2727,7 +2730,7 @@ log_archive_close_groups(
#ifdef UNIV_LOG_DEBUG
if (log_debug_writes) {
printf(
fprintf(stderr,
"Incrementing arch file no to %lu in log group %lu\n",
group->archived_file_no + 2, group->id);
}
......@@ -3262,20 +3265,15 @@ Prints info of the log. */
void
log_print(
/*======*/
char* buf, /* in/out: buffer where to print */
char* buf_end)/* in: buffer end */
FILE* file) /* in: file where to print */
{
double time_elapsed;
time_t current_time;
if (buf_end - buf < 300) {
return;
}
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"
"Last checkpoint at %lu %lu\n",
ut_dulint_get_high(log_sys->lsn),
......@@ -3289,7 +3287,7 @@ log_print(
time_elapsed = 0.001 + difftime(current_time,
log_sys->last_printout_time);
buf += sprintf(buf,
fprintf(file,
"%lu pending log writes, %lu pending chkp writes\n"
"%lu log i/o's done, %.2f log i/o's/second\n",
log_sys->n_pending_writes,
......
......@@ -589,7 +589,7 @@ recv_read_cp_info_for_backup(
*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);
......@@ -665,7 +665,7 @@ recv_scan_log_seg_for_backup(
if (no != log_block_convert_lsn_to_no(*scanned_lsn)
|| !log_block_checksum_is_ok_or_old_format(log_block)) {
/*
printf(
fprintf(stderr,
"Log block n:o %lu, scanned lsn n:o %lu\n",
no, log_block_convert_lsn_to_no(*scanned_lsn));
*/
......@@ -673,7 +673,7 @@ recv_scan_log_seg_for_backup(
log_block += OS_FILE_LOG_BLOCK_SIZE;
/*
printf(
fprintf(stderr,
"Next log block n:o %lu\n",
log_block_get_hdr_no(log_block));
*/
......@@ -690,7 +690,8 @@ recv_scan_log_seg_for_backup(
/* Garbage from a log buffer flush which was made
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,
log_block_get_checkpoint_no(log_block));
*/
......@@ -708,7 +709,8 @@ recv_scan_log_seg_for_backup(
if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
/* Log data ends here */
/* printf("Log block data len %lu\n", data_len); */
/* fprintf(stderr, "Log block data len %lu\n",
data_len); */
break;
}
......@@ -1211,7 +1213,7 @@ recv_read_in_area(
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);
}
......@@ -1398,16 +1400,16 @@ recv_apply_log_recs_for_backup(
}
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: 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",
n_pages_total, recv_max_parsed_page_no);
}
printf(
fputs(
"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++) {
......@@ -1424,7 +1426,7 @@ recv_apply_log_recs_for_backup(
OS_FILE_READ_WRITE,
&success);
if (!success) {
printf(
fprintf(stderr,
"InnoDB: Error: cannot open %lu'th data file\n", nth_file);
exit(1);
......@@ -1440,7 +1442,7 @@ recv_apply_log_recs_for_backup(
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
UNIV_PAGE_SIZE);
if (!success) {
printf(
fprintf(stderr,
"InnoDB: Error: cannot read page no %lu from %lu'th data file\n",
nth_page_in_file, nth_file);
......@@ -1468,7 +1470,7 @@ recv_apply_log_recs_for_backup(
nth_page_in_file >> (32 - UNIV_PAGE_SIZE_SHIFT),
UNIV_PAGE_SIZE);
if (!success) {
printf(
fprintf(stderr,
"InnoDB: Error: cannot write page no %lu to %lu'th data file\n",
nth_page_in_file, nth_file);
......@@ -1478,8 +1480,8 @@ recv_apply_log_recs_for_backup(
if ((100 * i) / n_pages_total
!= (100 * (i + 1)) / n_pages_total) {
printf("%lu ", (100 * i) / n_pages_total);
fflush(stdout);
fprintf(stderr, "%lu ", (100 * i) / n_pages_total);
fflush(stderr);
}
nth_page_in_file++;
......@@ -1821,21 +1823,15 @@ recv_report_corrupt_log(
ulint space, /* in: space id, this may also be garbage */
ulint page_no)/* in: page number, this may also be garbage */
{
char* err_buf;
fprintf(stderr,
"InnoDB: ############### CORRUPT LOG RECORD FOUND\n"
"InnoDB: Log record type %lu, space id %lu, page number %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: Log parsing proceeded successfully up to %lu %lu\n"
"InnoDB: Previous log record type %lu, is multi %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_is_multi,
(ulint)(ptr - recv_sys->buf),
......@@ -1846,28 +1842,27 @@ recv_report_corrupt_log(
&& (ulint)(ptr - recv_sys->buf + 100
- recv_previous_parsed_rec_offset)
< 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,
ptr - recv_sys->buf + 200 -
recv_previous_parsed_rec_offset);
fprintf(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);
putc('\n', stderr);
}
ut_free(err_buf);
fprintf(stderr,
fputs(
"InnoDB: WARNING: the log file may have been corrupt and it\n"
"InnoDB: is possible that the log scan did not proceed\n"
"InnoDB: far enough in recovery! Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: If mysqld crashes after this recovery, look at\n"
"InnoDB: section 6.1 of http://www.innodb.com/ibman.html\n"
"InnoDB: about forcing recovery.\n");
"InnoDB: section 6.1 of http://www.innodb.com/ibman.php\n"
"InnoDB: about forcing recovery.\n", stderr);
fflush(stderr);
}
......@@ -2517,7 +2512,7 @@ recv_recovery_from_checkpoint_start(
log_hdr_buf, max_cp_group);
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
a note to the user about it */
......@@ -2865,33 +2860,43 @@ recv_reset_log_files_for_backup(
ibool success;
byte* buf;
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);
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,
OS_FILE_READ_WRITE, &success);
if (!success) {
printf(
fprintf(stderr,
"InnoDB: Cannot create %s. Check that the file does not exist yet.\n", name);
exit(1);
}
printf(
"Setting log file size to %lu %lu\n", ut_get_high32(log_file_size),
log_file_size & 0xFFFFFFFF);
fprintf(stderr,
"Setting log file size to %lu %lu\n",
ut_get_high32(log_file_size),
log_file_size & 0xFFFFFFFF);
success = os_file_set_size(name, log_file,
log_file_size & 0xFFFFFFFF,
ut_get_high32(log_file_size));
if (!success) {
printf(
fprintf(stderr,
"InnoDB: Cannot set %s size to %lu %lu\n", name, ut_get_high32(log_file_size),
log_file_size & 0xFFFFFFFF);
exit(1);
......@@ -2908,12 +2913,12 @@ recv_reset_log_files_for_backup(
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_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,
OS_FILE_READ_WRITE, &success);
if (!success) {
printf("InnoDB: Cannot open %s.\n", name);
fprintf(stderr, "InnoDB: Cannot open %s.\n", name);
exit(1);
}
......@@ -2923,6 +2928,7 @@ recv_reset_log_files_for_backup(
os_file_flush(log_file);
os_file_close(log_file);
mem_free(name);
ut_free(buf);
}
......
......@@ -336,7 +336,7 @@ mem_hash_remove(
}
if (node == NULL) {
printf(
fprintf(stderr,
"Memory heap or buffer freed in %s line %lu did not exist.\n",
file_name, line);
ut_error;
......@@ -351,20 +351,18 @@ mem_hash_remove(
mem_heap_validate_or_print(node->heap, NULL, FALSE, &error, &size,
NULL, NULL);
if (error) {
printf("Inconsistency in memory heap or buffer n:o %lu created\n",
node->nth_heap);
printf("in %s line %lu and tried to free in %s line %lu.\n",
node->file_name, node->line, file_name, line);
printf(
"Hex dump of 400 bytes around memory heap first block start:\n");
ut_print_buf((byte*)(node->heap) - 200, 400);
fprintf(stderr,
"Inconsistency in memory heap or buffer n:o %lu created\n"
"in %s line %lu and tried to free in %s line %lu.\n"
"Hex dump of 400 bytes around memory heap first block start:\n",
node->nth_heap, node->file_name, node->line,
file_name, line);
ut_print_buf(stderr, (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,
NULL, NULL);
mem_heap_validate_or_print(node->heap, NULL, TRUE, &error,
&size, NULL, NULL);
ut_error;
}
......@@ -438,7 +436,7 @@ mem_heap_validate_or_print(
}
if (print) {
printf("Memory heap:");
fputs("Memory heap:", stderr);
}
while (block != NULL) {
......@@ -456,7 +454,7 @@ mem_heap_validate_or_print(
/* We can trace the fields of the block only in the debug
version */
if (print) {
printf(" Block %ld:", block_count);
fprintf(stderr, " Block %ld:", block_count);
}
field = (byte*)block + mem_block_get_start(block);
......@@ -476,7 +474,7 @@ mem_heap_validate_or_print(
len = mem_field_header_get_len(user_field);
if (print) {
ut_print_buf(user_field, len);
ut_print_buf(stderr, user_field, len);
}
total_len += len;
......@@ -545,7 +543,7 @@ mem_heap_print(
mem_heap_validate_or_print(heap, NULL, TRUE, &error,
&us_size, &phys_size, &n_blocks);
printf(
fprintf(stderr,
"\nheap type: %lu; size: user size %lu; physical size %lu; blocks %lu.\n",
heap->type, us_size, phys_size, n_blocks);
ut_a(!error);
......@@ -659,9 +657,11 @@ mem_validate_no_assert(void)
&ph_size, &n_blocks);
if (error) {
printf("\nERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n");
printf("Inconsistency in memory heap or buffer created\n");
printf("in %s line %lu.\n", node->file_name, node->line);
fprintf(stderr,
"\nERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"
"Inconsistency in memory heap or buffer created\n"
"in %s line %lu.\n",
node->file_name, node->line);
mutex_exit(&mem_hash_mutex);
......@@ -721,12 +721,10 @@ mem_analyze_corruption(
ulint i;
ulint dist;
ut_sprintf_buf(srv_fatal_errbuf, ptr - 250, 500);
fprintf(stderr,
"InnoDB: Apparent memory corruption: mem dump %s\n", srv_fatal_errbuf);
fputs("InnoDB: Apparent memory corruption: mem dump ", stderr);
ut_print_buf(stderr, ptr - 250, 500);
fprintf(stderr,
"InnoDB: Scanning backward trying to find previous allocated mem blocks\n");
fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr);
p = ptr;
dist = 0;
......
......@@ -54,15 +54,15 @@ mlog_write_initial_log_record(
byte* log_ptr;
ut_ad(type <= MLOG_BIGGEST_TYPE);
ut_ad(type > MLOG_8BYTES);
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n",
(ulint)ptr);
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
ut_error;
}
log_ptr = mlog_open(mtr, 20);
log_ptr = mlog_open(mtr, 11);
/* If no logging is requested, we may return now */
if (log_ptr == NULL) {
......@@ -221,8 +221,7 @@ mlog_write_ulint(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n",
(ulint)ptr);
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
ut_error;
}
......@@ -268,8 +267,7 @@ mlog_write_dulint(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n",
(ulint)ptr);
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
ut_error;
}
......@@ -312,8 +310,7 @@ mlog_write_string(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
"InnoDB: Error: trying to write to a stray memory location %lx\n",
(ulint)ptr);
"InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
ut_error;
}
ut_ad(ptr && mtr);
......
......@@ -262,7 +262,8 @@ mtr_first_to_modify_page_after_backup(
block->frame),
backup_lsn) <= 0) {
printf("Page %lu newest %lu backup %lu\n",
fprintf(stderr,
"Page %lu newest %lu backup %lu\n",
block->offset,
ut_dulint_get_low(
buf_frame_get_newest_modification(
......@@ -515,7 +516,7 @@ mtr_print(
/*======*/
mtr_t* mtr) /* in: mtr */
{
printf(
fprintf(stderr,
"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->log)));
......
This diff is collapsed.
......@@ -81,9 +81,8 @@ os_process_set_priority_boost(
/* Does not do anything currently!
SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
*/
printf(
"Warning: process priority boost setting currently not functional!\n"
);
fputs("Warning: process priority boost setting currently not functional!\n",
stderr);
#else
UT_NOT_USED(do_boost);
#endif
......
......@@ -187,7 +187,7 @@ os_thread_exit(
is cast as a DWORD */
{
#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()));
#endif
os_mutex_enter(os_sync_mutex);
......
......@@ -704,14 +704,16 @@ page_cur_parse_insert_rec(
/* Build the inserted record to buf */
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"
"parsed len %lu\n",
is_short, info_bits, offset, origin_offset,
mismatch_index, end_seg_len, (ulint)(ptr - ptr2));
printf("Dump of 300 bytes of log:\n");
ut_print_buf(ptr2, 300);
fputs("Dump of 300 bytes of log:\n", stderr);
ut_print_buf(stderr, ptr2, 300);
buf_page_print(page);
......
This diff is collapsed.
......@@ -1202,26 +1202,22 @@ opt_print_query_plan(
ulint n_fields;
ulint i;
printf("QUERY PLAN FOR A SELECT NODE\n");
fputs("QUERY PLAN FOR A SELECT NODE\n", stderr);
if (sel_node->asc) {
printf("Asc. search; ");
} else {
printf("Desc. search; ");
}
fputs(sel_node->asc ? "Asc. search; " : "Desc. search; ", stderr);
if (sel_node->set_x_locks) {
printf("sets row x-locks; ");
fputs("sets row x-locks; ", stderr);
ut_a(sel_node->row_lock_mode == LOCK_X);
ut_a(!sel_node->consistent_read);
} else if (sel_node->consistent_read) {
printf("consistent read; ");
fputs("consistent read; ", stderr);
} else {
ut_a(sel_node->row_lock_mode == LOCK_S);
printf("sets row s-locks; ");
fputs("sets row s-locks; ", stderr);
}
printf("\n");
putc('\n', stderr);
for (i = 0; i < sel_node->n_tables; i++) {
plan = sel_node_get_nth_plan(sel_node, i);
......@@ -1232,9 +1228,9 @@ opt_print_query_plan(
n_fields = 0;
}
printf(
"Table %s index %s; exact m. %lu, match %lu, end conds %lu\n",
plan->table->name, plan->index->name,
fputs("Table ", stderr);
dict_index_name_print(stderr, plan->index);
fprintf(stderr,"; exact m. %lu, match %lu, end conds %lu\n",
plan->n_exact_match, n_fields,
UT_LIST_GET_LEN(plan->end_conds));
}
......
......@@ -112,7 +112,7 @@ rec_get_nth_field(
}
if (rec == NULL) {
fprintf(stderr, "Error: rec is NULL pointer\n");
fputs("Error: rec is NULL pointer\n", stderr);
ut_error;
}
......@@ -517,109 +517,47 @@ Prints a physical record. */
void
rec_print(
/*======*/
FILE* file, /* in: file where to print */
rec_t* rec) /* in: physical record */
{
byte* data;
ulint len;
char* offs;
ulint n;
ulint i;
ut_ad(rec);
if (rec_get_1byte_offs_flag(rec)) {
offs = (char *) "TRUE";
} else {
offs = (char *) "FALSE";
}
n = rec_get_n_fields(rec);
printf(
"PHYSICAL RECORD: n_fields %lu; 1-byte offs %s; info bits %lu\n",
n, offs, rec_get_info_bits(rec));
fprintf(file, "PHYSICAL RECORD: n_fields %lu;"
" 1-byte offs %s; info bits %lu\n",
n, rec_get_1byte_offs_flag(rec) ? "TRUE" : "FALSE",
rec_get_info_bits(rec));
for (i = 0; i < n; i++) {
data = rec_get_nth_field(rec, i, &len);
printf(" %lu:", i);
fprintf(file, " %lu:", i);
if (len != UNIV_SQL_NULL) {
if (len <= 30) {
ut_print_buf(data, len);
ut_print_buf(file, data, len);
} else {
ut_print_buf(data, 30);
ut_print_buf(file, data, 30);
printf("...(truncated)");
fputs("...(truncated)", file);
}
} else {
printf(" SQL NULL, size %lu ",
fprintf(file, " SQL NULL, size %lu ",
rec_get_nth_field_size(rec, i));
}
printf(";");
putc(';', file);
}
printf("\n");
putc('\n', file);
rec_validate(rec);
}
/*******************************************************************
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 */
{
byte* data;
ulint len;
ulint k;
ulint n;
ulint i;
ut_ad(rec);
n = rec_get_n_fields(rec);
k = 0;
if (k + 30 > buf_len) {
return(k);
}
k += sprintf(buf + k, "RECORD: info bits %lu", rec_get_info_bits(rec));
for (i = 0; i < n; i++) {
if (k + 30 > buf_len) {
return(k);
}
data = rec_get_nth_field(rec, i, &len);
k += sprintf(buf + k, " %lu:", i);
if (len != UNIV_SQL_NULL) {
if (k + 30 + 5 * len > buf_len) {
return(k);
}
k += ut_sprintf_buf(buf + k, data, len);
} else {
k += sprintf(buf + k, " SQL NULL");
}
k += sprintf(buf + k, ";");
}
return(k);
}
This diff is collapsed.
This diff is collapsed.
......@@ -158,7 +158,7 @@ row_purge_remove_clust_if_poss(
ibool success;
ulint n_tries = 0;
/* printf("Purge: Removing clustered record\n"); */
/* fputs("Purge: Removing clustered record\n", stderr); */
success = row_purge_remove_clust_if_poss_low(node, BTR_MODIFY_LEAF);
if (success) {
......@@ -212,7 +212,7 @@ row_purge_remove_sec_if_poss_low(
if (!found) {
/* Not found */
/* printf("PURGE:........sec entry not found\n"); */
/* fputs("PURGE:........sec entry not found\n", stderr); */
/* dtuple_print(entry); */
btr_pcur_close(&pcur);
......@@ -281,7 +281,7 @@ row_purge_remove_sec_if_poss(
ibool success;
ulint n_tries = 0;
/* printf("Purge: Removing secondary record\n"); */
/* fputs("Purge: Removing secondary record\n", stderr); */
success = row_purge_remove_sec_if_poss_low(node, index, entry,
BTR_MODIFY_LEAF);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -169,8 +169,8 @@ row_undo_search_clust_to_pcur(
is to make sure that some thread will eventually undo the
modification corresponding to node->roll_ptr. */
/* printf("--------------------undoing a previous version\n");
*/
/* fputs("--------------------undoing a previous version\n",
stderr); */
ret = FALSE;
} 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