List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:October 15 2008 10:26pm
Subject:bzr push into mysql-6.0-bka-preview branch (sergefp:2655 to 2656)
Bug#40118
View as plain text  
 2656 Sergey Petrunia	2008-10-16
      BUG#40118: Crash when running Batched Key Access and requiring one match for each key
      - Make DsMrr_impl::dsmrr_next use h2->mrr_funcs, not h->mrr_funcs. This is because 
        DS-MRR uses h2 to scan the index (and hence h2->mrr_funcs is properly initialized)
        while h is used to make rnd_pos() calls (and so h->mrr_funcs is not defined)
modified:
  mysql-test/r/subselect3.result
  mysql-test/t/subselect3.test
  sql/handler.cc

 2655 Igor Babaev	2008-10-17
      Correction for the patch to fix bug #35835.
modified:
  sql/sql_select.cc

=== modified file 'mysql-test/r/subselect3.result'
--- a/mysql-test/r/subselect3.result	2008-08-20 01:52:25 +0000
+++ b/mysql-test/r/subselect3.result	2008-10-15 22:06:36 +0000
@@ -815,3 +815,29 @@ t1.a < (select t4.a+10                  
 from t4, t5 limit 2));
 ERROR 21000: Subquery returns more than 1 row
 drop table t0, t1, t2, t3, t4, t5;
+
+BUG#40118 Crash when running Batched Key Access and requiring one match for each key
+
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int, key(a));
+insert into t1 select * from t0;
+alter table t1 add b int not null, add filler char(200);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+set @save_join_cache_level=@@join_cache_level;
+set join_cache_level=6;
+select * from t0 left join t1 on t0.a=t1.a where t1.b is null;
+a	a	b	filler
+0	0	0	NULL
+1	1	0	NULL
+2	2	0	NULL
+3	3	0	NULL
+4	4	0	NULL
+5	5	0	NULL
+6	6	0	NULL
+7	7	0	NULL
+8	8	0	NULL
+9	9	0	NULL
+set join_cache_level=@save_join_cache_level;
+drop table t0, t1;

=== modified file 'mysql-test/t/subselect3.test'
--- a/mysql-test/t/subselect3.test	2008-08-20 01:52:25 +0000
+++ b/mysql-test/t/subselect3.test	2008-10-15 22:06:36 +0000
@@ -670,3 +670,22 @@ where
                                   from t4, t5 limit 2));
 
 drop table t0, t1, t2, t3, t4, t5;
+
+--echo 
+--echo BUG#40118 Crash when running Batched Key Access and requiring one match for each key
+--echo
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int, key(a));
+insert into t1 select * from t0;
+alter table t1 add b int not null, add filler char(200);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+
+set @save_join_cache_level=@@join_cache_level;
+set join_cache_level=6;
+select * from t0 left join t1 on t0.a=t1.a where t1.b is null; 
+
+set join_cache_level=@save_join_cache_level;
+drop table t0, t1;
+

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2008-10-15 01:19:02 +0000
+++ b/sql/handler.cc	2008-10-15 22:06:36 +0000
@@ -4519,8 +4519,8 @@ int DsMrr_impl::dsmrr_next(handler *h, c
       cur_range_info= *(uchar**)(rowids_buf_cur + h->ref_length);
 
     rowids_buf_cur += h->ref_length + sizeof(void*) * test(is_mrr_assoc);
-    if (h->mrr_funcs.skip_record &&
-	h->mrr_funcs.skip_record(h->mrr_iter, (char *) cur_range_info, rowid))
+    if (h2->mrr_funcs.skip_record &&
+	h2->mrr_funcs.skip_record(h2->mrr_iter, (char *) cur_range_info, rowid))
       continue;
     res= h->rnd_pos(table->record[0], rowid);
     break;

Thread
bzr push into mysql-6.0-bka-preview branch (sergefp:2655 to 2656)Bug#40118Sergey Petrunia18 Oct