List:Internals« Previous MessageNext Message »
From:pem Date:November 16 2005 5:55pm
Subject:bk commit into 5.0 tree (pem:1.1958) BUG#14840
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem 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
  1.1958 05/11/16 17:51:42 pem@stripped +3 -0
  Fixed BUG#14840: CONTINUE handler problem
    The problem was that thd->is_fatal_error was not reset when a handler
    caught, which caused the following statement to return an error even
    though it actually succeeded, with the result that the entire procedure
    exited at that point. This hanged the client (not having seen a result
    nor an error message, so the protocol got out of sync).

  sql/sql_class.h
    1.274 05/11/16 17:51:36 pem@stripped +1 -0
    Reset is_fatal_error too, in THD::clear_error()

  mysql-test/t/sp_trans.test
    1.5 05/11/16 17:51:36 pem@stripped +64 -0
    New test case for BUG#14840.

  mysql-test/r/sp_trans.result
    1.5 05/11/16 17:51:35 pem@stripped +56 -0
    New test case for BUG#14840.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	pem
# Host:	mysql.comhem.se
# Root:	/usr/home/pem/bug14840/mysql-5.0

--- 1.273/sql/sql_class.h	2005-11-14 14:00:59 +01:00
+++ 1.274/sql/sql_class.h	2005-11-16 17:51:36 +01:00
@@ -1524,6 +1524,7 @@
     net.last_errno= 0;
     net.report_error= 0;
     query_error= 0;
+    is_fatal_error= 0;
   }
   inline bool vio_ok() const { return net.vio != 0; }
 #else

--- 1.4/mysql-test/r/sp_trans.result	2005-06-07 16:48:25 +02:00
+++ 1.5/mysql-test/r/sp_trans.result	2005-11-16 17:51:35 +01:00
@@ -174,3 +174,59 @@
 drop procedure bug10015_8|
 drop function bug10015_7|
 drop table t1, t2|
+drop table if exists t3|
+drop procedure if exists bug14840_1|
+drop procedure if exists bug14840_2|
+create table t3
+(
+x int,
+y int,
+primary key (x)
+) engine=InnoDB|
+create procedure bug14840_1()
+begin
+declare err int default 0;
+declare continue handler for sqlexception
+set err = err + 1;
+start transaction;
+update t3 set x = 1, y = 42 where x = 2;
+insert into t3 values (3, 4711);
+if err > 0 then
+rollback;
+else
+commit;
+end if;
+select * from t3;
+end|
+create procedure bug14840_2()
+begin
+declare err int default 0;
+declare continue handler for sqlexception
+begin
+set err = err + 1;
+select err as 'Ping';
+end;
+update t3 set x = 1, y = 42 where x = 2;
+update t3 set x = 1, y = 42 where x = 2;
+insert into t3 values (3, 4711);
+select * from t3;
+end|
+insert into t3 values (1, 3), (2, 5)|
+call bug14840_1()|
+x	y
+1	3
+2	5
+delete from t3|
+insert into t3 values (1, 3), (2, 5)|
+call bug14840_2()|
+Ping
+1
+Ping
+2
+x	y
+1	3
+2	5
+3	4711
+drop procedure bug14840_1|
+drop procedure bug14840_2|
+drop table t3|

--- 1.4/mysql-test/t/sp_trans.test	2005-06-07 16:48:25 +02:00
+++ 1.5/mysql-test/t/sp_trans.test	2005-11-16 17:51:36 +01:00
@@ -176,6 +176,70 @@
 
 
 #
+# BUG#14840: CONTINUE handler problem
+#
+--disable_warnings
+drop table if exists t3|
+drop procedure if exists bug14840_1|
+drop procedure if exists bug14840_2|
+--enable_warnings
+
+create table t3
+(
+  x int,
+  y int,
+  primary key (x)
+) engine=InnoDB|
+
+# This used to hang the client since the insert returned with an
+# error status (left over from the update) even though it succeeded,
+# which caused the execution to end at that point.
+create procedure bug14840_1()
+begin
+  declare err int default 0;
+  declare continue handler for sqlexception
+    set err = err + 1;
+
+  start transaction;
+  update t3 set x = 1, y = 42 where x = 2;
+  insert into t3 values (3, 4711);
+  if err > 0 then
+    rollback;
+  else
+    commit;
+  end if;
+  select * from t3;
+end|
+
+# A simpler (non-transactional) case: insert at select should be done
+create procedure bug14840_2()
+begin
+  declare err int default 0;
+  declare continue handler for sqlexception
+    begin
+      set err = err + 1;
+      select err as 'Ping';
+    end;
+
+  update t3 set x = 1, y = 42 where x = 2;
+  update t3 set x = 1, y = 42 where x = 2;
+  insert into t3 values (3, 4711);
+  select * from t3;
+end|
+
+insert into t3 values (1, 3), (2, 5)|
+call bug14840_1()|
+
+delete from t3|
+insert into t3 values (1, 3), (2, 5)|
+call bug14840_2()|
+
+drop procedure bug14840_1|
+drop procedure bug14840_2|
+drop table t3|
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings
Thread
bk commit into 5.0 tree (pem:1.1958) BUG#14840pem16 Nov