List:Internals« Previous MessageNext Message »
From:pem Date:November 23 2005 12:01pm
Subject:bk commit into 5.0 tree (pem:1.1992) BUG#13729
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.1992 05/11/23 11:56:53 pem@stripped +5 -0
  Fixed BUG#13729 Stored procedures: packet error after exception handled
    Don't set thd->is_fatal_error in sql_update for duplicate key errors.

  sql/sql_update.cc
    1.181 05/11/23 11:56:46 pem@stripped +12 -2
    Don't set thd->is_fatal_error if it's a duplicate key error.

  mysql-test/t/sp_trans.test
    1.6 05/11/23 11:56:46 pem@stripped +64 -0
    New test case for BUG#14840.

  mysql-test/t/sp.test
    1.165 05/11/23 11:56:45 pem@stripped +27 -0
    New test case for BUG#13729.

  mysql-test/r/sp_trans.result
    1.6 05/11/23 11:56:45 pem@stripped +56 -0
    New test case for BUG#14840.

  mysql-test/r/sp.result
    1.172 05/11/23 11:56:45 pem@stripped +18 -0
    New test case for BUG#13729.

# 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/bug13729/mysql-5.0

--- 1.180/sql/sql_update.cc	2005-11-02 13:43:23 +01:00
+++ 1.181/sql/sql_update.cc	2005-11-23 11:56:46 +01:00
@@ -465,7 +465,12 @@
 	}
  	else if (!ignore || error != HA_ERR_FOUND_DUPP_KEY)
 	{
-          thd->fatal_error();                   // Force error message
+          /*
+            If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to
+            do anything; otherwise...
+          */
+          if (error != HA_ERR_FOUND_DUPP_KEY)
+            thd->fatal_error(); /* Other handler errors are fatal */
 	  table->file->print_error(error,MYF(0));
 	  error= 1;
 	  break;
@@ -1259,7 +1264,12 @@
 	  updated--;
           if (!ignore || error != HA_ERR_FOUND_DUPP_KEY)
 	  {
-            thd->fatal_error();                 // Force error message
+            /*
+              If (ignore && error == HA_ERR_FOUND_DUPP_KEY) we don't have to
+              do anything; otherwise...
+            */
+            if (error != HA_ERR_FOUND_DUPP_KEY)
+              thd->fatal_error(); /* Other handler errors are fatal */
 	    table->file->print_error(error,MYF(0));
 	    DBUG_RETURN(1);
 	  }

--- 1.171/mysql-test/r/sp.result	2005-11-18 15:55:44 +01:00
+++ 1.172/mysql-test/r/sp.result	2005-11-23 11:56:45 +01:00
@@ -3667,4 +3667,22 @@
 a
 0
 drop procedure bug14845|
+drop procedure if exists bug13729|
+drop table if exists t3|
+create table t3 (s1 int, primary key (s1))|
+insert into t3 values (1),(2)|
+create procedure bug13729()
+begin
+declare continue handler for sqlexception select 55;
+update t3 set s1 = 1;
+end|
+call bug13729()|
+55
+55
+select * from t3|
+s1
+1
+2
+drop procedure bug13729|
+drop table t3|
 drop table t1,t2;

--- 1.164/mysql-test/t/sp.test	2005-11-18 15:55:44 +01:00
+++ 1.165/mysql-test/t/sp.test	2005-11-23 11:56:45 +01:00
@@ -4595,6 +4595,33 @@
 drop procedure bug14845|
 
 #
+# BUG#13729: Stored procedures: packet error after exception handled
+#
+--disable_warnings
+drop procedure if exists bug13729|
+drop table if exists t3|
+--enable_warnings
+
+create table t3 (s1 int, primary key (s1))|
+
+insert into t3 values (1),(2)|
+
+create procedure bug13729()
+begin
+  declare continue handler for sqlexception select 55;
+
+  update t3 set s1 = 1;
+end|
+
+call bug13729()|
+# Used to cause Packets out of order
+select * from t3|
+
+drop procedure bug13729|
+drop table t3|
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings

--- 1.5/mysql-test/r/sp_trans.result	2005-11-19 13:09:16 +01:00
+++ 1.6/mysql-test/r/sp_trans.result	2005-11-23 11:56:45 +01:00
@@ -369,3 +369,59 @@
 drop procedure bug13825_1|
 drop procedure bug13825_2|
 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.5/mysql-test/t/sp_trans.test	2005-11-19 13:09:16 +01:00
+++ 1.6/mysql-test/t/sp_trans.test	2005-11-23 11:56:46 +01:00
@@ -356,6 +356,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.1992) BUG#13729pem23 Nov