summaryrefslogtreecommitdiff
path: root/innobase/page
diff options
context:
space:
mode:
authorunknown <monty@mishka.local>2004-04-26 15:53:31 +0300
committerunknown <monty@mishka.local>2004-04-26 15:53:31 +0300
commit1065f2bbd66ac4b1161f5c188171a54cbad5b422 (patch)
tree25e3315af05fa92d20d2ad1d812882957c400337 /innobase/page
parent0ba6cb48d84f1ff951d09871a96be6cdef3f2c3c (diff)
parent6366a9090c7fc24f0e13b5b9d73d6777dcda9d9e (diff)
downloadmariadb-git-1065f2bbd66ac4b1161f5c188171a54cbad5b422.tar.gz
Merge with 4.0
innobase/dict/dict0boot.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/fut/fut0lst.c: Auto merged innobase/include/buf0lru.h: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/fsp0fsp.h: Auto merged innobase/include/ha0ha.h: Auto merged innobase/include/ibuf0ibuf.h: Auto merged innobase/include/lock0lock.h: Auto merged innobase/include/log0log.h: Auto merged innobase/include/mem0pool.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/os0file.h: Auto merged innobase/include/rem0rec.h: Auto merged innobase/include/rem0rec.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0sys.h: Auto merged innobase/include/ut0byte.h: Auto merged innobase/include/ut0ut.h: Auto merged innobase/mem/mem0pool.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0proc.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/pars/pars0opt.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0uins.c: Auto merged innobase/row/row0umod.c: Auto merged innobase/row/row0undo.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0undo.c: Auto merged innobase/ut/ut0byte.c: Auto merged pstack/bucomm.h: Auto merged pstack/budbg.h: Auto merged sql/item_sum.h: Auto merged sql/slave.cc: Auto merged sql/sql_db.cc: Auto merged support-files/mysql.spec.sh: Auto merged tests/insert_test.c: Auto merged mysql-test/t/func_group.test: Merge with 4.0 Put 4.1 tests lasts sql/ha_innodb.cc: Merge with 4.0 Added checking of results from my_malloc() BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'innobase/page')
-rw-r--r--innobase/page/page0cur.c16
-rw-r--r--innobase/page/page0page.c206
2 files changed, 96 insertions, 126 deletions
diff --git a/innobase/page/page0cur.c b/innobase/page/page0cur.c
index 5d26d12bf20..459ab986610 100644
--- a/innobase/page/page0cur.c
+++ b/innobase/page/page0cur.c
@@ -479,6 +479,7 @@ page_cur_insert_rec_write_log(
ulint i;
ut_a(rec_size < UNIV_PAGE_SIZE);
+ ut_ad(rec_size == rec_get_size(insert_rec));
log_ptr = mlog_open(mtr, 30 + MLOG_BUF_MARGIN);
@@ -631,7 +632,7 @@ page_cur_parse_insert_rec(
}
extra_info_yes = end_seg_len & 0x1UL;
- end_seg_len = end_seg_len / 2;
+ end_seg_len >>= 1;
if (end_seg_len >= UNIV_PAGE_SIZE) {
recv_sys->found_corrupt_log = TRUE;
@@ -694,7 +695,7 @@ page_cur_parse_insert_rec(
mismatch_index = rec_get_size(cursor_rec) - end_seg_len;
}
- if (mismatch_index + end_seg_len < 1024) {
+ if (mismatch_index + end_seg_len < sizeof buf1) {
buf = buf1;
} else {
buf = mem_alloc(mismatch_index + end_seg_len);
@@ -703,8 +704,9 @@ 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",
(ulong) is_short, (ulong) info_bits, (ulong) offset,
@@ -712,8 +714,8 @@ page_cur_parse_insert_rec(
(ulong) mismatch_index, (ulong) end_seg_len,
(ulong) (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);
@@ -729,7 +731,7 @@ page_cur_parse_insert_rec(
page_cur_rec_insert(&cursor, buf + origin_offset, mtr);
- if (mismatch_index + end_seg_len >= 1024) {
+ if (buf != buf1) {
mem_free(buf);
}
diff --git a/innobase/page/page0page.c b/innobase/page/page0page.c
index c64a7590b94..aecc2dc4fd2 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,20 @@ 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 ",
(ulong) 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, (ulong) 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);
+ fprintf(stderr, "\n"
+ "InnoDB: on that page. Steps %lu.\n", (ulong) steps);
+ 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);
@@ -1121,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",
(ulong) rec_get_n_owned(rec),
(ulong) rec_get_heap_no(rec),
@@ -1148,25 +1147,26 @@ page_dir_print(
n = page_dir_get_n_slots(page);
- printf("--------------------------------\n");
- printf("PAGE DIRECTORY\n");
- printf("Page address %lx\n", (ulong)page);
- printf("Directory stack top at offs: %lu; number of slots: %lu\n",
- (ulong)(page_dir_get_nth_slot(page, n - 1) - page), (ulong) n);
+ fprintf(stderr, "--------------------------------\n"
+ "PAGE DIRECTORY\n"
+ "Page address %p\n"
+ "Directory stack top at offs: %lu; number of slots: %lu\n",
+ page, (ulong)(page_dir_get_nth_slot(page, n - 1) - page), (ulong) 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",
(ulong) i, (ulong) page_dir_slot_get_n_owned(slot),
(ulong)(page_dir_slot_get_rec(slot) - page));
}
}
- printf("Total of %lu records\n", (ulong) (2 + page_get_n_recs(page)));
- printf("--------------------------------\n");
+ fprintf(stderr, "Total of %lu records\n"
+ "--------------------------------\n",
+ (ulong) (2 + page_get_n_recs(page)));
}
/*******************************************************************
@@ -1180,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", (ulong) 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;
@@ -1207,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", (ulong) (count + 1));
- printf("--------------------------------\n");
+ fprintf(stderr,
+ "Total of %lu records \n"
+ "--------------------------------\n",
+ (ulong) (count + 1));
}
/*******************************************************************
@@ -1235,21 +1232,19 @@ page_header_print(
/*==============*/
page_t* page)
{
- printf("--------------------------------\n");
- printf("PAGE HEADER INFO\n");
- printf("Page address %lx, n records %lu\n", (ulong) page,
- (ulong) 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, (ulong) page_header_get_field(page, PAGE_N_RECS),
(ulong) page_header_get_field(page, PAGE_N_DIR_SLOTS),
- (ulong) page_header_get_field(page, PAGE_HEAP_TOP));
-
- printf("Page n heap %lu, free %lu, garbage %lu\n",
+ (ulong) page_header_get_field(page, PAGE_HEAP_TOP),
(ulong) page_header_get_field(page, PAGE_N_HEAP),
(ulong) page_header_get_field(page, PAGE_FREE),
- (ulong) page_header_get_field(page, PAGE_GARBAGE));
-
- printf("Page last insert %lu, direction %lu, n direction %lu\n",
+ (ulong) page_header_get_field(page, PAGE_GARBAGE),
(ulong) page_header_get_field(page, PAGE_LAST_INSERT),
(ulong) page_header_get_field(page, PAGE_DIRECTION),
(ulong) page_header_get_field(page, PAGE_N_DIRECTION));
@@ -1559,17 +1554,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",
- (ulong) 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);
@@ -1589,10 +1576,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, (ulong)page_header_get_ptr(page, PAGE_HEAP_TOP),
- (ulong)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;
}
@@ -1608,7 +1598,7 @@ page_validate(
page_cur_set_before_first(page, &cur);
for (;;) {
- rec = (&cur)->rec;
+ rec = cur.rec;
if (!page_rec_validate(rec)) {
goto func_exit;
@@ -1618,18 +1608,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",
- (ulong) 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",
+ (ulong) 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;
}
@@ -1647,10 +1633,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;
}
@@ -1661,19 +1645,16 @@ 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",
+ "InnoDB: Wrong owned count %lu, %lu\n",
(ulong) rec_get_n_owned(rec),
- (ulong) own_count,
- index->name);
-
+ (ulong) 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;
}
@@ -1693,9 +1674,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",
- (ulong) rec_get_next_offs(rec), index->name);
-
+ "InnoDB: Next record offset wrong %lu\n",
+ (ulong) rec_get_next_offs(rec));
goto func_exit;
}
@@ -1706,24 +1686,20 @@ 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",
- (ulong) slot_no, (ulong) (n_slots - 1), index->name);
+ fprintf(stderr, "InnoDB: n slots wrong %lu %lu\n",
+ (ulong) slot_no, (ulong) (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",
+ fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
(ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
- (ulong) (count + 1),
- index->name);
-
+ (ulong) (count + 1));
goto func_exit;
}
@@ -1749,10 +1725,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;
}
@@ -1763,12 +1737,9 @@ 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",
+ fprintf(stderr, "InnoDB: N heap is wrong %lu %lu\n",
(ulong) page_header_get_field(page, PAGE_N_HEAP),
- (ulong) count + 1,
- index->name);
+ (ulong) count + 1);
goto func_exit;
}
@@ -1778,11 +1749,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",
- (ulong) buf_frame_get_page_no(page), index->name,
- index->table_name);
-
+ func_exit2:
+ fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ",
+ (ulong) buf_frame_get_page_no(page));
+ dict_index_name_print(stderr, index);
+ putc('\n', stderr);
buf_page_print(page);
}
@@ -1800,16 +1771,13 @@ page_find_rec_with_heap_no(
ulint heap_no)/* in: heap number */
{
page_cur_t cur;
- rec_t* rec;
page_cur_set_before_first(page, &cur);
for (;;) {
- rec = (&cur)->rec;
-
- if (rec_get_heap_no(rec) == heap_no) {
+ if (rec_get_heap_no(cur.rec) == heap_no) {
- return(rec);
+ return(cur.rec);
}
if (page_cur_is_after_last(&cur)) {