Commit 444c6d0d authored by Satya B's avatar Satya B

Applying InnoDB Plugin 1.0.6 snapshot, part 6. Add Testcase for BUG#46676

1. add testcase for BUG#46676
2. Allow CREATE INDEX to be interrupted
3. ha_innobase::change_active_index(): When the history is
   missing, report it to the client, not to the error log
4. ChangeLog entries

appplied revisions:r6169, r6170, r6175, r6177, r6179

Detailed revision comments:

r6169 | calvin | 2009-11-12 14:40:43 +0200 (Thu, 12 Nov 2009) | 6 lines
branches/zip: add test case for bug#46676

This crash is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
Add test case to catch future regression.

r6170 | marko | 2009-11-12 15:49:08 +0200 (Thu, 12 Nov 2009) | 4 lines
branches/zip: Allow CREATE INDEX to be interrupted.  (Issue #354)

rb://183 approved by Heikki Tuuri

r6175 | vasil | 2009-11-16 20:07:39 +0200 (Mon, 16 Nov 2009) | 4 lines
branches/zip:

Wrap line at 78th char in the ChangeLog

r6177 | calvin | 2009-11-16 20:20:38 +0200 (Mon, 16 Nov 2009) | 2 lines
branches/zip: add an entry to ChangeLog for r6065

r6179 | marko | 2009-11-17 10:19:34 +0200 (Tue, 17 Nov 2009) | 2 lines
branches/zip: ha_innobase::change_active_index(): When the history is
missing, report it to the client, not to the error log.
parent f77d7aae
SET foreign_key_checks=0;
CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB;
CREATE TABLE t2 (id int, foreign key (id) references t1(id)) ENGINE=INNODB;
SET foreign_key_checks=1;
SELECT COUNT(*) FROM information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME in ('t1', 't2');
COUNT(*)
2
SET foreign_key_checks=0;
DROP TABLE t1, t2;
# This is the test for bug 46676: mysqld got exception 0xc0000005
# It is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
# But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
--source include/have_innodb.inc
SET foreign_key_checks=0;
CREATE TABLE t1 (id int, foreign key (id) references t2(id)) ENGINE=INNODB;
CREATE TABLE t2 (id int, foreign key (id) references t1(id)) ENGINE=INNODB;
SET foreign_key_checks=1;
# Server crashes
SELECT COUNT(*) FROM information_schema.key_column_usage WHERE REFERENCED_TABLE_NAME in ('t1', 't2');
SET foreign_key_checks=0;
DROP TABLE t1, t2;
2009-11-12 The InnoDB Team
* handler/ha_innodb.cc, include/db0err.h, row/row0merge.c,
row/row0mysql.c:
Allow CREATE INDEX to be interrupted.
Also, when CHECK TABLE is interrupted, report ER_QUERY_INTERRUPTED.
2009-11-11 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb_bug47167.result,
......@@ -104,6 +111,12 @@
Fix Bug#47058 Failure to compile innodb_plugin on solaris 10u7 + spro
cc/CC 5.10
2009-10-13 The InnoDB Team
* buf/buf0flu.c:
Call fsync() on datafiles after a batch of pages is written to disk
even when skip_innodb_doublewrite is set.
2009-10-05 The InnoDB Team
* buf/buf0buf.c:
......
......@@ -785,6 +785,9 @@ convert_error_code_to_mysql(
case DB_SUCCESS:
return(0);
case DB_INTERRUPTED:
my_error(ER_QUERY_INTERRUPTED, MYF(0));
/* fall through */
case DB_ERROR:
default:
return(-1); /* unspecified error */
......@@ -5238,8 +5241,10 @@ ha_innobase::change_active_index(
prebuilt->index);
if (UNIV_UNLIKELY(!prebuilt->index_usable)) {
sql_print_warning("InnoDB: insufficient history for index %u",
keynr);
push_warning_printf(user_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
HA_ERR_TABLE_DEF_CHANGED,
"InnoDB: insufficient history for index %u",
keynr);
/* The caller seems to ignore this. Thus, we must check
this again in row_search_for_mysql(). */
DBUG_RETURN(2);
......@@ -7361,11 +7366,15 @@ ha_innobase::check(
ret = row_check_table_for_mysql(prebuilt);
if (ret == DB_SUCCESS) {
switch (ret) {
case DB_SUCCESS:
return(HA_ADMIN_OK);
case DB_INTERRUPTED:
my_error(ER_QUERY_INTERRUPTED, MYF(0));
return(-1);
default:
return(HA_ADMIN_CORRUPT);
}
return(HA_ADMIN_CORRUPT);
}
/*************************************************************//**
......
......@@ -32,6 +32,7 @@ enum db_err {
/* The following are error codes */
DB_ERROR,
DB_INTERRUPTED,
DB_OUT_OF_MEMORY,
DB_OUT_OF_FILE_SPACE,
DB_LOCK_WAIT,
......
......@@ -1200,6 +1200,12 @@ row_merge_read_clustered_index(
in order to release the latch on the old page. */
if (btr_pcur_is_after_last_on_page(&pcur)) {
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
i = 0;
err = DB_INTERRUPTED;
goto err_exit;
}
btr_pcur_store_position(&pcur, &mtr);
mtr_commit(&mtr);
mtr_start(&mtr);
......@@ -1557,6 +1563,7 @@ static __attribute__((nonnull))
ulint
row_merge(
/*======*/
trx_t* trx, /*!< in: transaction */
const dict_index_t* index, /*!< in: index being created */
merge_file_t* file, /*!< in/out: file containing
index entries */
......@@ -1590,6 +1597,10 @@ row_merge(
for (; foffs0 < ihalf && foffs1 < file->offset; foffs0++, foffs1++) {
ulint ahalf; /*!< arithmetic half the input file */
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
error = row_merge_blocks(index, file, block,
&foffs0, &foffs1, &of, table);
......@@ -1617,6 +1628,10 @@ row_merge(
/* Copy the last blocks, if there are any. */
while (foffs0 < ihalf) {
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
if (!row_merge_blocks_copy(index, file, block, &foffs0, &of)) {
return(DB_CORRUPTION);
}
......@@ -1625,6 +1640,10 @@ row_merge(
ut_ad(foffs0 == ihalf);
while (foffs1 < file->offset) {
if (UNIV_UNLIKELY(trx_is_interrupted(trx))) {
return(DB_INTERRUPTED);
}
if (!row_merge_blocks_copy(index, file, block, &foffs1, &of)) {
return(DB_CORRUPTION);
}
......@@ -1653,6 +1672,7 @@ static
ulint
row_merge_sort(
/*===========*/
trx_t* trx, /*!< in: transaction */
const dict_index_t* index, /*!< in: index being created */
merge_file_t* file, /*!< in/out: file containing
index entries */
......@@ -1671,7 +1691,8 @@ row_merge_sort(
do {
ulint error;
error = row_merge(index, file, &half, block, tmpfd, table);
error = row_merge(trx, index, file, &half,
block, tmpfd, table);
if (error != DB_SUCCESS) {
return(error);
......@@ -2490,7 +2511,7 @@ row_merge_build_indexes(
sorting and inserting. */
for (i = 0; i < n_indexes; i++) {
error = row_merge_sort(indexes[i], &merge_files[i],
error = row_merge_sort(trx, indexes[i], &merge_files[i],
block, &tmpfd, table);
if (error == DB_SUCCESS) {
......
......@@ -4157,6 +4157,7 @@ row_check_table_for_mysql(
}
if (trx_is_interrupted(prebuilt->trx)) {
ret = DB_INTERRUPTED;
break;
}
......
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