List:Commits« Previous MessageNext Message »
From:Olav Sandstaa Date:February 10 2009 6:40pm
Subject:bzr commit into mysql-6.0-falcon-team branch (olav:3011)
View as plain text  
#At file:///home/os136802/mysql/develop/repo/falcon-bug40633/ based on
revid:olav@stripped

 3011 Olav Sandstaa	2009-02-10 [merge]
      Merging...
renamed:
  mysql-test/suite/falcon/r/falcon_bug_34351_B.result =>
mysql-test/suite/falcon_team/r/falcon_bug_34351_B.result
  mysql-test/suite/falcon/r/falcon_bug_34351_C.result =>
mysql-test/suite/falcon_team/r/falcon_bug_34351_C.result
  mysql-test/suite/falcon/t/falcon_bug_34351_B.test =>
mysql-test/suite/falcon_team/t/falcon_bug_34351_B.test
  mysql-test/suite/falcon/t/falcon_bug_34351_C.test =>
mysql-test/suite/falcon_team/t/falcon_bug_34351_C.test
modified:
  mysql-test/include/wait_until_connected_again.inc
  mysql-test/r/subselect3.result
  mysql-test/r/subselect3_jcl6.result
  mysql-test/suite/falcon_team/t/test2bug.def
  mysql-test/t/subselect3.test
  sql/handler.cc
  sql/handler.h
  sql/sql_select.cc
  storage/falcon/StorageVersion.h
  storage/innobase/handler/ha_innodb.cc
  storage/maria/ha_maria.cc
  storage/myisam/ha_myisam.cc

=== modified file 'mysql-test/include/wait_until_connected_again.inc'

=== modified file 'mysql-test/include/wait_until_connected_again.inc'
--- a/mysql-test/include/wait_until_connected_again.inc	2009-02-09 11:18:57 +0000
+++ b/mysql-test/include/wait_until_connected_again.inc	2009-02-10 12:29:35 +0000
@@ -7,9 +7,11 @@
 # When you change this file you may have to chance its cousin
 # wait_until_disconnected.inc
 
-#--disable_result_log
+--disable_result_log
 --disable_query_log
-let $counter= 600;
+# We wait for 7 minutes, because some storage engines need quite
+# some to restart with Valgrind runs on Pushbuild.
+let $counter= 4200;
 let $mysql_errno= 9999;
 while ($mysql_errno)
 {
@@ -27,4 +29,4 @@
   --real_sleep 0.1
 }
 --enable_query_log
-#--enable_result_log
+--enable_result_log

=== modified file 'mysql-test/r/subselect3.result'
--- a/mysql-test/r/subselect3.result	2009-01-30 14:13:39 +0000
+++ b/mysql-test/r/subselect3.result	2009-02-04 11:27:06 +0000
@@ -1219,6 +1219,21 @@
 1	PRIMARY	Z	ALL	NULL	NULL	NULL	NULL	6	End materialize; Using join buffer
 drop table t0,t1,t2;
 
+BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
+
+CREATE TABLE t1 (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_key` int(11) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,9),(2,3),(3,8),(4,6),(5,9),(6,5),(7,5),(8,9),(9,1),(10,10);
+SELECT `pk` FROM t1 AS OUTR WHERE `int_key` = ALL (
+SELECT `int_key` FROM t1 AS INNR WHERE INNR . `pk` >= 9
+);
+pk
+DROP TABLE t1;
+
 BUG#40118 Crash when running Batched Key Access and requiring one match for each key
 
 create table t0(a int);

=== modified file 'mysql-test/r/subselect3_jcl6.result'
--- a/mysql-test/r/subselect3_jcl6.result	2009-02-03 09:16:53 +0000
+++ b/mysql-test/r/subselect3_jcl6.result	2009-02-04 11:27:06 +0000
@@ -1224,6 +1224,21 @@
 1	PRIMARY	Z	ALL	NULL	NULL	NULL	NULL	6	End materialize; Using join buffer
 drop table t0,t1,t2;
 
+BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
+
+CREATE TABLE t1 (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_key` int(11) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,9),(2,3),(3,8),(4,6),(5,9),(6,5),(7,5),(8,9),(9,1),(10,10);
+SELECT `pk` FROM t1 AS OUTR WHERE `int_key` = ALL (
+SELECT `int_key` FROM t1 AS INNR WHERE INNR . `pk` >= 9
+);
+pk
+DROP TABLE t1;
+
 BUG#40118 Crash when running Batched Key Access and requiring one match for each key
 
 create table t0(a int);

