List:Commits« Previous MessageNext Message »
From:Tomas Ulin Date:October 15 2008 2:24pm
Subject:bzr commit into mysql-5.1 branch (tomas.ulin:2694) Bug#32656
View as plain text  
#At file:///home/tomas/mysql_src/cge-6.2-global-schema-lock/

 2694 Tomas Ulin	2008-10-15
      Bug#32656 NDB: Duplicate key error aborts transaction in handler. Doesn't talk back
to SQL
modified:
  mysql-test/suite/funcs_1/t/disabled.def
  mysql-test/suite/ndb/r/ndb_insert.result
  mysql-test/suite/ndb/r/ndb_single_user.result
  mysql-test/suite/ndb/t/ndb_insert.test
  mysql-test/suite/ndb/t/ndb_single_user.test
  mysql-test/suite/ndb_team/r/ndb_autodiscover3.result
  mysql-test/suite/ndb_team/t/ndb_autodiscover3.test
  sql/ha_ndbcluster.cc
  sql/share/errmsg.txt

=== modified file 'mysql-test/suite/funcs_1/t/disabled.def'
--- a/mysql-test/suite/funcs_1/t/disabled.def	2008-06-18 17:23:55 +0000
+++ b/mysql-test/suite/funcs_1/t/disabled.def	2008-10-15 12:24:10 +0000
@@ -10,4 +10,3 @@
 #
 ##############################################################################
 
-ndb_trig_1011ext:  Bug#32656 NDB: Duplicate key error aborts transaction in handler.
Doesn't talk back to SQL
\ No newline at end of file

=== modified file 'mysql-test/suite/ndb/r/ndb_insert.result'
--- a/mysql-test/suite/ndb/r/ndb_insert.result	2008-09-19 09:14:38 +0000
+++ b/mysql-test/suite/ndb/r/ndb_insert.result	2008-10-15 12:24:10 +0000
@@ -440,8 +440,7 @@ INSERT INTO t1 VALUES 
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
 ERROR 23000: Can't write; duplicate key in table 't1'
-commit;
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
+rollback;
 select * from t1 where pk1=1;
 pk1	b	c
 1	1	1
@@ -477,8 +476,14 @@ INSERT INTO t1 VALUES 
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
 ERROR 23000: Can't write; duplicate key in table 't1'
+SHOW WARNINGS;
+Level	Code	Message
+Error	1296	Got error 630 'Tuple already existed when attempting to insert' from NDB
+Error	1022	Can't write; duplicate key in table 't1'
+Warning	1615	Storage engine NDB does not support rollback for this statement. Transaction
rolled back and must be restarted
 SELECT * FROM t1 WHERE pk1=10;
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
+pk1	b	c
+10	10	10
 rollback;
 select * from t1 where pk1=1;
 pk1	b	c
@@ -498,11 +503,12 @@ INSERT INTO t1 VALUES 
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
 ERROR 23000: Can't write; duplicate key in table 't1'
 SELECT * FROM t1 WHERE pk1=10;
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
+pk1	b	c
+10	10	10
 SELECT * FROM t1 WHERE pk1=10;
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
+pk1	b	c
+10	10	10
 commit;
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
 select * from t1 where pk1=1;
 pk1	b	c
 1	1	1
@@ -521,7 +527,6 @@ INSERT INTO t1 VALUES 
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
 ERROR 23000: Can't write; duplicate key in table 't1'
 INSERT INTO t1 values (4000, 40, 44);
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
 rollback;
 select * from t1 where pk1=1;
 pk1	b	c

=== modified file 'mysql-test/suite/ndb/r/ndb_single_user.result'
--- a/mysql-test/suite/ndb/r/ndb_single_user.result	2007-10-26 20:40:48 +0000
+++ b/mysql-test/suite/ndb/r/ndb_single_user.result	2008-10-15 12:24:10 +0000
@@ -111,8 +111,7 @@ update t1 set b=b+100 where a=3;
 COMMIT;
 update t1 set b=b+100 where a=4;
 ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode'
from NDBCLUSTER
-COMMIT;
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
+ROLLBACK;
 create table t2 (a int) engine myisam;
 alter table t2 add column (b int);
 drop table t2;

=== modified file 'mysql-test/suite/ndb/t/ndb_insert.test'
--- a/mysql-test/suite/ndb/t/ndb_insert.test	2008-09-19 09:14:38 +0000
+++ b/mysql-test/suite/ndb/t/ndb_insert.test	2008-10-15 12:24:10 +0000
@@ -465,8 +465,7 @@ INSERT INTO t1 VALUES 
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
 
---error 1296
-commit;
+rollback;
 
 select * from t1 where pk1=1;
 select * from t1 where pk1=10;
