summaryrefslogtreecommitdiff
path: root/innobase/page/page0page.c
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2004-04-06 16:14:43 +0300
committerunknown <marko@hundin.mysql.fi>2004-04-06 16:14:43 +0300
commit80fe399fee3a7752aecdfc888edfcf56a2be7b0a (patch)
treef7bc427aa7ce4a54802d6e8931ca1dfe64c7bfa8 /innobase/page/page0page.c
parentd809c4413e9f991bde407690aafdaaa3eaae9232 (diff)
downloadmariadb-git-80fe399fee3a7752aecdfc888edfcf56a2be7b0a.tar.gz
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers innobase/btr/btr0btr.c: Output to stderr; quote table and index names innobase/btr/btr0cur.c: Output to stderr; quote table and index names innobase/btr/btr0sea.c: Output to stderr innobase/buf/buf0buf.c: Output to stderr; quote table and index names innobase/buf/buf0flu.c: Output to stderr innobase/buf/buf0lru.c: Output to stderr innobase/buf/buf0rea.c: Output to stderr innobase/data/data0data.c: Remove dtuple_validate() unless #ifdef UNIV_DEBUG Remove unnecessary sprintf() calls Output to stderr innobase/data/data0type.c: Output to stderr innobase/dict/dict0boot.c: Remove dummy call to printf() innobase/dict/dict0crea.c: Output diagnostic information to stream, not to memory innobase/dict/dict0dict.c: Output diagnostics to a file, not to a memory buffer innobase/dict/dict0load.c: Output to stderr; quote table and index names innobase/eval/eval0eval.c: Output to stderr innobase/fil/fil0fil.c: Output to stderr innobase/fsp/fsp0fsp.c: Output to stderr Avoid sprintf() innobase/fut/fut0lst.c: Output to stderr innobase/ha/ha0ha.c: Output to stream, not to memory buffer innobase/ibuf/ibuf0ibuf.c: Output to stderr Avoid sprintf() innobase/include/buf0buf.h: Output to stream, not to memory buffer innobase/include/buf0buf.ic: Use %p for displaying pointers innobase/include/data0data.h: Remove dtuple_sprintf() innobase/include/dict0dict.h: Output to stream, not to memory buffer innobase/include/ha0ha.h: Output to stream, not to memory buffer innobase/include/ibuf0ibuf.h: Output to stream, not to memory buffer innobase/include/lock0lock.h: Output to stream, not to memory buffer innobase/include/log0log.h: Output to stream, not to memory buffer innobase/include/mtr0log.ic: Output to stderr Display pointers with %p innobase/include/os0file.h: Output to stream, not to memory buffer innobase/include/rem0rec.h: Remove rec_sprintf() innobase/include/rem0rec.ic: Output to stderr innobase/include/row0sel.ic: Output to stderr innobase/include/row0upd.ic: Quote table and index names innobase/include/srv0srv.h: Remove srv_sprintf_innodb_monitor() innobase/include/sync0arr.h: Output to stream, not to memory buffer innobase/include/sync0sync.h: Output to stream, not to memory buffer innobase/include/trx0sys.h: Output to stderr innobase/include/trx0trx.h: Output to stream, not to memory buffer innobase/include/ut0ut.h: Remove ut_sprintf_buf() Add ut_print_name(), ut_print_namel() and ut_copy_file() innobase/lock/lock0lock.c: Output to stream, not to memory buffer innobase/log/log0log.c: Output to stderr innobase/log/log0recv.c: Output to stderr innobase/mem/mem0dbg.c: Output to stderr innobase/mtr/mtr0log.c: Display pointers with %p innobase/mtr/mtr0mtr.c: Output to stderr innobase/os/os0file.c: Output to stream, not to memory buffer innobase/os/os0proc.c: Output to stderr innobase/os/os0thread.c: Output to stderr innobase/page/page0cur.c: Output to stderr innobase/page/page0page.c: Avoid sprintf() Output to stderr instead of stdout innobase/pars/pars0opt.c: Output to stderr instead of stdout innobase/rem/rem0rec.c: Remove rec_sprintf() Output to stderr instead of stdout innobase/row/row0ins.c: Output diagnostics to stream instead of memory buffer innobase/row/row0mysql.c: Output to stderr instead of stdout Quote table and index names innobase/row/row0purge.c: Output to stderr instead of stdout innobase/row/row0row.c: Quote table and index names innobase/row/row0sel.c: Output to stderr instead of stdout Quote table and index names innobase/row/row0umod.c: Avoid sprintf() Quote table and index names innobase/row/row0undo.c: Output to stderr instead of stdout innobase/row/row0upd.c: Avoid sprintf() innobase/srv/srv0srv.c: Output to stderr instead of stdout innobase/srv/srv0start.c: Handle srv_monitor_file Make some global variables static innobase/sync/sync0arr.c: Output to stderr instead of stdout Output to stream instead of memory buffer innobase/sync/sync0rw.c: Output to stderr instead of stdout innobase/sync/sync0sync.c: Output to stderr instead of stdout Output to stream instead of memory buffer innobase/trx/trx0purge.c: Output to stderr instead of stdout innobase/trx/trx0rec.c: Quote index and table names Avoid sprintf() innobase/trx/trx0roll.c: Quote identifier names Output to stderr instead of stdout innobase/trx/trx0sys.c: Output to stderr instead of stdout innobase/trx/trx0trx.c: Output to stream instead of memory buffer innobase/trx/trx0undo.c: Output to stderr instead of stdout innobase/ut/ut0ut.c: Declare mysql_get_identifier_quote_char() Remove ut_sprintf_buf() Add ut_print_name() and ut_print_namel() Add ut_copy_file() sql/ha_innodb.cc: innobase_mysql_print_thd(): output to stream, not to memory buffer Add mysql_get_identifier_quote_char() Remove unused function innobase_print_error() Display pointers with %p Buffer InnoDB output via files, not via statically allocated memory
Diffstat (limited to 'innobase/page/page0page.c')
-rw-r--r--innobase/page/page0page.c196
1 files changed, 84 insertions, 112 deletions
diff --git a/innobase/page/page0page.c b/innobase/page/page0page.c
index 7ebcb853448..76a0a950178 100644
--- a/innobase/page/page0page.c
+++ b/innobase/page/page0page.c
@@ -75,7 +75,6 @@ page_dir_find_owner_slot(
page_t* page;
page_dir_slot_t* slot;
rec_t* original_rec = rec;
- char err_buf[1000];
ut_ad(page_rec_check(rec));
@@ -93,20 +92,21 @@ page_dir_find_owner_slot(
if (i == 0) {
fprintf(stderr,
- "InnoDB: Probable data corruption on page %lu\n",
+ "InnoDB: Probable data corruption on page %lu\n"
+ "InnoDB: Original record ",
buf_frame_get_page_no(page));
- rec_sprintf(err_buf, 900, original_rec);
+ rec_print(stderr, original_rec);
- fprintf(stderr,
- "InnoDB: Original record %s\n"
- "InnoDB: on that page. Steps %lu.\n", err_buf, steps);
+ fprintf(stderr, "\n"
+ "InnoDB: on that page. Steps %lu.\n", steps);
- rec_sprintf(err_buf, 900, rec);
-
- fprintf(stderr,
- "InnoDB: Cannot find the dir slot for record %s\n"
- "InnoDB: on that page!\n", err_buf);
+ fputs(
+ "InnoDB: Cannot find the dir slot for record ",
+ stderr);
+ rec_print(stderr, rec);
+ fputs("\n"
+ "InnoDB: on that page!\n", stderr);
buf_page_print(page);
@@ -1120,8 +1120,8 @@ page_rec_print(
/*===========*/
rec_t* rec)
{
- rec_print(rec);
- printf(
+ rec_print(stderr, rec);
+ fprintf(stderr,
" n_owned: %lu; heap_no: %lu; next rec: %lu\n",
rec_get_n_owned(rec),
rec_get_heap_no(rec),
@@ -1147,25 +1147,26 @@ page_dir_print(
n = page_dir_get_n_slots(page);
- printf("--------------------------------\n");
- printf("PAGE DIRECTORY\n");
- printf("Page address %lx\n", (ulint)page);
- printf("Directory stack top at offs: %lu; number of slots: %lu\n",
- (ulint)(page_dir_get_nth_slot(page, n - 1) - page), n);
+ fprintf(stderr, "--------------------------------\n"
+ "PAGE DIRECTORY\n"
+ "Page address %p\n"
+ "Directory stack top at offs: %lu; number of slots: %lu\n",
+ page, (ulint)(page_dir_get_nth_slot(page, n - 1) - page), n);
for (i = 0; i < n; i++) {
slot = page_dir_get_nth_slot(page, i);
if ((i == pr_n) && (i < n - pr_n)) {
- printf(" ... \n");
+ fputs(" ... \n", stderr);
}
if ((i < pr_n) || (i >= n - pr_n)) {
- printf(
+ fprintf(stderr,
"Contents of slot: %lu: n_owned: %lu, rec offs: %lu\n",
i, page_dir_slot_get_n_owned(slot),
(ulint)(page_dir_slot_get_rec(slot) - page));
}
}
- printf("Total of %lu records\n", 2 + page_get_n_recs(page));
- printf("--------------------------------\n");
+ fprintf(stderr, "Total of %lu records\n"
+ "--------------------------------\n",
+ 2 + page_get_n_recs(page));
}
/*******************************************************************
@@ -1179,21 +1180,20 @@ page_print_list(
ulint pr_n) /* in: print n first and n last entries */
{
page_cur_t cur;
- rec_t* rec;
ulint count;
ulint n_recs;
- printf("--------------------------------\n");
- printf("PAGE RECORD LIST\n");
- printf("Page address %lu\n", (ulint)page);
+ fprintf(stderr,
+ "--------------------------------\n"
+ "PAGE RECORD LIST\n"
+ "Page address %p\n", page);
n_recs = page_get_n_recs(page);
page_cur_set_before_first(page, &cur);
count = 0;
for (;;) {
- rec = (&cur)->rec;
- page_rec_print(rec);
+ page_rec_print(cur.rec);
if (count == pr_n) {
break;
@@ -1206,24 +1206,22 @@ page_print_list(
}
if (n_recs > 2 * pr_n) {
- printf(" ... \n");
+ fputs(" ... \n", stderr);
}
- for (;;) {
- if (page_cur_is_after_last(&cur)) {
- break;
- }
+ while (!page_cur_is_after_last(&cur)) {
page_cur_move_to_next(&cur);
if (count + pr_n >= n_recs) {
- rec = (&cur)->rec;
- page_rec_print(rec);
+ page_rec_print(cur.rec);
}
count++;
}
- printf("Total of %lu records \n", count + 1);
- printf("--------------------------------\n");
+ fprintf(stderr,
+ "Total of %lu records \n"
+ "--------------------------------\n",
+ count + 1);
}
/*******************************************************************
@@ -1234,21 +1232,19 @@ page_header_print(
/*==============*/
page_t* page)
{
- printf("--------------------------------\n");
- printf("PAGE HEADER INFO\n");
- printf("Page address %lx, n records %lu\n", (ulint)page,
- page_header_get_field(page, PAGE_N_RECS));
-
- printf("n dir slots %lu, heap top %lu\n",
+ fprintf(stderr,
+ "--------------------------------\n"
+ "PAGE HEADER INFO\n"
+ "Page address %p, n records %lu\n"
+ "n dir slots %lu, heap top %lu\n"
+ "Page n heap %lu, free %lu, garbage %lu\n"
+ "Page last insert %lu, direction %lu, n direction %lu\n",
+ page, page_header_get_field(page, PAGE_N_RECS),
page_header_get_field(page, PAGE_N_DIR_SLOTS),
- page_header_get_field(page, PAGE_HEAP_TOP));
-
- printf("Page n heap %lu, free %lu, garbage %lu\n",
+ page_header_get_field(page, PAGE_HEAP_TOP),
page_header_get_field(page, PAGE_N_HEAP),
page_header_get_field(page, PAGE_FREE),
- page_header_get_field(page, PAGE_GARBAGE));
-
- printf("Page last insert %lu, direction %lu, n direction %lu\n",
+ page_header_get_field(page, PAGE_GARBAGE),
page_header_get_field(page, PAGE_LAST_INSERT),
page_header_get_field(page, PAGE_DIRECTION),
page_header_get_field(page, PAGE_N_DIRECTION));
@@ -1555,17 +1551,9 @@ page_validate(
ulint n_slots;
ibool ret = FALSE;
ulint i;
- char err_buf[1000];
if (!page_simple_validate(page)) {
- fprintf(stderr,
-"InnoDB: Apparent corruption in page %lu in index %s in table %s\n",
- buf_frame_get_page_no(page), index->name,
- index->table_name);
-
- buf_page_print(page);
-
- return(FALSE);
+ goto func_exit2;
}
heap = mem_heap_create(UNIV_PAGE_SIZE);
@@ -1585,10 +1573,13 @@ page_validate(
if (!(page_header_get_ptr(page, PAGE_HEAP_TOP) <=
page_dir_get_nth_slot(page, n_slots - 1))) {
- fprintf(stderr,
-"InnoDB: Record heap and dir overlap on a page in index %s, %lu, %lu\n",
- index->name, (ulint)page_header_get_ptr(page, PAGE_HEAP_TOP),
- (ulint)page_dir_get_nth_slot(page, n_slots - 1));
+
+ fputs("InnoDB: Record heap and dir overlap on a page ",
+ stderr);
+ dict_index_name_print(stderr, index);
+ fprintf(stderr, ", %p, %p\n",
+ page_header_get_ptr(page, PAGE_HEAP_TOP),
+ page_dir_get_nth_slot(page, n_slots - 1));
goto func_exit;
}
@@ -1614,18 +1605,14 @@ page_validate(
if ((count >= 2) && (!page_cur_is_after_last(&cur))) {
if (!(1 == cmp_rec_rec(rec, old_rec, index))) {
fprintf(stderr,
-"InnoDB: Records in wrong order on page %lu index %s table %s\n",
- buf_frame_get_page_no(page),
- index->name,
- index->table_name);
-
- rec_sprintf(err_buf, 900, old_rec);
- fprintf(stderr,
- "InnoDB: previous record %s\n", err_buf);
-
- rec_sprintf(err_buf, 900, rec);
- fprintf(stderr,
- "InnoDB: record %s\n", err_buf);
+ "InnoDB: Records in wrong order on page %lu",
+ buf_frame_get_page_no(page));
+ dict_index_name_print(stderr, index);
+ fputs("\nInnoDB: previous record ", stderr);
+ rec_print(stderr, old_rec);
+ fputs("\nInnoDB: record ", stderr);
+ rec_print(stderr, rec);
+ putc('\n', stderr);
goto func_exit;
}
@@ -1643,10 +1630,8 @@ page_validate(
if (!buf[offs + i] == 0) {
/* No other record may overlap this */
- fprintf(stderr,
- "InnoDB: Record overlaps another in index %s \n",
- index->name);
-
+ fputs("InnoDB: Record overlaps another\n",
+ stderr);
goto func_exit;
}
@@ -1657,18 +1642,15 @@ page_validate(
/* This is a record pointed to by a dir slot */
if (rec_get_n_owned(rec) != own_count) {
fprintf(stderr,
- "InnoDB: Wrong owned count %lu, %lu, in index %s\n",
- rec_get_n_owned(rec), own_count,
- index->name);
-
+ "InnoDB: Wrong owned count %lu, %lu\n",
+ rec_get_n_owned(rec), own_count);
goto func_exit;
}
if (page_dir_slot_get_rec(slot) != rec) {
- fprintf(stderr,
- "InnoDB: Dir slot does not point to right rec in %s\n",
- index->name);
-
+ fputs(
+ "InnoDB: Dir slot does not point to right rec\n",
+ stderr);
goto func_exit;
}
@@ -1688,9 +1670,8 @@ page_validate(
if (rec_get_next_offs(rec) < FIL_PAGE_DATA
|| rec_get_next_offs(rec) >= UNIV_PAGE_SIZE) {
fprintf(stderr,
- "InnoDB: Next record offset wrong %lu in index %s\n",
- rec_get_next_offs(rec), index->name);
-
+ "InnoDB: Next record offset wrong %lu\n",
+ rec_get_next_offs(rec));
goto func_exit;
}
@@ -1701,23 +1682,19 @@ page_validate(
}
if (rec_get_n_owned(rec) == 0) {
- fprintf(stderr,
- "InnoDB: n owned is zero in index %s\n", index->name);
-
+ fputs("InnoDB: n owned is zero\n", stderr);
goto func_exit;
}
if (slot_no != n_slots - 1) {
- fprintf(stderr, "InnoDB: n slots wrong %lu %lu in index %s\n",
- slot_no, n_slots - 1, index->name);
+ fprintf(stderr, "InnoDB: n slots wrong %lu %lu\n",
+ slot_no, n_slots - 1);
goto func_exit;
}
if (page_header_get_field(page, PAGE_N_RECS) + 2 != count + 1) {
- fprintf(stderr, "InnoDB: n recs wrong %lu %lu in index %s\n",
- page_header_get_field(page, PAGE_N_RECS) + 2, count + 1,
- index->name);
-
+ fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
+ page_header_get_field(page, PAGE_N_RECS) + 2, count + 1);
goto func_exit;
}
@@ -1743,10 +1720,8 @@ page_validate(
for (i = 0; i < rec_get_size(rec); i++) {
if (buf[offs + i] != 0) {
- fprintf(stderr,
- "InnoDB: Record overlaps another in free list, index %s \n",
- index->name);
-
+ fputs(
+ "InnoDB: Record overlaps another in free list\n", stderr);
goto func_exit;
}
@@ -1757,11 +1732,8 @@ page_validate(
}
if (page_header_get_field(page, PAGE_N_HEAP) != count + 1) {
-
- fprintf(stderr,
- "InnoDB: N heap is wrong %lu %lu in index %s\n",
- page_header_get_field(page, PAGE_N_HEAP), count + 1,
- index->name);
+ fprintf(stderr, "InnoDB: N heap is wrong %lu %lu\n",
+ page_header_get_field(page, PAGE_N_HEAP), count + 1);
goto func_exit;
}
@@ -1771,11 +1743,11 @@ func_exit:
mem_heap_free(heap);
if (ret == FALSE) {
- fprintf(stderr,
-"InnoDB: Apparent corruption in page %lu in index %s in table %s\n",
- buf_frame_get_page_no(page), index->name,
- index->table_name);
-
+ func_exit2:
+ fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ",
+ buf_frame_get_page_no(page));
+ dict_index_name_print(stderr, index);
+ putc('\n', stderr);
buf_page_print(page);
}