List:Internals« Previous MessageNext Message »
From:Martin Skold Date:June 17 2005 12:46pm
Subject:bk commit into 4.1 tree (mskold:1.2294) BUG#10936
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of marty. When marty 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.2294 05/06/17 14:45:54 mskold@stripped +3 -0
  Fix for bug#10936: Cluster engine shows wrong key value for duplicate key error

  mysql-test/t/ndb_insert.test
    1.9 05/06/17 14:45:01 mskold@stripped +9 -6
    Fix for bug#10936: Cluster engine shows wrong key value for duplicate key error

  mysql-test/r/ndb_insert.result
    1.8 05/06/17 14:45:01 mskold@stripped +9 -7
    Fix for bug#10936: Cluster engine shows wrong key value for duplicate key error

  sql/ha_ndbcluster.cc
    1.158 05/06/17 14:45:00 mskold@stripped +7 -2
    Fix for bug#10936: Cluster engine shows wrong key value for duplicate key error

# 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:	mskold
# Host:	blowfish.ndb.mysql.com
# Root:	/usr/local/home/marty/MySQL/mysql-4.1

--- 1.7/mysql-test/r/ndb_insert.result	Thu Nov 18 12:10:40 2004
+++ 1.8/mysql-test/r/ndb_insert.result	Fri Jun 17 14:45:01 2005
@@ -416,10 +416,12 @@
 SELECT COUNT(*) FROM t1;
 COUNT(*)
 2000
+INSERT INTO t1 VALUES (1,1,1);
+ERROR 23000: Duplicate entry '1' for key 1
 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: Duplicate entry '10' for key 1
+ERROR 23000: Can't write; duplicate key in table 't1'
 select count(*) from t1;
 count(*)
 2000
@@ -437,7 +439,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: Duplicate entry '10' for key 1
+ERROR 23000: Can't write; duplicate key in table 't1'
 commit;
 ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
 select * from t1 where pk1=1;
@@ -456,7 +458,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: Duplicate entry '10' for key 1
+ERROR 23000: Can't write; duplicate key in table 't1'
 rollback;
 select * from t1 where pk1=1;
 pk1	b	c
@@ -474,7 +476,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: Duplicate entry '10' for key 1
+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
 rollback;
@@ -494,7 +496,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: Duplicate entry '10' for key 1
+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
 SELECT * FROM t1 WHERE pk1=10;
@@ -517,7 +519,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: Duplicate entry '10' for key 1
+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;
@@ -534,7 +536,7 @@
 count(*)
 2000
 insert into t1 select * from t1 where b < 10 order by pk1;
-ERROR 23000: Duplicate entry '9' for key 1
+ERROR 23000: Can't write; duplicate key in table 't1'
 DELETE FROM t1 WHERE pk1=2;
 begin;
 INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);

--- 1.8/mysql-test/t/ndb_insert.test	Tue Apr 19 17:23:01 2005
+++ 1.9/mysql-test/t/ndb_insert.test	Fri Jun 17 14:45:01 2005
@@ -434,6 +434,9 @@
 # Insert duplicate rows
 # 
 --error 1062
+INSERT INTO t1 VALUES (1,1,1);
+
+--error 1022
 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);
@@ -457,7 +460,7 @@
 #
 begin;
 
---error 1062
+--error 1022
 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);
@@ -477,7 +480,7 @@
 #
 begin;
 
---error 1062
+--error 1022
 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);
@@ -496,7 +499,7 @@
 #
 begin;
 
---error 1062
+--error 1022
 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);
@@ -517,7 +520,7 @@
 #
 begin;
 
---error 1062
+--error 1022
 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);
@@ -543,7 +546,7 @@
 #
 begin;
 
---error 1062
+--error 1022
 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);
@@ -562,7 +565,7 @@
 # Insert duplicate rows using "insert .. select" 
 
 #
---error 1062
+--error 1022
 insert into t1 select * from t1 where b < 10 order by pk1;
 
 DELETE FROM t1 WHERE pk1=2;

--- 1.157/sql/ha_ndbcluster.cc	Thu Jun  9 13:28:07 2005
+++ 1.158/sql/ha_ndbcluster.cc	Fri Jun 17 14:45:00 2005
@@ -435,8 +435,13 @@
   DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d", 
 		      err.code, res));
   if (res == HA_ERR_FOUND_DUPP_KEY)
-    m_dupkey= table->primary_key;
-  
+  {
+    if (m_rows_to_insert == 1)
+      m_dupkey= table->primary_key;
+    else
+      // We are batching inserts, offending key is not available
+      m_dupkey= (uint) -1;
+  }
   DBUG_RETURN(res);
 }
 
Thread
bk commit into 4.1 tree (mskold:1.2294) BUG#10936Martin Skold17 Jun