#At file:///export/space/pekka/ms/ms-bug56853-63/ based on revid:magnus.blaudd@stripped
3314 Pekka Nousiainen 2010-10-20
bug#56853 a01_patch.diff
missing shrink varchar in index bound dist key check
modified:
mysql-test/suite/ndb/r/ndb_index_ordered.result
mysql-test/suite/ndb/t/ndb_index_ordered.test
storage/ndb/src/ndbapi/NdbScanOperation.cpp
=== modified file 'mysql-test/suite/ndb/r/ndb_index_ordered.result'
--- a/mysql-test/suite/ndb/r/ndb_index_ordered.result 2010-10-13 17:36:52 +0000
+++ b/mysql-test/suite/ndb/r/ndb_index_ordered.result 2010-10-20 17:39:53 +0000
@@ -884,3 +884,78 @@ select * from t1 where b < 8 or b >= 8;
a b
0 0
drop table t1;
+# bug#56853
+create table t1 (
+x varchar(16) not null,
+primary key (x)
+)
+character set latin1
+collate latin1_swedish_ci
+engine ndb
+partition by key (x) partitions 8;
+insert into t1 (x) values ('aaa');
+insert into t1 (x) values ('bbb');
+insert into t1 (x) values ('ccc');
+insert into t1 (x) values ('ddd');
+select x from t1 where x like 'aa%';
+x
+aaa
+select x from t1 where x like 'aa_';
+x
+aaa
+select x from t1 where x like 'bb%';
+x
+bbb
+select x from t1 where x like 'bb_';
+x
+bbb
+select x from t1 where x like 'cc%';
+x
+ccc
+select x from t1 where x like 'cc_';
+x
+ccc
+select x from t1 where x like 'dd%';
+x
+ddd
+select x from t1 where x like 'dd_';
+x
+ddd
+drop table t1;
+create table t1 (
+x varchar(4) not null,
+primary key (x)
+)
+character set latin1
+collate latin1_swedish_ci
+engine ndb
+partition by key (x) partitions 8;
+insert into t1 (x) values ('aaaa');
+insert into t1 (x) values ('bbbb');
+insert into t1 (x) values ('cccc');
+insert into t1 (x) values ('dddd');
+select x from t1 where x like 'aaa%';
+x
+aaaa
+select x from t1 where x like 'aaa_';
+x
+aaaa
+select x from t1 where x like 'bbb%';
+x
+bbbb
+select x from t1 where x like 'bbb_';
+x
+bbbb
+select x from t1 where x like 'ccc%';
+x
+cccc
+select x from t1 where x like 'ccc_';
+x
+cccc
+select x from t1 where x like 'ddd%';
+x
+dddd
+select x from t1 where x like 'ddd_';
+x
+dddd
+drop table t1;
=== modified file 'mysql-test/suite/ndb/t/ndb_index_ordered.test'
--- a/mysql-test/suite/ndb/t/ndb_index_ordered.test 2010-10-13 17:36:52 +0000
+++ b/mysql-test/suite/ndb/t/ndb_index_ordered.test 2010-10-20 17:39:53 +0000
@@ -512,3 +512,55 @@ create table t1 (a int not null, b int n
insert into t1(a,b) values(0,0);
select * from t1 where b < 8 or b >= 8;
drop table t1;
+
+# bug#56853 missing shrink varchar in index bound dist key check
+
+--echo # bug#56853
+
+create table t1 (
+ x varchar(16) not null,
+ primary key (x)
+)
+character set latin1
+collate latin1_swedish_ci
+engine ndb
+partition by key (x) partitions 8;
+
+# like % works here
+insert into t1 (x) values ('aaa');
+insert into t1 (x) values ('bbb');
+insert into t1 (x) values ('ccc');
+insert into t1 (x) values ('ddd');
+select x from t1 where x like 'aa%';
+select x from t1 where x like 'aa_';
+select x from t1 where x like 'bb%';
+select x from t1 where x like 'bb_';
+select x from t1 where x like 'cc%';
+select x from t1 where x like 'cc_';
+select x from t1 where x like 'dd%';
+select x from t1 where x like 'dd_';
+drop table t1;
+
+# show same bug with like %
+create table t1 (
+ x varchar(4) not null,
+ primary key (x)
+)
+character set latin1
+collate latin1_swedish_ci
+engine ndb
+partition by key (x) partitions 8;
+
+insert into t1 (x) values ('aaaa');
+insert into t1 (x) values ('bbbb');
+insert into t1 (x) values ('cccc');
+insert into t1 (x) values ('dddd');
+select x from t1 where x like 'aaa%';
+select x from t1 where x like 'aaa_';
+select x from t1 where x like 'bbb%';
+select x from t1 where x like 'bbb_';
+select x from t1 where x like 'ccc%';
+select x from t1 where x like 'ccc_';
+select x from t1 where x like 'ddd%';
+select x from t1 where x like 'ddd_';
+drop table t1;
=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2010-10-13 17:36:52 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2010-10-20 17:39:53 +0000
@@ -683,6 +683,22 @@ compare_index_row_prefix(const NdbRecord
Uint32 maxSize= col->maxSize;
const char *ptr1= row1 + offset;
const char *ptr2= row2 + offset;
+
+ /* bug#56853 */
+ char buf1[NdbRecord::Attr::SHRINK_VARCHAR_BUFFSIZE];
+ char buf2[NdbRecord::Attr::SHRINK_VARCHAR_BUFFSIZE];
+ if (col->flags & NdbRecord::IsMysqldShrinkVarchar)
+ {
+ Uint32 len1;
+ bool ok1 = col->shrink_varchar(row1, len1, buf1);
+ assert(ok1);
+ ptr1 = buf1;
+ Uint32 len2;
+ bool ok2 = col->shrink_varchar(row2, len2, buf2);
+ assert(ok2);
+ ptr2 = buf2;
+ }
+
void *info= col->charset_info;
int res=
(*col->compare_function)(info, ptr1, maxSize, ptr2, maxSize, true);
Attachment: [text/bzr-bundle] bzr/pekka@mysql.com-20101020173953-e3dnk3042f4i5vaw.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-6.3 branch (pekka:3314) Bug#56853 | Pekka Nousiainen | 20 Oct |