diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result index 1401ae26ddb1c2a23d13ace8e7415598e27405d7..7864a5d13541c17b360a0a0b9d7d941574842ff3 100644 --- a/mysql-test/r/ndb_index_unique.result +++ b/mysql-test/r/ndb_index_unique.result @@ -626,3 +626,12 @@ select * from t1 where code = '12' and month = 4 and year = 2004 ; id month year code 1 4 2004 12 drop table t1; +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 '2' for key 1 +select a, sha1(b) from t1; +a sha1(b) +1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d +drop table t1; diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test index 2185276c2c6ee3af57f58949838718faf7d61b91..8561b3794c4bb9b78d10483638664fc1d75d2b1c 100644 --- a/mysql-test/t/ndb_index_unique.test +++ b/mysql-test/t/ndb_index_unique.test @@ -309,4 +309,18 @@ select * from t1 where code = '12' and month = 4 and year = 2004 ; drop table t1; +# bug#15918 Unique Key Limit in NDB Engine + +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)); +--error 1062 +insert into t1 values (2, repeat(_utf8 0xe288ab6474, 200)); +select a, sha1(b) from t1; + +# perl -e 'print pack("H2000","e288ab6474"x200)' | sha1sum + +drop table t1; + # End of 4.1 tests diff --git a/ndb/src/kernel/blocks/dbacc/Dbacc.hpp b/ndb/src/kernel/blocks/dbacc/Dbacc.hpp index afec0b9e3b1cebfbb8aa6278f1ff9d653b65edae..7f51a281f37765b383ebcda2f196946447587a4d 100644 --- a/ndb/src/kernel/blocks/dbacc/Dbacc.hpp +++ b/ndb/src/kernel/blocks/dbacc/Dbacc.hpp @@ -1446,7 +1446,7 @@ private: Uint32 cexcPrevforward; Uint32 clocalkey[32]; union { - Uint32 ckeys[2048]; + Uint32 ckeys[2048 * MAX_XFRM_MULTIPLY]; Uint64 ckeys_align; }; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 699b3f05a706c168c2d1a0b5298af9d96dc16cdb..e348826ac104b39734db6884ca480208a99e3439 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -5083,6 +5083,10 @@ uint ha_ndbcluster::max_supported_key_length() const { return NDB_MAX_KEY_SIZE; } +uint ha_ndbcluster::max_supported_key_part_length() const +{ + return NDB_MAX_KEY_SIZE; +} bool ha_ndbcluster::low_byte_first() const { #ifdef WORDS_BIGENDIAN diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 466d7b7044bc792ca3b74a0a3646811c7d477e2f..b01adcb315675d34fa2096ce4e84853b73adf1d4 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -510,6 +510,7 @@ class ha_ndbcluster: public handler uint max_supported_keys() const; uint max_supported_key_parts() const; uint max_supported_key_length() const; + uint max_supported_key_part_length() const; int rename_table(const char *from, const char *to); int delete_table(const char *name);