=== renamed file 'mysql-test/suite/falcon/r/falcon_bug_34351_B.result' =>
'mysql-test/suite/falcon_team/r/falcon_bug_34351_B.result'
=== renamed file 'mysql-test/suite/falcon/r/falcon_bug_34351_C.result' =>
'mysql-test/suite/falcon_team/r/falcon_bug_34351_C.result'
=== renamed file 'mysql-test/suite/falcon/t/falcon_bug_34351_B.test' =>
'mysql-test/suite/falcon_team/t/falcon_bug_34351_B.test'
=== renamed file 'mysql-test/suite/falcon/t/falcon_bug_34351_C.test' =>
'mysql-test/suite/falcon_team/t/falcon_bug_34351_C.test'
=== modified file 'mysql-test/suite/falcon_team/t/test2bug.def'
--- a/mysql-test/suite/falcon_team/t/test2bug.def	2008-12-16 21:11:25 +0000
+++ b/mysql-test/suite/falcon_team/t/test2bug.def	2009-02-10 13:32:02 +0000
@@ -20,3 +20,5 @@
 falcon_bug_34174 : Bug#34174 - Infinite loop checking rolled back record in select for
update
 falcon_bug_36294-big: Bug#36631	- Assertion in SerialLogControl::nextRecord, sometimes.
 falcon_deadlock:  Bug#34182 - SELECT ... FOR UPDATE does not lock when in subquery
+falcon_bug_34351_B: Bug#42140 - falcon_bug_34351_B fails; sometimes
+falcon_bug_34351_C: Bug#41357 - falcon.falcon_bug_34351_C fails with assertion
IS_CONSISTENT_READ

=== modified file 'mysql-test/t/subselect3.test'
--- a/mysql-test/t/subselect3.test	2009-01-30 14:13:39 +0000
+++ b/mysql-test/t/subselect3.test	2009-02-04 11:27:06 +0000
@@ -989,6 +989,21 @@
 
 drop table t0,t1,t2;
 
+--echo
+--echo BUG#37842: Assertion in DsMrr_impl::dsmrr_init, at handler.cc:4307
+--echo
+CREATE TABLE t1 (
+  `pk` int(11) NOT NULL AUTO_INCREMENT,
+  `int_key` int(11) DEFAULT NULL,
+  PRIMARY KEY (`pk`),
+  KEY `int_key` (`int_key`)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1,9),(2,3),(3,8),(4,6),(5,9),(6,5),(7,5),(8,9),(9,1),(10,10);
+SELECT `pk` FROM t1 AS OUTR WHERE `int_key` = ALL (
+ SELECT `int_key` FROM t1 AS INNR WHERE INNR . `pk` >= 9
+);
+DROP TABLE t1;
+
 --echo 
 --echo BUG#40118 Crash when running Batched Key Access and requiring one match for each
key
 --echo

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2009-02-04 10:49:16 +0000
+++ b/sql/handler.cc	2009-02-05 08:22:22 +0000
@@ -4362,17 +4362,20 @@
   @retval other Error
 */
 
