MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Tomas Ulin Date:September 29 2008 4:21pm
Subject:bzr commit into mysql-5.1 branch (tomas.ulin:2689) Bug#39538
View as plain text  
#At file:///home/tomas/mysql_src/mysql-5.1-telco-6.3/

 2689 Tomas Ulin	2008-09-29
      Bug #39538 Constraint violation in multi-row insert does not abort transaction
modified:
  mysql-test/suite/ndb/r/ndb_insert.result
  sql/ha_ndbcluster.cc

=== modified file 'mysql-test/suite/ndb/r/ndb_insert.result'
--- a/mysql-test/suite/ndb/r/ndb_insert.result	2008-09-19 10:56:53 +0000
+++ b/mysql-test/suite/ndb/r/ndb_insert.result	2008-09-29 16:21:47 +0000
@@ -429,7 +429,7 @@ ERROR 23000: Duplicate entry '1' for key
 INSERT INTO t1 VALUES 
 (-1,-1,-1),(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),(9999,9999,9999);
-ERROR 23000: Can't write; duplicate key in table 't1'
+ERROR 23000: Can't write; duplicate key in table ''
 select count(*) from t1;
 count(*)
 2000

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2008-09-24 14:44:11 +0000
+++ b/sql/ha_ndbcluster.cc	2008-09-29 16:21:47 +0000
@@ -536,12 +536,20 @@ int execute_commit(Thd_ndb *thd_ndb, Ndb
                    int force_send, int ignore_error, uint *ignore_count)
 {
   DBUG_ENTER("execute_commit");
+  NdbOperation::AbortOption ao= NdbOperation::AO_IgnoreError;
+  if (thd_ndb->m_unsent_bytes && !ignore_error)
+  {
+    /*
+      We have unsent bytes and cannot ignore error.  Calling execute
+      with NdbOperation::AO_IgnoreError will result in possible commit
+      of a transaction although there is an error.
+    */
+    ao= NdbOperation::AbortOnError;
+  }
   const NdbOperation *first= trans->getFirstDefinedOperation();
   thd_ndb->m_execute_count++;
   DBUG_PRINT("info", ("execute_count: %u", thd_ndb->m_execute_count));
-  if (trans->execute(NdbTransaction::Commit,
-                     NdbOperation::AO_IgnoreError,
-                     force_send))
+  if (trans->execute(NdbTransaction::Commit, ao, force_send))
   {
     thd_ndb->m_max_violation_count= 0;
     thd_ndb->m_old_violation_count= 0;

Thread
bzr commit into mysql-5.1 branch (tomas.ulin:2689) Bug#39538Tomas Ulin29 Sep