MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Sergey Petrunia Date:February 14 2008 3:53am
Subject:bk commit into 6.0 tree (sergefp:1.2804) BUG#30221
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of sergefp.  When sergefp does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-02-14 06:53:02+03:00, sergefp@stripped +7 -0
  BUG#30221 "log_tables.test fails on Windows"
  The problem was that dsmrr_close() was not called for LIMIT queries that didn't
  finish the DS-MRR scan. This failure to deinitialize the scan caused leaks of 
  file descriptors in MyISAM.
  
  Fix: Call ds_mrr.dsmrr_close() in handler->reset().

  mysql-test/r/order_by.result@stripped, 2008-02-14 06:52:51+03:00, sergefp@stripped +2 -2
    BUG#30221 "log_tables.test fails on Windows"
    - Fix QEP cost races (choice of the first/last if we get several range scans with the same cost)

  mysql-test/t/disabled.def@stripped, 2008-02-14 06:52:51+03:00, sergefp@stripped +0 -1
    BUG#30221 "log_tables.test fails on Windows"
    - Re-enable the testcase

  mysql-test/t/order_by.test@stripped, 2008-02-14 06:52:51+03:00, sergefp@stripped +1 -1
    BUG#30221 "log_tables.test fails on Windows"
    - Fix QEP cost races (choice of the first/last if we get several range scans with the same cost)

  sql/handler.cc@stripped, 2008-02-14 06:52:52+03:00, sergefp@stripped +18 -32
    BUG#30221 "log_tables.test fails on Windows"
    - Initialize DsMrr_impl::h2 (the secondary handler) in ctor. DsMrr_impl::use_default_impl is no 
      more used as a guard for DsMrr_impl::h2.
    - Remove row_access_bitmap and associated members. With current handler::clone() DS-MRR 
      implementation we don't need the second column bitmap anymore.

  sql/handler.h@stripped, 2008-02-14 06:52:52+03:00, sergefp@stripped +1 -8
    BUG#30221 "log_tables.test fails on Windows"
    - Initialize DsMrr_impl::h2 (the secondary handler) in ctor. DsMrr_impl::use_default_impl is no 
      more used as a guard for DsMrr_impl::h2.
    - Remove row_access_bitmap and associated members. With current handler::clone() DS-MRR 
      implementation we don't need the second column bitmap anymore.

  storage/innobase/handler/ha_innodb.cc@stripped, 2008-02-14 06:52:52+03:00, sergefp@stripped +1 -1
    BUG#30221 "log_tables.test fails on Windows"
    - Call ds_mrr.dsmrr_close() in ha_innobase::reset()

  storage/myisam/ha_myisam.cc@stripped, 2008-02-14 06:52:53+03:00, sergefp@stripped +1 -0
    BUG#30221 "log_tables.test fails on Windows"
    - Call ds_mrr.dsmrr_close() in ha_myisam::reset()

diff -Nrup a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
--- a/mysql-test/r/order_by.result	2008-01-11 01:04:52 +03:00
+++ b/mysql-test/r/order_by.result	2008-02-14 06:52:51 +03:00
@@ -607,9 +607,9 @@ FieldKey	LongVal	StringVal
 1	0	2
 1	1	3
 1	2	1
-EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
+EXPLAIN SELECT * FROM t1 ignore index (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	FieldKey,LongField,StringField	FieldKey	38	NULL	4	Using index condition; Using where; Using MRR; Using filesort
+1	SIMPLE	t1	range	StringField	StringField	38	NULL	4	Using where; Using filesort
 SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
 FieldKey	LongVal	StringVal
 3	1	2
diff -Nrup a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
--- a/mysql-test/t/disabled.def	2008-01-19 22:14:21 +03:00
+++ b/mysql-test/t/disabled.def	2008-02-14 06:52:51 +03:00
@@ -14,7 +14,6 @@ concurrent_innodb        : BUG#21579 200
 ##order_by             : WL#2475: spetrunia producing ordered streams is not handled correctly
 federated_transactions   : Bug#29523 Transactions do not work
 subselect2 : BUG#31464 SergeyP will fix
-log_tables : BUG#31580 1007-10-13 SergeyP log_tables.test fails on all windows platforms in pushbuild
 show_check	: Bug #32682  	Test show_check fails in 6.0
 events                   : Bug#32664 events.test fails randomly
 lowercase_table3         : Bug#32667 lowercase_table3.test reports to error log
diff -Nrup a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
--- a/mysql-test/t/order_by.test	2007-09-28 11:36:01 +04:00
+++ b/mysql-test/t/order_by.test	2008-02-14 06:52:51 +03:00
@@ -400,7 +400,7 @@ CREATE TABLE t1 (
 INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3');
 EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
 SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal;
-EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
+EXPLAIN SELECT * FROM t1 ignore index (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal;
 SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal;
 EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
 SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal;
diff -Nrup a/sql/handler.cc b/sql/handler.cc
--- a/sql/handler.cc	2008-01-11 01:08:49 +03:00
+++ b/sql/handler.cc	2008-02-14 06:52:52 +03:00
@@ -3515,15 +3515,16 @@ int DsMrr_impl::dsmrr_init(handler *h, K
   uint elem_size;
   uint keyno;
   Item *pushed_cond= NULL;
+  handler *new_h2;
   DBUG_ENTER("DsMrr_impl::dsmrr_init");
   keyno= h->active_index;
+  DBUG_ASSERT(h2 == NULL);
   if (mode & HA_MRR_USE_DEFAULT_IMPL || mode & HA_MRR_SORTED)
   {
     use_default_impl= TRUE;
     DBUG_RETURN(h->handler::multi_range_read_init(seq_funcs, seq_init_param,
                                                   n_ranges, mode, buf));
   }
-  
   rowids_buf= buf->buffer;
   //psergey-todo: don't add key_length as it is not needed anymore
   rowids_buf += key->key_length + h->ref_length;
@@ -3539,27 +3540,24 @@ int DsMrr_impl::dsmrr_init(handler *h, K
 
   /* Create a separate handler object to do rndpos() calls. */
   THD *thd= current_thd;
-  if (!(h2= h->clone(thd->mem_root)) || h2->ha_external_lock(thd, F_RDLCK))
+  if (!(new_h2= h->clone(thd->mem_root)) || 
+      new_h2->ha_external_lock(thd, F_RDLCK))
   {
-    delete h2;
+    delete new_h2;
     DBUG_RETURN(1);
   }
-  my_bitmap_map *bmp_buf;
-  if (!(bmp_buf= (my_bitmap_map*)thd->alloc(table->s->column_bitmap_size)))
-    goto error;
 
-  bitmap_init(&row_access_bitmap, bmp_buf, table->s->fields, FALSE);
-  bitmap_copy(&row_access_bitmap, table->read_set);
-  save_read_set= table->read_set;
-  save_write_set= table->write_set;
-  
   if (keyno == h->pushed_idx_cond_keyno)
     pushed_cond= h->pushed_idx_cond;
   if (h->ha_index_end())
+  {
+    new_h2= h2;
     goto error;
-   
+  }
+
+  h2= new_h2;
   table->prepare_for_position();
-  h2->extra(HA_EXTRA_KEYREAD);
+  new_h2->extra(HA_EXTRA_KEYREAD);
 
   if (h2->ha_index_init(keyno, FALSE) || 
       h2->handler::multi_range_read_init(seq_funcs, seq_init_param, n_ranges,
@@ -3569,7 +3567,7 @@ int DsMrr_impl::dsmrr_init(handler *h, K
   
   if (pushed_cond)
     h2->idx_cond_push(keyno, pushed_cond);
-  if (dsmrr_fill_buffer(h2))
+  if (dsmrr_fill_buffer(new_h2))
     goto error;
 
   /*
@@ -3579,8 +3577,6 @@ int DsMrr_impl::dsmrr_init(handler *h, K
   if (dsmrr_eof) 
     buf->end_of_used_area= rowids_buf_last;
 
-  table->column_bitmaps_set_no_signal(&row_access_bitmap, 
-                                         &row_access_bitmap);
   if (h->ha_rnd_init(FALSE))
     goto error;
   
@@ -3590,7 +3586,6 @@ error:
   h2->ha_external_lock(thd, F_UNLCK);
   h2->close();
   delete h2;
-  table->column_bitmaps_set_no_signal(save_read_set, save_write_set);
   DBUG_RETURN(1);
 }
 
@@ -3598,18 +3593,14 @@ error:
 void DsMrr_impl::dsmrr_close()
 {
   DBUG_ENTER("DsMrr_impl::dsmrr_close");
-  if (!use_default_impl)
+  if (h2)
   {
-    if (h2)
-    {
-      h2->ha_external_lock(current_thd, F_UNLCK);
-      h2->close();
-      delete h2;
-      h2= NULL;
-    }
-    table->column_bitmaps_set(save_read_set, save_write_set);
-    use_default_impl= TRUE;
+    h2->ha_external_lock(current_thd, F_UNLCK);
+    h2->close();
+    delete h2;
+    h2= NULL;
   }
+  use_default_impl= TRUE;
   DBUG_VOID_RETURN;
 }
 
@@ -3691,17 +3682,12 @@ int DsMrr_impl::dsmrr_next(handler *h, c
     
   if (rowids_buf_cur == rowids_buf_last)
   {
-    table->column_bitmaps_set_no_signal(save_read_set, save_write_set);
     if (dsmrr_eof)
     {
       res= HA_ERR_END_OF_FILE;
       goto end;
     }
-
     res= dsmrr_fill_buffer(h);
-    
-    table->column_bitmaps_set_no_signal(&row_access_bitmap,
-                                           &row_access_bitmap);
     if (res)
       goto end;
   }
diff -Nrup a/sql/handler.h b/sql/handler.h
--- a/sql/handler.h	2008-01-30 15:44:12 +03:00
+++ b/sql/handler.h	2008-02-14 06:52:52 +03:00
@@ -2229,7 +2229,7 @@ public:
   typedef void (handler::*range_check_toggle_func_t)(bool on);
 
   DsMrr_impl()
-    : use_default_impl(TRUE) {};
+    : h2(NULL) {};
 
   handler *h; /* The "owner" handler object. It is used for scanning the index */
   TABLE *table; /* Always equal to h->table */
@@ -2251,13 +2251,6 @@ private:
   /* TRUE <=> need range association, buffer holds {rowid, range_id} pairs */
   bool is_mrr_assoc;
 
-  /*
-    Column bitmaps to be used with slave handler object. Those are necessary
-    as we set primary handler object's bitmap to contain index columns only.
-  */
-  MY_BITMAP row_access_bitmap;
-  MY_BITMAP *save_read_set, *save_write_set;
-  
   bool use_default_impl; /* TRUE <=> shortcut all calls to default MRR impl */
 public:
   void init(handler *h_arg, TABLE *table_arg)
diff -Nrup a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
--- a/storage/innobase/handler/ha_innodb.cc	2008-01-11 01:08:50 +03:00
+++ b/storage/innobase/handler/ha_innodb.cc	2008-02-14 06:52:52 +03:00
@@ -6345,7 +6345,7 @@ int ha_innobase::reset()
   /* Reset index condition pushdown state */
   pushed_idx_cond_keyno= MAX_KEY;
   pushed_idx_cond= NULL;
-  //in_range_read= FALSE;
+  ds_mrr.dsmrr_close();
   prebuilt->idx_cond_func= NULL;
   return 0;
 }
diff -Nrup a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
--- a/storage/myisam/ha_myisam.cc	2008-01-11 01:08:50 +03:00
+++ b/storage/myisam/ha_myisam.cc	2008-02-14 06:52:53 +03:00
@@ -1702,6 +1702,7 @@ int ha_myisam::reset(void)
   pushed_idx_cond= NULL;
   pushed_idx_cond_keyno= MAX_KEY;
   mi_set_index_cond_func(file, NULL, 0);
+  ds_mrr.dsmrr_close();
   return mi_reset(file);
 }
 
Thread
bk commit into 6.0 tree (sergefp:1.2804) BUG#30221Sergey Petrunia14 Feb