-int DsMrr_impl::dsmrr_init(handler *h, KEY *key,
-                           RANGE_SEQ_IF *seq_funcs, void *seq_init_param,
-                           uint n_ranges, uint mode, HANDLER_BUFFER *buf)
+int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs, 
+                           void *seq_init_param, uint n_ranges, uint mode,
+                           HANDLER_BUFFER *buf)
 {
   uint elem_size;
-  uint keyno;
   Item *pushed_cond= NULL;
   handler *new_h2= 0;
   DBUG_ENTER("DsMrr_impl::dsmrr_init");
-  keyno= h->active_index;
 
+  /*
+    index_merge may invoke a scan on an object for which dsmrr_info[_const]
+    has not been called, so set the owner handler here as well.
+  */
+  h= h_arg;
   if (mode & HA_MRR_USE_DEFAULT_IMPL || mode & HA_MRR_SORTED)
   {
     use_default_impl= TRUE;
@@ -4393,17 +4396,28 @@
                       elem_size;
   rowids_buf_end= rowids_buf_last;
 
+    /*
+    There can be two cases:
+    - This is the first call since index_init(), h2==NULL
+       Need to setup h2 then.
+    - This is not the first call, h2 is initalized and set up appropriately.
+       The caller might have called h->index_init(), need to switch h to
+       rnd_pos calls.
+  */
   if (!h2)
   {
     /* Create a separate handler object to do rndpos() calls. */
     THD *thd= current_thd;
+    /*
+      ::clone() takes up a lot of stack, especially on 64 bit platforms.
+      The constant 5 is an empiric result.
+    */
+    if (check_stack_overrun(thd, 5*STACK_MIN_SIZE, (uchar*) &new_h2))
+      DBUG_RETURN(1);
+    DBUG_ASSERT(h->active_index != MAX_KEY);
+    uint mrr_keyno= h->active_index;
 
-  /*
-    ::clone() takes up a lot of stack, especially on 64 bit platforms.
-    The constant 5 is an empiric result.
-  */
-  if (check_stack_overrun(thd, 5*STACK_MIN_SIZE, (uchar*) &new_h2))
-    DBUG_RETURN(1);
+    /* Create a separate handler object to do rndpos() calls. */
     if (!(new_h2= h->clone(thd->mem_root)) || 
         new_h2->ha_external_lock(thd, F_RDLCK))
     {
@@ -4411,31 +4425,55 @@
       DBUG_RETURN(1);
     }
 
-    if (keyno == h->pushed_idx_cond_keyno)
+    if (mrr_keyno == h->pushed_idx_cond_keyno)
       pushed_cond= h->pushed_idx_cond;
+
+    /*
+      Caution: this call will invoke this->dsmrr_close(). Do not put the
+      created secondary table handler into this->h2 or it will delete it.
+    */
     if (h->ha_index_end())
     {
-      new_h2= h2;
+      h2=new_h2;
       goto error;
     }
 
-    h2= new_h2;
+    h2= new_h2; /* Ok, now can put it into h2 */
     table->prepare_for_position();
-    new_h2->extra(HA_EXTRA_KEYREAD);
+    h2->extra(HA_EXTRA_KEYREAD);
   
-    if (h2->ha_index_init(keyno, FALSE))
+    if (h2->ha_index_init(mrr_keyno, FALSE))
+      goto error;
+
+    use_default_impl= FALSE;
+    if (pushed_cond)
+      h2->idx_cond_push(mrr_keyno, pushed_cond);
+  }
+  else
+  {
+    /* 
+      We get here when the access alternates betwen MRR scan(s) and non-MRR
+      scans.
+
+      Calling h->index_end() will invoke dsmrr_close() for this object,
+      which will delete h2. We need to keep it, so save put it away and dont
+      let it be deleted:
+    */
+    handler *save_h2= h2;
+    h2= NULL;
+    int res= (h->inited == handler::INDEX && h->ha_index_end());
+    h2= save_h2;
+    use_default_impl= FALSE;
+    if (res)
       goto error;
   }
 
   if (h2->handler::multi_range_read_init(seq_funcs, seq_init_param, n_ranges,
-                                         mode, buf))
-    goto error;
-  
-  if (pushed_cond)
-    h2->idx_cond_push(keyno, pushed_cond);
-  if (dsmrr_fill_buffer(new_h2))
-    goto error;
-
+                                          mode, buf) || 
+      dsmrr_fill_buffer())
+  {
+    goto error;
+  }
   /*
     If the above call has scanned through all intervals in *seq, then
     adjust *buf to indicate that the remaining buffer space will not be used.
@@ -4504,7 +4542,7 @@
   @retval other  Error
 */
 
