diff options
author | unknown <svoj@may.pils.ru> | 2006-10-08 15:32:00 +0500 |
---|---|---|
committer | unknown <svoj@may.pils.ru> | 2006-10-08 15:32:00 +0500 |
commit | b5ae1184d7c2e5adb404579dd7fd5d0479ef9897 (patch) | |
tree | e31b1549a26b43b43a1a0b5e881fd29fc5cb3f49 | |
parent | 76cdfbbdfee7928dee2fbc0f8f07e1e0ca0cba33 (diff) | |
parent | 4d7a6cf766ba77c2543f82af9e3a52b2534188e8 (diff) | |
download | mariadb-git-b5ae1184d7c2e5adb404579dd7fd5d0479ef9897.tar.gz |
Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-5.1
into may.pils.ru:/home/svoj/devel/bk/mysql-5.1-engines
sql/sql_update.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
storage/csv/ha_tina.cc:
Auto merged
storage/myisammrg/ha_myisammrg.cc:
Auto merged
mysql-test/r/windows.result:
Use remote.
mysql-test/t/windows.test:
Use remote.
-rw-r--r-- | mysql-test/r/csv.result | 19 | ||||
-rw-r--r-- | mysql-test/r/merge.result | 10 | ||||
-rw-r--r-- | mysql-test/t/csv.test | 23 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 6 | ||||
-rw-r--r-- | storage/csv/ha_tina.cc | 34 | ||||
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 15 |
7 files changed, 86 insertions, 23 deletions
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index e342af32a80..222d4de8059 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5205,3 +5205,22 @@ select * from bug15205; val drop table bug15205; drop table bug15205_2; +create table bug22080_1 (id int,string varchar(64)) Engine=CSV; +create table bug22080_2 (id int,string varchar(64)) Engine=CSV; +create table bug22080_3 (id int,string varchar(64)) Engine=CSV; +insert into bug22080_1 values(1,'string'); +insert into bug22080_1 values(2,'string'); +insert into bug22080_1 values(3,'string'); +"1","string" +2","string" +"3","string" +check table bug22080_2; +Table Op Msg_type Msg_text +test.bug22080_2 check error Corrupt +"1","string" +"2",string" +"3","string" +check table bug22080_3; +Table Op Msg_type Msg_text +test.bug22080_3 check error Corrupt +drop tables bug22080_1,bug22080_2,bug22080_3; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index f9c2f111734..1e0207683ee 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -178,12 +178,12 @@ t3 CREATE TABLE `t3` ( ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) create table t4 (a int not null, b char(10), key(a)) engine=MERGE UNION=(t1,t2); select * from t4; -ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist alter table t4 add column c int; -ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist flush tables; select * from t4; -ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist create database mysqltest; create table mysqltest.t6 (a int not null primary key auto_increment, message char(20)); create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1,mysqltest.t6); @@ -780,11 +780,11 @@ DROP TABLE t1, t2; CREATE TABLE t1(a INT) ENGINE=MEMORY; CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t1); SELECT * FROM t2; -ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist DROP TABLE t1, t2; CREATE TABLE t2(a INT) ENGINE=MERGE UNION=(t3); SELECT * FROM t2; -ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists +ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist DROP TABLE t2; create table t1 (b bit(1)); create table t2 (b bit(1)); diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 9815da4fb55..f70b5b40766 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1582,3 +1582,26 @@ select * from bug15205_2; select * from bug15205; drop table bug15205; drop table bug15205_2; + +# +# Bug#22080 "CHECK fails to identify some corruption" +# + +create table bug22080_1 (id int,string varchar(64)) Engine=CSV; +create table bug22080_2 (id int,string varchar(64)) Engine=CSV; +create table bug22080_3 (id int,string varchar(64)) Engine=CSV; +insert into bug22080_1 values(1,'string'); +insert into bug22080_1 values(2,'string'); +insert into bug22080_1 values(3,'string'); + +# Currupt the file as described in the bug report +--exec sed -e 's/"2"/2"/' $MYSQLTEST_VARDIR/master-data/test/bug22080_1.CSV > $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV +--exec sed -e 's/2","/2",/' $MYSQLTEST_VARDIR/master-data/test/bug22080_1.CSV > $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV + +--exec cat $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV +check table bug22080_2; + +--exec cat $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV +check table bug22080_3; + +drop tables bug22080_1,bug22080_2,bug22080_3; diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 461897e19b2..a34e8c152cf 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -3791,7 +3791,7 @@ ER_WRONG_MRG_TABLE cze "V-B¹echny tabulky v MERGE tabulce nejsou definovány stejnì" dan "Tabellerne i MERGE er ikke defineret ens" nla "Niet alle tabellen in de MERGE tabel hebben identieke gedefinities" - eng "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists" + eng "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist" est "Kõik tabelid MERGE tabeli määratluses ei ole identsed" fre "Toutes les tables de la table de type MERGE n'ont pas la même définition" ger "Nicht alle Tabellen in der MERGE-Tabelle sind gleich definiert" diff --git a/sql/sql_update.cc b/sql/sql_update.cc index bab4f464573..51ec287a6cb 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1217,6 +1217,8 @@ multi_update::initialize_tables(JOIN *join) TMP_TABLE_PARAM *tmp_param; table->mark_columns_needed_for_update(); + if (ignore) + table->file->extra(HA_EXTRA_IGNORE_DUP_KEY); if (table == main_table) // First table in join { if (safe_update_on_fly(join->join_tab)) @@ -1331,7 +1333,11 @@ multi_update::~multi_update() { TABLE_LIST *table; for (table= update_tables ; table; table= table->next_local) + { table->table->no_keyread= table->table->no_cache= 0; + if (ignore) + table->table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); + } if (tmp_tables) { diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index d7710ad3c9b..dad28a74af6 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -548,7 +548,10 @@ int ha_tina::encode_quote(byte *buf) in the code. */ if ((*field)->is_null()) - ptr= end_ptr= 0; + { + buffer.append(STRING_WITH_LEN("\"\",")); + continue; + } else { (*field)->val_str(&attribute,&attribute); @@ -649,6 +652,7 @@ int ha_tina::find_current_row(byte *buf) off_t end_offset, curr_offset= current_position; int eoln_len; my_bitmap_map *org_bitmap; + int error; DBUG_ENTER("ha_tina::find_current_row"); /* @@ -662,23 +666,23 @@ int ha_tina::find_current_row(byte *buf) /* Avoid asserts in ::store() for columns that are not going to be updated */ org_bitmap= dbug_tmp_use_all_columns(table, table->write_set); + error= HA_ERR_CRASHED_ON_USAGE; + + memset(buf, 0, table->s->null_bytes); for (Field **field=table->field ; *field ; field++) { buffer.length(0); - if (file_buff->get_value(curr_offset) == '"') + if (curr_offset < end_offset && + file_buff->get_value(curr_offset) == '"') curr_offset++; // Incrementpast the first quote else - { - dbug_tmp_restore_column_map(table->write_set, org_bitmap); - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - } - for(;curr_offset != end_offset; curr_offset++) + goto err; + for(;curr_offset < end_offset; curr_offset++) { // Need to convert line feeds! if (file_buff->get_value(curr_offset) == '"' && - (((file_buff->get_value(curr_offset + 1) == ',') && - (file_buff->get_value(curr_offset + 2) == '"')) || + ((file_buff->get_value(curr_offset + 1) == ',') || (curr_offset == end_offset -1 ))) { curr_offset+= 2; // Move past the , and the " @@ -708,10 +712,7 @@ int ha_tina::find_current_row(byte *buf) we are working with a damaged file. */ if (curr_offset == end_offset - 1) - { - dbug_tmp_restore_column_map(table->write_set, org_bitmap); - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); - } + goto err; buffer.append(file_buff->get_value(curr_offset)); } } @@ -719,11 +720,12 @@ int ha_tina::find_current_row(byte *buf) (*field)->store(buffer.ptr(), buffer.length(), system_charset_info); } next_position= end_offset + eoln_len; - /* Maybe use \N for null? */ - memset(buf, 0, table->s->null_bytes); /* We do not implement nulls! */ + error= 0; + +err: dbug_tmp_restore_column_map(table->write_set, org_bitmap); - DBUG_RETURN(0); + DBUG_RETURN(error); } /* diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index db66c9d6442..21a0e265a64 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -312,9 +312,22 @@ void ha_myisammrg::info(uint flag) if (flag & HA_STATUS_CONST) { if (table->s->key_parts && info.rec_per_key) + { +#ifdef HAVE_purify + /* + valgrind may be unhappy about it, because optimizer may access values + between file->keys and table->key_parts, that will be uninitialized. + It's safe though, because even if opimizer will decide to use a key + with such a number, it'll be an error later anyway. + */ + bzero((char*) table->key_info[0].rec_per_key, + sizeof(table->key_info[0].rec_per_key) * table->key_parts); +#endif memcpy((char*) table->key_info[0].rec_per_key, (char*) info.rec_per_key, - sizeof(table->key_info[0].rec_per_key)*table->s->key_parts); + sizeof(table->key_info[0].rec_per_key) * + min(file->keys, table->s->key_parts)); + } } } |