@@ -503,9 +502,13 @@ begin;
 INSERT INTO t1 VALUES 
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
---error 1296
+# check that we get a warning that transaction has rolled back
+SHOW WARNINGS;
+
+# transaction has rolled back, no error
 SELECT * FROM t1 WHERE pk1=10;
 
+# transaction has rolled back, no error
 rollback;
 
 select * from t1 where pk1=1;
@@ -525,13 +528,13 @@ INSERT INTO t1 VALUES 
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
 
---error 1296
+# transaction has rolled back, no error
 SELECT * FROM t1 WHERE pk1=10;
 
---error 1296
+# transaction has rolled back, no error
 SELECT * FROM t1 WHERE pk1=10;
 
---error 1296
+# transaction has rolled back, no error
 commit;
 
 select * from t1 where pk1=1;
@@ -551,9 +554,10 @@ INSERT INTO t1 VALUES 
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10);
 
---error 1296
+# transaction has rolled back, no error
 INSERT INTO t1 values (4000, 40, 44);
 
+# transaction has rolled back, no error
 rollback;
 
 select * from t1 where pk1=1;

=== modified file 'mysql-test/suite/ndb/t/ndb_single_user.test'
--- a/mysql-test/suite/ndb/t/ndb_single_user.test	2007-07-14 17:35:43 +0000
+++ b/mysql-test/suite/ndb/t/ndb_single_user.test	2008-10-15 12:24:10 +0000
@@ -150,8 +150,7 @@ COMMIT;
 --connection server2
 --error 1296
 update t1 set b=b+100 where a=4;
---error 1296
-COMMIT;
+ROLLBACK;
 
 # Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb
 # tables for other mysqld nodes

=== modified file 'mysql-test/suite/ndb_team/r/ndb_autodiscover3.result'
--- a/mysql-test/suite/ndb_team/r/ndb_autodiscover3.result	2007-09-05 17:13:36 +0000
+++ b/mysql-test/suite/ndb_team/r/ndb_autodiscover3.result	2008-10-15 12:24:10 +0000
@@ -4,8 +4,7 @@ begin;
 insert into t1 values (1);
 insert into t1 values (2);
 ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from
NDBCLUSTER
-commit;
-ERROR HY000: Got error 4350 'Transaction already aborted' from NDBCLUSTER
+rollback;
 drop table t1;
 create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
 insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);

=== modified file 'mysql-test/suite/ndb_team/t/ndb_autodiscover3.test'
--- a/mysql-test/suite/ndb_team/t/ndb_autodiscover3.test	2008-03-14 08:04:34 +0000
+++ b/mysql-test/suite/ndb_team/t/ndb_autodiscover3.test	2008-10-15 12:24:10 +0000
@@ -39,8 +39,7 @@ insert into t1 values (1);
 --connection server1
 --error 1297
 insert into t1 values (2);
---error 1296
-commit;
+rollback;
 
 drop table t1;
 

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2008-10-06 11:01:04 +0000
+++ b/sql/ha_ndbcluster.cc	2008-10-15 12:24:10 +0000
@@ -4853,14 +4853,27 @@ static int ndbcluster_rollback(handlerto
   DBUG_ENTER("ndbcluster_rollback");
   DBUG_ASSERT(ndb);
   thd_ndb->start_stmt_count= 0;
-  if (trans == NULL || (!all &&
-      thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
+  if (trans == NULL)
   {
     /* Ignore end-of-statement until real rollback or commit is called */
+    DBUG_PRINT("info", ("trans == NULL"));
+    DBUG_RETURN(0);
+  }
+  if (!all && thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
+  {
+    /*
+      Ignore end-of-statement until real rollback or commit is called
+      as ndb does not support rollback statement
+      - mark that rollback was unsuccessful, this will cause full rollback
+      of the transaction
+    */
     DBUG_PRINT("info", ("Rollback before start or end-of-statement only"));
+    mark_transaction_to_rollback(thd, 1);
+    push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+                        ER_WARN_ENGINE_TRANSACTION_ROLLBACK,
+                        ER(ER_WARN_ENGINE_TRANSACTION_ROLLBACK), "NDB");
     DBUG_RETURN(0);
   }
-
   if (trans->execute(NdbTransaction::Rollback) != 0)
   {
     const NdbError err= trans->getNdbError();

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-08-06 14:20:41 +0000
+++ b/sql/share/errmsg.txt	2008-10-15 12:24:10 +0000
@@ -6133,3 +6133,6 @@ ER_NEED_REPREPARE
 
 ER_DELAYED_NOT_SUPPORTED  
   eng "DELAYED option not supported for table '%-.192s'"
+
+ER_WARN_ENGINE_TRANSACTION_ROLLBACK
+  eng "Storage engine %s does not support rollback for this statement. Transaction rolled
back and must be restarted"

Thread
bzr commit into mysql-5.1 branch (tomas.ulin:2694) Bug#32656Tomas Ulin15 Oct