-int DsMrr_impl::dsmrr_fill_buffer(handler *unused)
+int DsMrr_impl::dsmrr_fill_buffer()
 {
   char *range_info;
   int res;
@@ -4551,7 +4589,7 @@
   DS-MRR implementation: multi_range_read_next() function
 */
 
-int DsMrr_impl::dsmrr_next(handler *h, char **range_info)
+int DsMrr_impl::dsmrr_next(char **range_info)
 {
   int res;
   uchar *cur_range_info= 0;
@@ -4569,8 +4607,7 @@
         res= HA_ERR_END_OF_FILE;
         goto end;
       }
-
-      res= dsmrr_fill_buffer(h);
+    res= dsmrr_fill_buffer();
       if (res)
         goto end;
     }

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2009-01-29 21:17:59 +0000
+++ b/sql/handler.h	2009-02-02 14:12:27 +0000
@@ -2461,14 +2461,15 @@
 
   DsMrr_impl()
     : h2(NULL) {};
-
-  handler *h; /* The "owner" handler object. It is used for scanning the index */
+  
+  /*
+    The "owner" handler object (the one that calls dsmrr_XXX functions.
+    It is used to retrieve full table rows by calling rnd_pos().
+  */
+  handler *h;
   TABLE *table; /* Always equal to h->table */
 private:
-  /*
-    Secondary handler object. It is used to retrieve full table rows by
-    calling rnd_pos().
-  */
+  /* Secondary handler object.  It is used for scanning the index */
   handler *h2;
 
   /* Buffer to store rowids, or (rowid, range_id) pairs */
@@ -2489,12 +2490,11 @@
     h= h_arg; 
     table= table_arg;
   }
-  int dsmrr_init(handler *h, KEY *key, RANGE_SEQ_IF *seq_funcs, 
-                 void *seq_init_param, uint n_ranges, uint mode, 
-                 HANDLER_BUFFER *buf);
+  int dsmrr_init(handler *h, RANGE_SEQ_IF *seq_funcs, void *seq_init_param, 
+                 uint n_ranges, uint mode, HANDLER_BUFFER *buf);
   void dsmrr_close();
-  int dsmrr_fill_buffer(handler *h);
-  int dsmrr_next(handler *h, char **range_info);
+  int dsmrr_fill_buffer();
+  int dsmrr_next(char **range_info);
 
   ha_rows dsmrr_info(uint keyno, uint n_ranges, uint keys, uint *bufsz,
                      uint *flags, COST_VECT *cost);

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-02-04 10:49:16 +0000
+++ b/sql/sql_select.cc	2009-02-10 12:42:42 +0000
@@ -2648,14 +2648,19 @@
 				     tmp_fields_list2, tmp_all_fields2, 
 				     fields_list.elements, tmp_all_fields1))
 	  DBUG_VOID_RETURN;
-	curr_join->tmp_fields_list2= tmp_fields_list2;
-	curr_join->tmp_all_fields2= tmp_all_fields2;
+
+        if (curr_join != this)
+        {
+          curr_join->tmp_fields_list2= tmp_fields_list2;
+          curr_join->tmp_all_fields2= tmp_all_fields2;
+        }
+
       }
       curr_fields_list= &curr_join->tmp_fields_list2;
       curr_all_fields= &curr_join->tmp_all_fields2;
       curr_join->set_items_ref_array(items2);
       curr_join->tmp_table_param.field_count+= 
-	curr_join->tmp_table_param.sum_func_count;
+      curr_join->tmp_table_param.sum_func_count;
       curr_join->tmp_table_param.sum_func_count= 0;
     }
     if (curr_tmp_table->distinct)

