diff options
author | unknown <monty@narttu.mysql.fi> | 2003-02-26 01:03:47 +0200 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-02-26 01:03:47 +0200 |
commit | a7e3ba1df50e4be9148baa2396a0d19f4fe73b8e (patch) | |
tree | c9b14451b3f66dc4b11dc35d49edd35f23787e07 /innobase | |
parent | 829af501690380ce88d2db88de279e3f04e9b856 (diff) | |
parent | bebafeba4480537414e11dbe8ce08414077e5c78 (diff) | |
download | mariadb-git-a7e3ba1df50e4be9148baa2396a0d19f4fe73b8e.tar.gz |
Merge with 4.0.11
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
BUILD/FINISH.sh:
Auto merged
client/mysqldump.c:
Auto merged
include/my_base.h:
Auto merged
include/my_pthread.h:
Auto merged
innobase/row/row0sel.c:
Auto merged
innobase/ut/ut0mem.c:
Auto merged
myisam/myisamchk.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/bigint.result:
Auto merged
mysql-test/r/handler.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/innodb_handler.result:
Auto merged
mysql-test/r/query_cache.result:
Auto merged
mysql-test/t/bigint.test:
Auto merged
mysql-test/t/handler.test:
Auto merged
mysql-test/t/innodb.test:
Auto merged
mysql-test/t/innodb_handler.test:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
sql/mysqld.cc:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_handler.cc:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/share/czech/errmsg.txt:
Auto merged
sql/share/danish/errmsg.txt:
Auto merged
sql/share/dutch/errmsg.txt:
Auto merged
sql/share/english/errmsg.txt:
Auto merged
sql/share/estonian/errmsg.txt:
Auto merged
sql/share/french/errmsg.txt:
Auto merged
sql/share/greek/errmsg.txt:
Auto merged
sql/share/hungarian/errmsg.txt:
Auto merged
sql/share/italian/errmsg.txt:
Auto merged
sql/share/japanese/errmsg.txt:
Auto merged
sql/share/korean/errmsg.txt:
Auto merged
sql/share/norwegian-ny/errmsg.txt:
Auto merged
sql/share/norwegian/errmsg.txt:
Auto merged
sql/share/polish/errmsg.txt:
Auto merged
sql/share/portuguese/errmsg.txt:
Auto merged
sql/share/romanian/errmsg.txt:
Auto merged
sql/share/russian/errmsg.txt:
Auto merged
sql/share/slovak/errmsg.txt:
Auto merged
sql/share/spanish/errmsg.txt:
Auto merged
sql/share/swedish/errmsg.txt:
Auto merged
sql/share/ukrainian/errmsg.txt:
Auto merged
sql/table.h:
Auto merged
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/ibuf/ibuf0ibuf.c | 43 | ||||
-rw-r--r-- | innobase/page/page0cur.c | 71 | ||||
-rw-r--r-- | innobase/row/row0sel.c | 14 | ||||
-rw-r--r-- | innobase/ut/ut0mem.c | 10 |
4 files changed, 113 insertions, 25 deletions
diff --git a/innobase/ibuf/ibuf0ibuf.c b/innobase/ibuf/ibuf0ibuf.c index 668e9419c24..5cd066afc27 100644 --- a/innobase/ibuf/ibuf0ibuf.c +++ b/innobase/ibuf/ibuf0ibuf.c @@ -2488,7 +2488,9 @@ ibuf_merge_or_delete_for_page( ulint old_bits; ulint new_bits; dulint max_trx_id; + ibool corruption_noticed = FALSE; mtr_t mtr; + char err_buf[500]; if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { @@ -2540,7 +2542,38 @@ ibuf_merge_or_delete_for_page( block = buf_block_align(page); rw_lock_x_lock_move_ownership(&(block->lock)); - ut_a(fil_page_get_type(page) == FIL_PAGE_INDEX); + if (fil_page_get_type(page) != FIL_PAGE_INDEX) { + + corruption_noticed = TRUE; + + ut_print_timestamp(stderr); + + mtr_start(&mtr); + + fprintf(stderr, +" InnoDB: Dump of the ibuf bitmap page:\n"); + + bitmap_page = ibuf_bitmap_get_map_page(space, page_no, + &mtr); + buf_page_print(bitmap_page); + + mtr_commit(&mtr); + + fprintf(stderr, "\nInnoDB: Dump of the page:\n"); + + buf_page_print(page); + + fprintf(stderr, +"InnoDB: Error: corruption in the tablespace. Bitmap shows insert\n" +"InnoDB: buffer records to page n:o %lu though the page\n" +"InnoDB: type is %lu, which is not an index page!\n" +"InnoDB: We try to resolve the problem by skipping the insert buffer\n" +"InnoDB: merge for this page. Please run CHECK TABLE on your tables\n" +"InnoDB: to determine if they are corrupt after this.\n\n" +"InnoDB: Please make a detailed bug report and send it to\n" +"InnoDB: mysql@lists.mysql.com\n\n", + page_no, fil_page_get_type(page)); + } } n_inserts = 0; @@ -2583,8 +2616,14 @@ loop: goto reset_bit; } + + 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); - if (page) { + } else if (page) { /* Now we have at pcur a record which should be inserted to the index page; NOTE that the call below copies pointers to fields in ibuf_rec, and we must diff --git a/innobase/page/page0cur.c b/innobase/page/page0cur.c index 0e65dc8b1de..d3a40668c4b 100644 --- a/innobase/page/page0cur.c +++ b/innobase/page/page0cur.c @@ -121,6 +121,53 @@ page_cur_try_search_shortcut( #endif /******************************************************************** +Checks if the nth field in a record is a character type field which extends +the nth field in tuple, i.e., the field is longer or equal in length and has +common first characters. */ +static +ibool +page_cur_rec_field_extends( +/*=======================*/ + /* out: TRUE if rec field extends tuple + field */ + dtuple_t* tuple, /* in: data tuple */ + rec_t* rec, /* in: record */ + ulint n) /* in: compare nth field */ +{ + dtype_t* type; + dfield_t* dfield; + byte* rec_f; + ulint rec_f_len; + + dfield = dtuple_get_nth_field(tuple, n); + + type = dfield_get_type(dfield); + + rec_f = rec_get_nth_field(rec, n, &rec_f_len); + + if (type->mtype == DATA_VARCHAR + || type->mtype == DATA_CHAR + || type->mtype == DATA_FIXBINARY + || type->mtype == DATA_BINARY + || type->mtype == DATA_BLOB + || type->mtype == DATA_VARMYSQL + || type->mtype == DATA_MYSQL) { + + if (dfield_get_len(dfield) != UNIV_SQL_NULL + && rec_f_len != UNIV_SQL_NULL + && rec_f_len >= dfield_get_len(dfield) + && 0 == cmp_data_data_slow(type, dfield_get_data(dfield), + dfield_get_len(dfield), + rec_f, dfield_get_len(dfield))) { + + return(TRUE); + } + } + + return(FALSE); +} + +/******************************************************************** Searches the right position for a page cursor. */ void @@ -239,16 +286,8 @@ page_cur_search_with_match( } else if (cmp == -1) { if (mode == PAGE_CUR_LE_OR_EXTENDS - && dfield_get_len(dtuple_get_nth_field(tuple, - cur_matched_fields)) - == cur_matched_bytes - && rec_get_nth_field_len(mid_rec, - cur_matched_fields) - != UNIV_SQL_NULL) { - - /* This means current dfield is not SQL - NULL, and the current rec field extends it */ - + && page_cur_rec_field_extends(tuple, mid_rec, + cur_matched_fields)) { low = mid; low_matched_fields = cur_matched_fields; low_matched_bytes = cur_matched_bytes; @@ -296,16 +335,8 @@ page_cur_search_with_match( } else if (cmp == -1) { if (mode == PAGE_CUR_LE_OR_EXTENDS - && dfield_get_len(dtuple_get_nth_field(tuple, - cur_matched_fields)) - == cur_matched_bytes - && rec_get_nth_field_len(mid_rec, - cur_matched_fields) - != UNIV_SQL_NULL) { - - /* This means current dfield is not SQL - NULL, and the current rec field extends it */ - + && page_cur_rec_field_extends(tuple, mid_rec, + cur_matched_fields)) { low_rec = mid_rec; low_matched_fields = cur_matched_fields; low_matched_bytes = cur_matched_bytes; diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 34f951b0c8a..1fc329fe2ca 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -1926,7 +1926,19 @@ row_sel_convert_mysql_key_to_innobase( if (key_ptr > key_end) { /* The last field in key was not a complete - field but a prefix of it */ + field but a prefix of it. + + Print a warning about this! HA_READ_PREFIX_LAST + does not currently work in InnoDB with partial-field + key value prefixes. Since MySQL currently uses a + padding trick to calculate LIKE 'abc%' type queries + there should never be partial-field prefixes + in searches. */ + + ut_print_timestamp(stderr); + + fprintf(stderr, + " InnoDB: Warning: using a partial-field key prefix in search\n"); ut_ad(dfield_get_len(dfield) != UNIV_SQL_NULL); diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c index a5991d5683d..23deed0fa55 100644 --- a/innobase/ut/ut0mem.c +++ b/innobase/ut/ut0mem.c @@ -81,7 +81,7 @@ ut_malloc_low( fprintf(stderr, " InnoDB: Fatal error: cannot allocate %lu bytes of\n" "InnoDB: memory with malloc! Total allocated memory\n" - "InnoDB: by InnoDB %lu bytes. Operating system errno: %d\n" + "InnoDB: by InnoDB %lu bytes. Operating system errno: %lu\n" "InnoDB: Cannot continue operation!\n" "InnoDB: Check if you should increase the swap file or\n" "InnoDB: ulimits of your operating system.\n" @@ -89,7 +89,13 @@ ut_malloc_low( "InnoDB: a big enough maximum process size.\n" "InnoDB: We now intentionally generate a seg fault so that\n" "InnoDB: on Linux we get a stack trace.\n", - n, ut_total_allocated_memory, errno); + n, ut_total_allocated_memory, +#ifdef __WIN__ + (ulint)GetLastError() +#else + (ulint)errno +#endif + ); /* Flush stderr to make more probable that the error message gets in the error file before we generate a seg |