From 154ffb3ff5e5b4bf5b15af261ac858ac59adf1f3 Mon Sep 17 00:00:00 2001 From: unknown <mskold/marty@mysql.com/quadfish.(none)> Date: Fri, 7 Dec 2007 11:05:19 +0100 Subject: [PATCH] bug#21072 Duplicate key error in NDB references wrong key: Post-merge fixes --- mysql-test/suite/ndb/r/ndb_charset.result | 8 ++++---- mysql-test/suite/ndb/r/ndb_index_unique.result | 14 +++++++------- mysql-test/suite/ndb/r/ndb_update.result | 6 +++--- sql/ha_ndbcluster.cc | 1 - storage/ndb/include/ndbapi/NdbDictionary.hpp | 5 ----- storage/ndb/src/ndbapi/NdbDictionary.cpp | 9 --------- storage/ndb/src/ndbapi/NdbOperationExec.cpp | 2 +- 7 files changed, 15 insertions(+), 30 deletions(-) diff --git a/mysql-test/suite/ndb/r/ndb_charset.result b/mysql-test/suite/ndb/r/ndb_charset.result index 1c65a38003..e84c906dd7 100644 --- a/mysql-test/suite/ndb/r/ndb_charset.result +++ b/mysql-test/suite/ndb/r/ndb_charset.result @@ -112,9 +112,9 @@ unique key(a) ) engine=ndb; insert into t1 values(1, 'aAa'); insert into t1 values(2, 'aaa'); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry 'aaa' for key 'a' insert into t1 values(3, 'AAA'); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry 'AAA' for key 'a' select * from t1 order by p; p a 1 aAa @@ -138,9 +138,9 @@ unique key(a) ) engine=ndb; insert into t1 values (1,'A'),(2,'b '),(3,'C '),(4,'d '),(5,'E'),(6,'f'); insert into t1 values(99,'b'); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry 'b' for key 'a' insert into t1 values(99,'a '); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry 'a ' for key 'a' select a,length(a) from t1 order by a; a length(a) A 1 diff --git a/mysql-test/suite/ndb/r/ndb_index_unique.result b/mysql-test/suite/ndb/r/ndb_index_unique.result index cc63ce6976..bfc0c5a2e5 100644 --- a/mysql-test/suite/ndb/r/ndb_index_unique.result +++ b/mysql-test/suite/ndb/r/ndb_index_unique.result @@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a; a b c 3 4 6 insert into t1 values(8, 2, 3); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '2' for key 'ib' select * from t1 order by a; a b c 1 2 3 @@ -93,7 +93,7 @@ a b c 1 1 1 4 4 NULL insert into t1 values(5,1,1); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '1-1' for key 'bc' drop table t1; CREATE TABLE t2 ( a int unsigned NOT NULL PRIMARY KEY, @@ -116,7 +116,7 @@ select * from t2 where b = 4 order by a; a b c 3 4 6 insert into t2 values(8, 2, 3); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '2-3' for key 'b' select * from t2 order by a; a b c 1 2 3 @@ -139,7 +139,7 @@ a b c 8 2 3 create unique index bi using hash on t2(b); insert into t2 values(9, 3, 1); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '3' for key 'bi' alter table t2 drop index bi; insert into t2 values(9, 3, 1); select * from t2 order by a; @@ -229,7 +229,7 @@ pk a 3 NULL 4 4 insert into t1 values (5,0); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '0' for key 'a' select * from t1 order by pk; pk a -1 NULL @@ -262,7 +262,7 @@ pk a b c 0 NULL 18 NULL 1 3 19 abc insert into t2 values(2,3,19,'abc'); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '3-abc' for key 'si' select * from t2 order by pk; pk a b c -1 1 17 NULL @@ -682,7 +682,7 @@ create table t1 (a int primary key, b varchar(1000) not null, unique key (b)) engine=ndb charset=utf8; insert into t1 values (1, repeat(_utf8 0xe288ab6474, 200)); insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200)); -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫dt∫d' for key 'b' select a, sha1(b) from t1; a sha1(b) 1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d diff --git a/mysql-test/suite/ndb/r/ndb_update.result b/mysql-test/suite/ndb/r/ndb_update.result index ed51daee5c..fa08358795 100644 --- a/mysql-test/suite/ndb/r/ndb_update.result +++ b/mysql-test/suite/ndb/r/ndb_update.result @@ -28,7 +28,7 @@ pk1 b c 2 2 2 4 1 1 UPDATE t1 set pk1 = 1, c = 2 where pk1 = 4; -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '2' for key 'c' UPDATE IGNORE t1 set pk1 = 1, c = 2 where pk1 = 4; select * from t1 order by pk1; pk1 b c @@ -62,9 +62,9 @@ INSERT INTO t3 VALUES (2, 2); UPDATE t1 SET a = 1; UPDATE t1 SET a = 1 ORDER BY a; UPDATE t2 SET a = 1; -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '1-2' for key 'a' UPDATE t2 SET a = 1 ORDER BY a; -ERROR 23000: Duplicate entry '' for key '*UNKNOWN*' +ERROR 23000: Duplicate entry '1-2' for key 'a' UPDATE t3 SET a = 1; ERROR 23000: Duplicate entry '1-2' for key 'PRIMARY' UPDATE t3 SET a = 1 ORDER BY a; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 55c45f6c68..a90f854f88 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -599,7 +599,6 @@ int ha_ndbcluster::ndb_err(NdbTransaction *trans) const NDBINDEX *unique_index= (const NDBINDEX *) m_index[i].unique_index; if (unique_index && - unique_index->getIndexTable() && (uint) unique_index->getObjectId() == error_data) { dupkey= i; diff --git a/storage/ndb/include/ndbapi/NdbDictionary.hpp b/storage/ndb/include/ndbapi/NdbDictionary.hpp index 12d5a1a737..0e782ba921 100644 --- a/storage/ndb/include/ndbapi/NdbDictionary.hpp +++ b/storage/ndb/include/ndbapi/NdbDictionary.hpp @@ -1021,11 +1021,6 @@ public: */ const char * getTable() const; - /** - * Get the table representing the index - */ - const Table * getIndexTable() const; - /** * Get the number of columns in the index */ diff --git a/storage/ndb/src/ndbapi/NdbDictionary.cpp b/storage/ndb/src/ndbapi/NdbDictionary.cpp index 2548b96c58..a4395fc4b9 100644 --- a/storage/ndb/src/ndbapi/NdbDictionary.cpp +++ b/storage/ndb/src/ndbapi/NdbDictionary.cpp @@ -792,15 +792,6 @@ NdbDictionary::Index::getTable() const { return m_impl.getTable(); } -const NdbDictionary::Table * -NdbDictionary::Index::getIndexTable() const { - NdbTableImpl * t = m_impl.m_table; - if (t) { - return t->m_facade; - } - return 0; -} - unsigned NdbDictionary::Index::getNoOfColumns() const { return m_impl.m_columns.size(); diff --git a/storage/ndb/src/ndbapi/NdbOperationExec.cpp b/storage/ndb/src/ndbapi/NdbOperationExec.cpp index aa2586357f..cd1ac44d82 100644 --- a/storage/ndb/src/ndbapi/NdbOperationExec.cpp +++ b/storage/ndb/src/ndbapi/NdbOperationExec.cpp @@ -549,7 +549,7 @@ NdbOperation::receiveTCKEYREF( NdbApiSignal* aSignal) if (aSignal->getLength() == TcKeyRef::SignalLength) { // Signal may contain additional error data - setErrorDetails((char *) aSignal->readData(5)); + theError.details = (char *) aSignal->readData(5); } theStatus = Finished; -- 2.30.9