=== modified file 'storage/falcon/StorageVersion.h'
--- a/storage/falcon/StorageVersion.h	2009-02-05 09:00:35 +0000
+++ b/storage/falcon/StorageVersion.h	2009-02-10 13:32:02 +0000
@@ -14,5 +14,5 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 
-#define FALCON_VERSION	"T1.4-6"
-#define FALCON_DATE		"05 February, 2009"
+#define FALCON_VERSION	"T1.4-7"
+#define FALCON_DATE		"10 February, 2009"

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2009-01-31 16:21:19 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2009-02-05 08:22:22 +0000
@@ -3468,7 +3468,6 @@
           prebuilt->idx_cond_func= NULL;
           prebuilt->n_index_fields= n_requested_fields;
         }
-       // file->in_range_read= FALSE;
 
 	if (index != clust_index && prebuilt->need_to_access_clustered) {
 		/* Change rec_field_no's to correspond to the clustered index
@@ -6675,7 +6674,6 @@
                         /* Reset index condition pushdown state */
                         pushed_idx_cond= FALSE;
                         pushed_idx_cond_keyno= MAX_KEY;
-                        //in_range_read= FALSE;
                         prebuilt->idx_cond_func= NULL;
 			break;
 		case HA_EXTRA_NO_KEYREAD:
@@ -8497,13 +8495,12 @@
 int ha_innobase::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
                           uint n_ranges, uint mode, HANDLER_BUFFER *buf)
 {
-  return ds_mrr.dsmrr_init(this, &table->key_info[active_index], 
-                           seq, seq_init_param, n_ranges, mode, buf);
+  return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf);
 }
 
 int ha_innobase::multi_range_read_next(char **range_info)
 {
-  return ds_mrr.dsmrr_next(this, range_info);
+  return ds_mrr.dsmrr_next(range_info);
 }
 
 ha_rows ha_innobase::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
@@ -8539,7 +8536,7 @@
 static my_bool index_cond_func_innodb(void *arg)
 {
   ha_innobase *h= (ha_innobase*)arg;
-  if (h->end_range) //was: h->in_range_read
+  if (h->end_range)
   {
     if (h->compare_key2(h->end_range) > 0)
       return 2; /* caller should return HA_ERR_END_OF_FILE already */
@@ -8569,11 +8566,7 @@
                                 bool sorted /* ignored */)
 {
   int res;
-  //if (!eq_range_arg)
-    //in_range_read= TRUE;
   res= handler::read_range_first(start_key, end_key, eq_range_arg, sorted);
-  //if (res)
-  //  in_range_read= FALSE;
   return res;
 }
 
@@ -8581,8 +8574,6 @@
 int ha_innobase::read_range_next()
 {
   int res= handler::read_range_next();
-  //if (res)
-  //  in_range_read= FALSE;
   return res;
 }
 

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2009-02-02 13:57:39 +0000
+++ b/storage/maria/ha_maria.cc	2009-02-05 08:22:22 +0000
@@ -3198,13 +3198,12 @@
                                      uint n_ranges, uint mode, 
                                      HANDLER_BUFFER *buf)
 {
-  return ds_mrr.dsmrr_init(this, &table->key_info[active_index], 
-                           seq, seq_init_param, n_ranges, mode, buf);
+  return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf);
 }
 
 int ha_maria::multi_range_read_next(char **range_info)
 {
-  return ds_mrr.dsmrr_next(this, range_info);
+  return ds_mrr.dsmrr_next(range_info);
 }
 
 ha_rows ha_maria::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2009-02-04 10:49:16 +0000
+++ b/storage/myisam/ha_myisam.cc	2009-02-05 08:22:22 +0000
@@ -2013,13 +2013,12 @@
                                      uint n_ranges, uint mode, 
                                      HANDLER_BUFFER *buf)
 {
-  return ds_mrr.dsmrr_init(this, &table->key_info[active_index], 
-                           seq, seq_init_param, n_ranges, mode, buf);
+  return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf);
 }
 
 int ha_myisam::multi_range_read_next(char **range_info)
 {
-  return ds_mrr.dsmrr_next(this, range_info);
+  return ds_mrr.dsmrr_next(range_info);
 }
 
 ha_rows ha_myisam::multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,

Thread
bzr commit into mysql-6.0-falcon-team branch (olav:3011) Olav Sandstaa10 Feb 2009