List:Commits« Previous MessageNext Message »
From:bmiezejewski Date:September 25 2007 10:45pm
Subject:bk commit into 5.1 tree (brianm:1.2567)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of brianm. When brianm 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, 2007-09-25 17:45:26-05:00, brianm@lcane.(none) +3 -0
  Code to implement work log #4025 - Index Block Size by Index in PSE API

  sql/handler.h@stripped, 2007-09-25 17:45:17-05:00, brianm@lcane.(none) +3 -0
    Code to implement work log #4025 - Index Block Size by Index in PSE API

  sql/opt_range.cc@stripped, 2007-09-25 17:45:18-05:00, brianm@lcane.(none) +13 -10
    Code to implement work log #4025 - Index Block Size by Index in PSE API

  sql/sql_select.cc@stripped, 2007-09-25 17:45:18-05:00, brianm@lcane.(none) +2 -2
    Code to implement work log #4025 - Index Block Size by Index in PSE API

diff -Nrup a/sql/handler.h b/sql/handler.h
--- a/sql/handler.h	2007-09-25 16:12:06 -05:00
+++ b/sql/handler.h	2007-09-25 17:45:17 -05:00
@@ -1135,6 +1135,9 @@ public:
 
   virtual const char *index_type(uint key_number) { DBUG_ASSERT(0); return "";}
 
+  virtual const uint index_block_size(uint key_number) const
+    { return stats.block_size ; }
+
   int ha_index_init(uint idx, bool sorted)
   {
     int result;
diff -Nrup a/sql/opt_range.cc b/sql/opt_range.cc
--- a/sql/opt_range.cc	2007-08-13 08:11:12 -05:00
+++ b/sql/opt_range.cc	2007-09-25 17:45:18 -05:00
@@ -3870,7 +3870,7 @@ static double get_index_only_read_time(c
                                        int keynr)
 {
   double read_time;
-  uint keys_per_block= (param->table->file->stats.block_size/2/
+  uint keys_per_block= (param->table->file->index_block_size(keynr)/2/
 			(param->table->key_info[keynr].key_length+
 			 param->table->file->ref_length) + 1);
   read_time=((double) (records+keys_per_block-1)/
@@ -8921,11 +8921,12 @@ check_group_min_max_predicates(COND *con
                                Field::imagetype image_type);
 
 static void
-cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
-                   uint group_key_parts, SEL_TREE *range_tree,
+cost_group_min_max(TABLE* table, KEY *index_info, uint key_number,
+                   uint used_key_parts, uint group_key_parts, 
+                   SEL_TREE *range_tree,
                    SEL_ARG *index_tree, ha_rows quick_prefix_records,
                    bool have_min, bool have_max,
-                   double *read_cost, ha_rows *records);
+                   double *read_cost, ha_rows *records );
 
 
 /*
@@ -9390,10 +9391,10 @@ get_best_group_min_max(PARAM *param, SEL
       cur_quick_prefix_records= check_quick_select(param, cur_param_idx,
                                                     cur_index_tree, TRUE);
     }
-    cost_group_min_max(table, cur_index_info, used_key_parts,
+    cost_group_min_max(table, cur_index_info, cur_index, used_key_parts,
                        cur_group_key_parts, tree, cur_index_tree,
                        cur_quick_prefix_records, have_min, have_max,
-                       &cur_read_cost, &cur_records);
+                       &cur_read_cost, &cur_records );
     /*
       If cur_read_cost is lower than best_read_cost use cur_index.
       Do not compare doubles directly because they may have different
@@ -9763,6 +9764,7 @@ SEL_ARG * get_index_range_tree(uint inde
     cost_group_min_max()
     table                [in] The table being accessed
     index_info           [in] The index used to access the table
+    key_number           [in] The number of the index used to access the table
     used_key_parts       [in] Number of key parts used to access the index
     group_key_parts      [in] Number of index key parts in the group prefix
     range_tree           [in] Tree of ranges for all indexes
@@ -9816,9 +9818,10 @@ SEL_ARG * get_index_range_tree(uint inde
     None
 */
 
-void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
-                        uint group_key_parts, SEL_TREE *range_tree,
-                        SEL_ARG *index_tree, ha_rows quick_prefix_records,
+void cost_group_min_max(TABLE* table, KEY *index_info, uint key_number,
+                        uint used_key_parts, uint group_key_parts, 
+                        SEL_TREE *range_tree, SEL_ARG *index_tree, 
+                        ha_rows quick_prefix_records,
                         bool have_min, bool have_max,
                         double *read_cost, ha_rows *records)
 {
@@ -9836,7 +9839,7 @@ void cost_group_min_max(TABLE* table, KE
   DBUG_ENTER("cost_group_min_max");
 
   table_records= table->file->stats.records;
-  keys_per_block= (table->file->stats.block_size / 2 /
+  keys_per_block= (table->file->index_block_size(key_number) / 2 /
                    (index_info->key_length + table->file->ref_length)
                         + 1);
   num_blocks= (table_records / keys_per_block) + 1;
diff -Nrup a/sql/sql_select.cc b/sql/sql_select.cc
--- a/sql/sql_select.cc	2007-08-13 14:39:25 -05:00
+++ b/sql/sql_select.cc	2007-09-25 17:45:18 -05:00
@@ -4060,7 +4060,7 @@ best_access_path(JOIN      *join,
             if (table->covering_keys.is_set(key))
             {
               /* we can use only index tree */
-              uint keys_per_block= table->file->stats.block_size/2/
+              uint keys_per_block= table->file->index_block_size(key)/2/
                 (keyinfo->key_length+table->file->ref_length)+1;
               tmp= record_count*(tmp+keys_per_block-1)/keys_per_block;
             }
@@ -4227,7 +4227,7 @@ best_access_path(JOIN      *join,
             if (table->covering_keys.is_set(key))
             {
               /* we can use only index tree */
-              uint keys_per_block= table->file->stats.block_size/2/
+              uint keys_per_block= table->file->index_block_size(key)/2/
                 (keyinfo->key_length+table->file->ref_length)+1;
               tmp= record_count*(tmp+keys_per_block-1)/keys_per_block;
             }
Thread
bk commit into 5.1 tree (brianm:1.2567)bmiezejewski26 Sep