List:Commits« Previous MessageNext Message »
From:Jan Wedvik Date:May 26 2011 3:13pm
Subject:bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch
(jan.wedvik:3499)
View as plain text  
#At file:///net/atum17/export/home/tmp/jw159207/mysql/repo/push-scan-scan/ based on revid:jan.wedvik@stripped

 3499 Jan Wedvik	2011-05-26
      This commit adds a regression test for http://lists.mysql.com/commits/138223, which is:
      
      "This is a fix for an error that would occur when pushing an index scan that is sorted on a string field.
      The problem was an assumption that compare_ndbrecord() would always return 0,-1 or 1, when it can in fact return any
      number. This could cause results to be sorted in the wrong order, or mysqld to loop for ever."

    modified:
      mysql-test/suite/ndb/r/ndb_join_pushdown.result
      mysql-test/suite/ndb/t/ndb_join_pushdown.test
=== modified file 'mysql-test/suite/ndb/r/ndb_join_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_join_pushdown.result	2011-05-13 08:47:06 +0000
+++ b/mysql-test/suite/ndb/r/ndb_join_pushdown.result	2011-05-26 15:13:05 +0000
@@ -5120,6 +5120,27 @@ on x0.d=x1.a;
 count(*)
 2052
 drop table t1;
+create table t1 (pk char(10) primary key, u int not null) engine=ndb;
+create table t2 (pk int primary key, u int not null) engine=ndb;
+insert into t1 values ('wh',1);
+insert into t1 values ('ik',2);
+insert into t1 values ('cu',3);
+insert into t1 values ('pw',4);
+insert into t1 values ('cq',4);
+insert into t2 values (1,2), (2,3), (3,4), (4,5);
+explain select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	PRIMARY	10	NULL	5	Parent of 2 pushed join@1
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.u	1	Child of 't1' in pushed join@1
+select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
+pk	u	pk	u
+cq	4	4	5
+cu	3	3	4
+ik	2	2	3
+pw	4	4	5
+wh	1	1	2
+drop table t1;
+drop table t2;
 create temporary table spj_counts_at_end
 select counter_name, sum(val) as val 
 from ndbinfo.counters 
@@ -5137,10 +5158,10 @@ counter_name	spj_counts_at_end.val - spj
 CONST_PRUNED_RANGE_SCANS_RECEIVED	6
 LOCAL_TABLE_SCANS_SENT	232
 PRUNED_RANGE_SCANS_RECEIVED	17
-RANGE_SCANS_RECEIVED	718
+RANGE_SCANS_RECEIVED	720
 READS_NOT_FOUND	6616
 READS_RECEIVED	52
-SCAN_ROWS_RETURNED	94223
+SCAN_ROWS_RETURNED	94233
 TABLE_SCANS_RECEIVED	232
 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 
@@ -5148,19 +5169,19 @@ where spj_counts_at_end.counter_name = s
 and (spj_counts_at_end.counter_name = 'LOCAL_READS_SENT'
        or spj_counts_at_end.counter_name = 'REMOTE_READS_SENT');
 LOCAL+REMOTE READS_SENT
-35283
+35288
 drop table spj_counts_at_startup;
 drop table spj_counts_at_end;
 scan_count
-2551
+2555
 pruned_scan_count
 8
 sorted_scan_count
-9
+10
 pushed_queries_defined
-377
+379
 pushed_queries_dropped
 11
 pushed_queries_executed
-531
+532
 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	2011-05-13 08:47:06 +0000
+++ b/mysql-test/suite/ndb/t/ndb_join_pushdown.test	2011-05-26 15:13:05 +0000
@@ -3295,6 +3295,24 @@ select count(*) from t1 as x0 
 
 drop table t1;
 
+## Test scan sorted on string field.
+create table t1 (pk char(10) primary key, u int not null) engine=ndb;
+create table t2 (pk int primary key, u int not null) engine=ndb;
+
+insert into t1 values ('wh',1);
+insert into t1 values ('ik',2);
+insert into t1 values ('cu',3);
+insert into t1 values ('pw',4);
+insert into t1 values ('cq',4);
+
+insert into t2 values (1,2), (2,3), (3,4), (4,5);
+
+explain select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
+select * from t1 join t2 on t1.u = t2.pk order by t1.pk;
+
+drop table t1;
+drop table t2;
+
 ########################################
 # Verify DBSPJ counters for entire test:
 


Attachment: [text/bzr-bundle] bzr/jan.wedvik@oracle.com-20110526151305-rmk2b2q0haunlchy.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(jan.wedvik:3499) Jan Wedvik26 May