Bug #2141 | Got error -1 when reading table | ||
---|---|---|---|
Submitted: | 17 Dec 2003 5:52 | Modified: | 17 Jan 2004 5:54 |
Reporter: | Nicolas Rodionov | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: MyISAM storage engine | Severity: | S1 (Critical) |
Version: | 4.1.0, 4.1.1 | OS: | FreeBSD (FreeBSD 4.8) |
Assigned to: | Oleksandr Byelkin | CPU Architecture: | Any |
[17 Dec 2003 5:52]
Nicolas Rodionov
[17 Dec 2003 7:29]
Dean Ellis
I could not repeat this with my own small set of data, so I am wondering if you can create a small, specific test case, or compress these tables (or mysqldump of same) and upload them so we can test against something specific which is known to demonstrate this issue for you. If so, you can ftp it to ftp://support.mysql.com/pub/mysql/secret and give it a name that mentions bug2141 (and let us know the file name), if it is too large to attach here. Thank you
[18 Dec 2003 4:12]
Nicolas Rodionov
Unfortunately, I can upload database dump: 200 Binary it is, then. ftp> put bug2141.gz local: bug2141.gz remote: bug2141.gz 227 Entering Passive Mode (213,115,162,35,166,209) 553 Could not create file. But it is now available at: http://www.survival.spb.ru/bug2141/bug2141.gz (live database dump) Also there's available perl script that sometimes give this failure: http://www.survival.spb.ru/bug2141/bug2141 Here's what script shows: # ./bug2141 OK 0 OK 1 OK 2 OK 3 OK 4 DBD::mysql::st execute failed: Got error -1 from storage engine at ./bug2141 lin e 15. DBD::mysql::st fetchrow_array failed: fetch() without execute() at ./bug2141 lin e 16. OK 5 You may want to run many instances of this script in parallel to makó database loaded enough and it should be fine to change search parameters.
[18 Dec 2003 7:59]
Dean Ellis
Verified against 4.1.2 using supplied data and perl script. Error only reported after executing the script 3-4 times concurrently. mysqld also reported it in the error log: 031218 9:56:09 Got error -1 when reading table './bt/base'
[5 Jan 2004 10:47]
Victor Vagin
Thank you very much for catching such a complex bug..
[5 Jan 2004 10:54]
Nicolas Rodionov
You're welcome. And thank you for good program and great support.
[6 Jan 2004 1:54]
Victor Vagin
For final tuning and testing written bug fix, bug was passed on to mysql 'subselect guru' --- 1.175/sql/item_func.cc Sun Dec 21 13:39:30 2003 +++ 1.176/sql/item_func.cc Mon Jan 5 22:38:03 2004 @@ -2701,6 +2701,17 @@ DBUG_VOID_RETURN; } +void Item_func_match::close_search() +{ + if (!master && ft_handler) + { + ft_handler->please->close_search(ft_handler); + ft_handler=0; + if (join_key) + table->file->ft_handler=0; + table->fulltext_searched=0; + } +} bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref) { --- 1.97/sql/item_func.h Fri Dec 19 10:25:45 2003 +++ 1.98/sql/item_func.h Mon Jan 5 22:38:03 2004 @@ -999,14 +999,7 @@ join_key(0), ft_handler(0), table(0), master(0), concat(0) { } ~Item_func_match() { - if (!master && ft_handler) - { - ft_handler->please->close_search(ft_handler); - ft_handler=0; - if (join_key) - table->file->ft_handler=0; - table->fulltext_searched=0; - } + close_search(); if (concat) delete concat; } @@ -1022,6 +1015,7 @@ bool fix_index(); void init_search(bool no_order); + void close_search(); }; --- 1.246/sql/mysql_priv.h Fri Dec 19 19:27:28 2003 +++ 1.247/sql/mysql_priv.h Mon Jan 5 22:38:03 2004 @@ -673,6 +673,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); int setup_ftfuncs(SELECT_LEX* select); int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); +void close_ftfuncs(THD *thd, SELECT_LEX *select_lex); void wait_for_refresh(THD *thd); int open_tables(THD *thd,TABLE_LIST *tables); int open_and_lock_tables(THD *thd,TABLE_LIST *tables); --- 1.171/sql/sql_base.cc Fri Dec 19 13:52:09 2003 +++ 1.172/sql/sql_base.cc Mon Jan 5 22:38:03 2004 @@ -2543,3 +2543,15 @@ } return 0; } + +void close_ftfuncs(THD *thd, SELECT_LEX *select_lex) +{ + if (select_lex->ftfunc_list->elements) + { + List_iterator<Item_func_match> li(*(select_lex->ftfunc_list)); + Item_func_match *ifm; + + while ((ifm=li++)) + ifm->close_search(); + } +} --- 1.60/sql/sql_derived.cc Fri Nov 28 07:31:36 2003 +++ 1.61/sql/sql_derived.cc Mon Jan 5 22:38:03 2004 @@ -215,6 +215,12 @@ } exit: + for (SELECT_LEX *sl= unit->first_select(); + sl; + sl= sl->next_select_in_list()) + { + close_ftfuncs(thd,sl); + } delete derived_result; lex->current_select= save_current_select; close_thread_tables(thd, 0, 1);
[6 Jan 2004 3:15]
Oleksandr Byelkin
1.1676 04/01/06 13:13:04 bell@sanja.is.com.ua +1 -0 As far as we cut off derived table branch, we have to close JOINs (BUG#2141) (test case is absend because it is multi-thread and very big)
[17 Jan 2004 5:54]
Oleksandr Byelkin
thank you for bugreport. This bug is fixed in our source repositoey now.