List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:August 27 2007 3:37pm
Subject:bk commit into 5.0 tree (davi:1.2503) BUG#30632
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of davi. When davi does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-08-27 10:37:12-03:00, davi@stripped +3 -0
  Bug#30632 HANDLER read failure causes hang
  
  If, after the tables are locked, one of the conditions to read from a
  HANDLER table is not met, the handler code wrongly jumps to a error path
  that won't unlock the tables.
  
  The user-visible effect is that after a error in a handler read command,
  all subsequent handler operations on the same table will hang.
  
  The fix is simply to correct the code to jump to the (same) error path that
  unlocks the tables.

  mysql-test/r/handler.result@stripped, 2007-08-27 10:37:10-03:00, davi@stripped +13 -0
    Bug#30632 test case result

  mysql-test/t/handler.test@stripped, 2007-08-27 10:37:10-03:00, davi@stripped +19 -0
    Bug#30632 test case

  sql/sql_handler.cc@stripped, 2007-08-27 10:37:10-03:00, davi@stripped +3 -3
    Always unlock the internal and external table level locks if any of the conditions
    (including errors) to read from a HANDLER table are not met.

diff -Nrup a/mysql-test/r/handler.result b/mysql-test/r/handler.result
--- a/mysql-test/r/handler.result	2007-08-15 12:13:30 -03:00
+++ b/mysql-test/r/handler.result	2007-08-27 10:37:10 -03:00
@@ -489,3 +489,16 @@ handler t1 open;
 ERROR HY000: Table storage engine for 't1' doesn't have this option
 --> client 1
 drop table t1;
+drop table if exists t1;
+create table t1 (a int);
+handler t1 open as t1_alias;
+handler t1_alias read a next;
+ERROR HY000: Key 'a' doesn't exist in table 't1_alias'
+handler t1_alias READ a next where inexistent > 0;
+ERROR 42S22: Unknown column 'inexistent' in 'field list'
+handler t1_alias read a next;
+ERROR HY000: Key 'a' doesn't exist in table 't1_alias'
+handler t1_alias READ a next where inexistent > 0;
+ERROR 42S22: Unknown column 'inexistent' in 'field list'
+handler t1_alias close;
+drop table t1;
diff -Nrup a/mysql-test/t/handler.test b/mysql-test/t/handler.test
--- a/mysql-test/t/handler.test	2007-08-15 12:13:31 -03:00
+++ b/mysql-test/t/handler.test	2007-08-27 10:37:10 -03:00
@@ -441,3 +441,22 @@ handler t1 open;
 --echo --> client 1
 connection default;
 drop table t1;
+
+#
+# Bug#30632 HANDLER read failure causes hang
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+create table t1 (a int);
+handler t1 open as t1_alias;
+--error 1176
+handler t1_alias read a next;
+--error 1054
+handler t1_alias READ a next where inexistent > 0;
+--error 1176
+handler t1_alias read a next;
+--error 1054
+handler t1_alias READ a next where inexistent > 0;
+handler t1_alias close;
+drop table t1;
diff -Nrup a/sql/sql_handler.cc b/sql/sql_handler.cc
--- a/sql/sql_handler.cc	2007-08-20 13:45:13 -03:00
+++ b/sql/sql_handler.cc	2007-08-27 10:37:10 -03:00
@@ -440,7 +440,7 @@ bool mysql_ha_read(THD *thd, TABLE_LIST 
       cond->cleanup();                          // File was reopened
     if ((!cond->fixed &&
 	 cond->fix_fields(thd, &cond)) || cond->check_cols(1))
-      goto err0;
+      goto err;
   }
 
   if (keyname)
@@ -448,13 +448,13 @@ bool mysql_ha_read(THD *thd, TABLE_LIST 
     if ((keyno=find_type(keyname, &table->s->keynames, 1+2)-1)<0)
     {
       my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), keyname, tables->alias);
-      goto err0;
+      goto err;
     }
   }
 
   if (insert_fields(thd, &thd->lex->select_lex.context,
                     tables->db, tables->alias, &it, 0))
-    goto err0;
+    goto err;
 
   protocol->send_fields(&list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
 
Thread
bk commit into 5.0 tree (davi:1.2503) BUG#30632Davi Arnaut27 Aug