From dac9e51811a6c4cee0a4ab127f4d264d80a07962 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 2 Feb 2010 15:08:49 +0400 Subject: BUG#50351 - ft_min_word_len=2 Causes query to hang Performing fulltext prefix search (a word with truncation operator) may cause a dead-loop. ft_min_word_len value doesn't matter actually. The problem was introduced along with "smarter index merge" optimization. mysql-test/r/fulltext.result: A test case for BUG#50351. mysql-test/t/fulltext.test: A test case for BUG#50351. storage/myisam/ft_boolean_search.c: When going up to first-level tree, we need to restore docid[0], so it informs fulltext index merge not to enter this second-level tree again (avoiding dead-loop). --- storage/myisam/ft_boolean_search.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'storage') diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 492261c5efc..52ad6b11aa1 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -437,8 +437,18 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) return 0; } - /* going up to the first-level tree to continue search there */ + /* + Going up to the first-level tree to continue search there. + Only done when performing prefix search. + + Key buffer data pointer as well as docid[0] may be smaller + than values we got while searching first-level tree. Thus + they must be restored to original values to avoid dead-loop, + when subsequent search for a bigger value eventually ends up + in this same second-level tree. + */ _mi_dpointer(info, (uchar*) (lastkey_buf+HA_FT_WLEN), ftbw->key_root); + ftbw->docid[0]= ftbw->key_root; ftbw->key_root=info->s->state.key_root[ftb->keynr]; ftbw->keyinfo=info->s->keyinfo+ftb->keynr; ftbw->off=0; -- cgit v1.2.1 From 62933c50df1dd97940f4b46c1376ba80e6a8368c Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 12 Feb 2010 16:30:04 +0400 Subject: BUG#49628 - corrupt table after legal SQL, LONGTEXT column Bulk REPLACE or bulk INSERT ... ON DUPLICATE KEY UPDATE may break dynamic record MyISAM table. The problem is limited to bulk REPLACE and INSERT ... ON DUPLICATE KEY UPDATE, because only these operations may be done via UPDATE internally and may request write cache. When flushing write cache, MyISAM may write remaining cached data at wrong position. Fixed by requesting write cache to seek to a correct position. mysql-test/r/myisam.result: A test case for BUG#49628. mysql-test/t/myisam.test: A test case for BUG#49628. storage/myisam/mi_dynrec.c: delete_dynamic_record() may change data file position. IO cache must be notified as it may still have cached data, which has to be flushed later. --- storage/myisam/mi_dynrec.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'storage') diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 696b9ff93df..6518d874f4f 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -933,8 +933,16 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record, } if (block_info.next_filepos != HA_OFFSET_ERROR) + { + /* + delete_dynamic_record() may change data file position. + IO cache must be notified as it may still have cached + data, which has to be flushed later. + */ + info->rec_cache.seek_not_done= 1; if (delete_dynamic_record(info,block_info.next_filepos,1)) goto err; + } DBUG_RETURN(0); err: DBUG_RETURN(1); -- cgit v1.2.1 From 91f0212c68662f57d922e61ce3f5a5defd697949 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 12 Feb 2010 16:33:03 +0400 Subject: BUG#48757 - missing .ARZ file causes server crash Server crashes when accessing ARCHIVE table with missing .ARZ file. When opening a table, ARCHIVE didn't properly pass through error code from lower level azopen() to higher level open() method. mysql-test/r/archive.result: A test case for BUG#48757. mysql-test/t/archive.test: A test case for BUG#48757. storage/archive/ha_archive.cc: Pass through error code from azopen(). --- storage/archive/ha_archive.cc | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'storage') diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 42ff9daa77e..364ffba0f6c 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -355,6 +355,9 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) */ if (!(azopen(&archive_tmp, share->data_file_name, O_RDONLY|O_BINARY))) { + *rc= my_errno ? my_errno : -1; + pthread_mutex_unlock(&archive_mutex); + my_free(share, MYF(0)); DBUG_RETURN(NULL); } stats.auto_increment_value= archive_tmp.auto_increment + 1; @@ -504,16 +507,18 @@ int ha_archive::open(const char *name, int mode, uint open_options) For now we have to refuse to open such table to avoid potential data loss. */ - if ((rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR)) - || rc == HA_ERR_TABLE_NEEDS_UPGRADE) + switch (rc) { - /* purecov: begin inspected */ + case 0: + break; + case HA_ERR_CRASHED_ON_USAGE: + if (open_options & HA_OPEN_FOR_REPAIR) + break; + /* fall through */ + case HA_ERR_TABLE_NEEDS_UPGRADE: free_share(); - DBUG_RETURN(rc); - /* purecov: end */ - } - else if (rc == HA_ERR_OUT_OF_MEM) - { + /* fall through */ + default: DBUG_RETURN(rc); } -- cgit v1.2.1 From 792fc9f7844575675206f873a0fa1d6e7fb8ad4f Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 12 Feb 2010 18:28:35 +0200 Subject: Bug #35250: readline check breaks when doing vpath build Fixed several (obvious) places that don't work with vpath build. --- storage/ndb/src/common/util/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'storage') diff --git a/storage/ndb/src/common/util/Makefile.am b/storage/ndb/src/common/util/Makefile.am index 5379a425c49..5cf02fed12f 100644 --- a/storage/ndb/src/common/util/Makefile.am +++ b/storage/ndb/src/common/util/Makefile.am @@ -37,7 +37,7 @@ testBitmask_LDFLAGS = @ndb_bin_am_ldflags@ \ testBitmask.cpp : Bitmask.cpp rm -f testBitmask.cpp - @LN_CP_F@ Bitmask.cpp testBitmask.cpp + @LN_CP_F@ $(srcdir)/Bitmask.cpp testBitmask.cpp testBitmask.o: $(testBitmask_SOURCES) $(CXXCOMPILE) -c $(INCLUDES) -D__TEST_BITMASK__ $< -- cgit v1.2.1 From 4b260b668d66cfd6f7e8c2612461c66d2914219d Mon Sep 17 00:00:00 2001 From: Sergey Glukhov Date: Wed, 17 Feb 2010 16:13:42 +0400 Subject: Bug#33717 INSERT...(default) fails for enum. Crashes CSV tables, loads spaces for MyISAM Table corruption happens during table reading in ha_tina::find_current_row() func. Field::store() method returns error(true) if stored value is 0. The fix: added special case for enum type which correctly processes 0 value. Additional fix: INSERT...(default) and INSERT...() have the same behaviour now for enum type. mysql-test/r/csv.result: test result mysql-test/r/default.result: result fix mysql-test/t/csv.test: test case sql/item.cc: Changes: do not print warning for 'enum' type if there is no default value. set default value. storage/csv/ha_tina.cc: Table corruption happens during table reading in ha_tina::find_current_row() func. Field::store() method returns error(true) if stored value is 0. The fix: added special case for enum type which correctly processes 0 value. --- storage/csv/ha_tina.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'storage') diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index ca9d5215310..e3bc7f55dd2 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -679,9 +679,21 @@ int ha_tina::find_current_row(uchar *buf) if (read_all || bitmap_is_set(table->read_set, (*field)->field_index)) { + bool is_enum= ((*field)->real_type() == MYSQL_TYPE_ENUM); + /* + Here CHECK_FIELD_WARN checks that all values in the csv file are valid + which is normally the case, if they were written by + INSERT -> ha_tina::write_row. '0' values on ENUM fields are considered + invalid by Field_enum::store() but it can store them on INSERT anyway. + Thus, for enums we silence the warning, as it doesn't really mean + an invalid value. + */ if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(), - CHECK_FIELD_WARN)) - goto err; + is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN)) + { + if (!is_enum) + goto err; + } if ((*field)->flags & BLOB_FLAG) { Field_blob *blob= *(Field_blob**) field; -- cgit v1.2.1 From 69904fa6584b383368c94b1531e1a1a8a57f43b5 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 26 Feb 2010 10:28:44 +0400 Subject: After-fix for WL#2649 Number-to-string conversion. This change fixes test failure for partition_repair_myisam and partition_recover_myisam. The problem was that: - the file std_data/corrupt_crash.MYI contains charsetnr=63 (binary) for index segments. - the new .frm file contains charsetnr=8 (latin1) for the same segments. As a result REPAIR refused to repair frm+MYI files with different segment definition. This fix restores the old behavior for frm and MYI files: they now store charsetnr=63 for numeric/datetime data types. --- storage/heap/ha_heap.cc | 2 +- storage/myisam/ha_myisam.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'storage') diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 8d07d21c6ae..4d01b9fd1c9 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -689,7 +689,7 @@ int ha_heap::create(const char *name, TABLE *table_arg, if (field->flags & (ENUM_FLAG | SET_FLAG)) seg->charset= &my_charset_bin; else - seg->charset= field->charset(); + seg->charset= field->charset_for_protocol(); if (field->null_ptr) { seg->null_bit= field->null_bit; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 1117e8fff15..8a32e7255c0 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -274,7 +274,7 @@ int table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out, keydef[i].seg[j].bit_start= keydef[i].seg[j].bit_end= keydef[i].seg[j].bit_length= 0; keydef[i].seg[j].bit_pos= 0; - keydef[i].seg[j].language= field->charset()->number; + keydef[i].seg[j].language= field->charset_for_protocol()->number; if (field->null_ptr) { -- cgit v1.2.1