#At file:///home/jonas/src/70-spj-svs/ based on revid:ole.john.aske@stripped
3341 jonas oreland 2010-11-06
ndb - spj svs - when computing xfrm:ed key in scanIndex, it used incorrect lenght for final md5 calculation
modified:
mysql-test/suite/ndb/r/ndb_join_pushdown.result
mysql-test/suite/ndb/t/ndb_join_pushdown.test
storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp
=== modified file 'mysql-test/suite/ndb/r/ndb_join_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2010-11-01 12:32:15 +0000
+++ b/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2010-11-06 09:24:09 +0000
@@ -4085,6 +4085,23 @@ id select_type table type possible_keys
1 SIMPLE x1 ALL uk1 NULL NULL NULL 3 Parent of 2 pushed join@1
1 SIMPLE x2 eq_ref PRIMARY PRIMARY 12 test.x1.b 1 Child of pushed join@1
drop table tc;
+create table t1 (
+a varchar(16) not null,
+b int not null,
+c varchar(16) not null,
+d int not null,
+primary key (a,b)
+) engine ndb partition by key (a);
+insert into t1 values ('aaa', 1, 'aaa', 1);
+explain
+select * from t1 as q1, t1 as q2 where q1.a = 'aaa' and q1.c=q2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE q1 ref PRIMARY PRIMARY 18 const 10 Parent of 2 pushed join@1; Using where with pushed condition
+1 SIMPLE q2 ref PRIMARY PRIMARY 18 test.q1.c 1 Child of pushed join@1
+select * from t1 as q1, t1 as q2 where q1.a = 'aaa' and q1.c=q2.a;
+a b c d a b c d
+aaa 1 aaa 1 aaa 1 aaa 1
+drop table t1;
create temporary table spj_counts_at_end
select counter_name, sum(val) AS val
from ndbinfo.counters
@@ -4101,11 +4118,11 @@ and spj_counts_at_end.counter_name <> 'L
counter_name spj_counts_at_end.val - spj_counts_at_startup.val
CONST_PRUNED_RANGE_SCANS_RECEIVED 6
LOCAL_TABLE_SCANS_SENT 196
-PRUNED_RANGE_SCANS_RECEIVED 16
-RANGE_SCANS_RECEIVED 209
+PRUNED_RANGE_SCANS_RECEIVED 17
+RANGE_SCANS_RECEIVED 210
READS_NOT_FOUND 405
READS_RECEIVED 61
-SCAN_ROWS_RETURNED 63867
+SCAN_ROWS_RETURNED 63869
TABLE_SCANS_RECEIVED 196
select sum(spj_counts_at_end.val - spj_counts_at_startup.val) as 'LOCAL+REMOTE READS_SENT'
from spj_counts_at_end, spj_counts_at_startup
@@ -4117,15 +4134,15 @@ LOCAL+REMOTE READS_SENT
drop table spj_counts_at_startup;
drop table spj_counts_at_end;
scan_count
-2010
+2013
pruned_scan_count
-7
+8
sorted_scan_count
7
pushed_queries_defined
-346
+348
pushed_queries_dropped
11
pushed_queries_executed
-267
+268
set ndb_join_pushdown = @save_ndb_join_pushdown;
=== modified file 'mysql-test/suite/ndb/t/ndb_join_pushdown.test'
--- a/mysql-test/suite/ndb/t/ndb_join_pushdown.test 2010-11-01 12:32:15 +0000
+++ b/mysql-test/suite/ndb/t/ndb_join_pushdown.test 2010-11-06 09:24:09 +0000
@@ -2915,6 +2915,23 @@ explain select * from tc as x1, tc as x2
drop table tc;
+###
+# prune with xfrm set incorrect keylen
+#
+create table t1 (
+ a varchar(16) not null,
+ b int not null,
+ c varchar(16) not null,
+ d int not null,
+ primary key (a,b)
+) engine ndb partition by key (a);
+
+insert into t1 values ('aaa', 1, 'aaa', 1);
+explain
+select * from t1 as q1, t1 as q2 where q1.a = 'aaa' and q1.c=q2.a;
+select * from t1 as q1, t1 as q2 where q1.a = 'aaa' and q1.c=q2.a;
+drop table t1;
+
########################################
# Verify DBSPJ counters for entire test:
=== modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2010-10-17 19:39:13 +0000
+++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2010-11-06 09:24:09 +0000
@@ -3516,6 +3516,7 @@ Dbspj::computePartitionHash(Signal* sign
Uint64 _space[MAX_KEY_SIZE_IN_LONG_WORDS];
Uint64 *tmp64 = _space;
Uint32 *tmp32 = (Uint32*)tmp64;
+ Uint32 sz = ptr.sz;
copy(tmp32, ptr);
const KeyDescriptor* desc = g_key_descriptor_pool.getPtr(tableId);
@@ -3543,9 +3544,10 @@ Dbspj::computePartitionHash(Signal* sign
}
}
tmp64 = (Uint64*)dst;
+ sz = dstPos;
}
- md5_hash(dst.hashInfo, tmp64, ptr.sz);
+ md5_hash(dst.hashInfo, tmp64, sz);
return 0;
}
Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20101106092409-rlluc8m0a07gejxb.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jonas:3341) | jonas oreland | 6 Nov |