List:Commits« Previous MessageNext Message »
From:kroki Date:October 25 2006 3:53pm
Subject:bk commit into 4.1 tree (kroki:1.2554) BUG#18819
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of tomash. When tomash 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, 2006-10-25 19:53:26+04:00, kroki@stripped +3 -0
  BUG#18819: DELETE IGNORE hangs on foreign key parent delete
  
  If the error happens during DELETE IGNORE, nothing could be send to the
  client, thus leaving it frozen expecting the reply.
  
  The problem was that if some error occurred, it wouldn't be reported to
  the client because of IGNORE, but neither success would be reported.
  
  MySQL 4.1 would not freeze the client, but will report
  
    ERROR 1105 (HY000): Unknown error
  
  instead, which is also a bug.
  
  The solution is to report success if we are in DELETE IGNORE and some
  non-fatal error has happened.

  mysql-test/r/innodb_mysql.result@stripped, 2006-10-25 19:53:24+04:00, kroki@stripped +16 -0
    Add result for bug#18819: DELETE IGNORE hangs on foreign key parent
    delete.

  mysql-test/t/innodb_mysql.test@stripped, 2006-10-25 19:53:24+04:00, kroki@stripped +29 -0
    Add test case for bug#18819: DELETE IGNORE hangs on foreign key parent
    delete.

  sql/sql_delete.cc@stripped, 2006-10-25 19:53:24+04:00, kroki@stripped +2 -1
    Report success if we have got an error, but we are in DELETE IGNORE, and
    the error is not fatal (if it is, it would be reported to the client).

# 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:	kroki
# Host:	moonlight.intranet
# Root:	/home/tomash/src/mysql_ab/mysql-4.1-bug18819

--- 1.139/sql/sql_delete.cc	2006-10-25 19:53:32 +04:00
+++ 1.140/sql/sql_delete.cc	2006-10-25 19:53:32 +04:00
@@ -253,7 +253,8 @@ cleanup:
     mysql_unlock_tables(thd, thd->lock);
     thd->lock=0;
   }
-  if (error >= 0 || thd->net.report_error)
+  if ((error >= 0 || thd->net.report_error) &&
+      (!thd->lex->ignore || thd->is_fatal_error))
     send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN: 0);
   else
   {

--- 1.5/mysql-test/r/innodb_mysql.result	2006-10-25 19:53:32 +04:00
+++ 1.6/mysql-test/r/innodb_mysql.result	2006-10-25 19:53:32 +04:00
@@ -104,3 +104,19 @@ SELECT `id1` FROM `t1` WHERE `id1` NOT I
 id1
 2
 DROP TABLE t1, t2;
+DROP TABLE IF EXISTS t2, t1;
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+i INT NOT NULL,
+FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+DELETE IGNORE FROM t1 WHERE i = 1;
+Warnings:
+Error	1217	Cannot delete or update a parent row: a foreign key constraint fails
+SELECT * FROM t1, t2;
+i	i
+1	1
+DROP TABLE t2, t1;
+End of 4.1 tests.

--- 1.5/mysql-test/t/innodb_mysql.test	2006-10-25 19:53:32 +04:00
+++ 1.6/mysql-test/t/innodb_mysql.test	2006-10-25 19:53:32 +04:00
@@ -117,3 +117,32 @@ INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`
 
 SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
 DROP TABLE t1, t2;
+
+
+#
+# BUG#18819: DELETE IGNORE hangs on foreign key parent delete
+#
+# The bug itself does not relate to InnoDB, but we have to use foreign
+# keys to reproduce it.
+#
+--disable_warnings
+DROP TABLE IF EXISTS t2, t1;
+--enable_warnings
+
+CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE= InnoDB;
+CREATE TABLE t2 (
+  i INT NOT NULL,
+  FOREIGN KEY (i) REFERENCES t1 (i) ON DELETE NO ACTION
+) ENGINE= InnoDB;
+
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+DELETE IGNORE FROM t1 WHERE i = 1;
+
+SELECT * FROM t1, t2;
+
+DROP TABLE t2, t1;
+
+
+--echo End of 4.1 tests.
Thread
bk commit into 4.1 tree (kroki:1.2554) BUG#18819kroki25 Oct