summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/ha_partition.cc2
-rw-r--r--sql/ha_partition.h2
-rw-r--r--sql/opt_range.cc29
-rw-r--r--sql/partition_element.h2
-rw-r--r--sql/partition_info.cc8
-rw-r--r--sql/partition_info.h2
-rw-r--r--sql/sql_partition.cc40
-rw-r--r--sql/sql_partition.h8
8 files changed, 55 insertions, 38 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 1b7165dd590..0b6650ec11e 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -1,4 +1,4 @@
-/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2005-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 3a09c1d2ea3..e5bb9ed05f5 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1,4 +1,4 @@
-/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2005-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 801045a8f6d..c65bcd0af84 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1,4 +1,4 @@
-/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -655,8 +655,10 @@ public:
*/
uint real_keynr[MAX_KEY];
- /* Used to store 'current key tuples', in both range analysis and
- * partitioning (list) analysis*/
+ /*
+ Used to store 'current key tuples', in both range analysis and
+ partitioning (list) analysis
+ */
uchar min_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH],
max_key[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
@@ -3131,7 +3133,7 @@ static
int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
{
int res, left_res=0, right_res=0;
- int partno= (int)key_tree->part;
+ int key_tree_part= (int)key_tree->part;
bool set_full_part_if_bad_ret= FALSE;
bool ignore_part_fields= ppar->ignore_part_fields;
bool did_set_ignore_part_fields= FALSE;
@@ -3146,8 +3148,8 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
}
/* Push SEL_ARG's to stack to enable looking backwards as well */
- ppar->cur_part_fields+= ppar->is_part_keypart[partno];
- ppar->cur_subpart_fields+= ppar->is_subpart_keypart[partno];
+ ppar->cur_part_fields+= ppar->is_part_keypart[key_tree_part];
+ ppar->cur_subpart_fields+= ppar->is_subpart_keypart[key_tree_part];
*(ppar->arg_stack_end++)= key_tree;
if (key_tree->type == SEL_ARG::KEY_RANGE)
@@ -3249,6 +3251,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
but this is a harder case we will solve later. For the harder case
this clause then turns into use of all partitions and thus we
simply set res= -1 as if the mapper had returned that.
+ TODO: What to do here is defined in WL#4065.
*/
if (ppar->arg_stack[0]->part == 0)
{
@@ -3283,7 +3286,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
Save our intent to mark full partition as used if we will not be able
to obtain further limits on subpartitions
*/
- if (partno < ppar->last_part_partno)
+ if (key_tree_part < ppar->last_part_partno)
{
/*
We need to ignore the rest of the partitioning fields in all
@@ -3296,7 +3299,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
goto process_next_key_part;
}
- if (partno == ppar->last_subpart_partno &&
+ if (key_tree_part == ppar->last_subpart_partno &&
(NULL != ppar->part_info->get_subpart_iter_for_interval))
{
PARTITION_ITERATOR subpart_iter;
@@ -3338,7 +3341,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
if (key_tree->is_singlepoint())
{
- if (partno == ppar->last_part_partno &&
+ if (key_tree_part == ppar->last_part_partno &&
ppar->cur_part_fields == ppar->part_fields &&
ppar->part_info->get_part_iter_for_interval == NULL)
{
@@ -3369,7 +3372,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
goto process_next_key_part;
}
- if (partno == ppar->last_subpart_partno &&
+ if (key_tree_part == ppar->last_subpart_partno &&
ppar->cur_subpart_fields == ppar->subpart_fields)
{
/*
@@ -3406,7 +3409,7 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
we're processing subpartititoning's key parts, this means we'll not be
able to infer any suitable condition, so bail out.
*/
- if (partno >= ppar->last_part_partno)
+ if (key_tree_part >= ppar->last_part_partno)
{
res= -1;
goto pop_and_go_right;
@@ -3455,8 +3458,8 @@ process_next_key_part:
pop_and_go_right:
/* Pop this key part info off the "stack" */
ppar->arg_stack_end--;
- ppar->cur_part_fields-= ppar->is_part_keypart[partno];
- ppar->cur_subpart_fields-= ppar->is_subpart_keypart[partno];
+ ppar->cur_part_fields-= ppar->is_part_keypart[key_tree_part];
+ ppar->cur_subpart_fields-= ppar->is_subpart_keypart[key_tree_part];
if (res == -1)
return -1;
diff --git a/sql/partition_element.h b/sql/partition_element.h
index d749681fe9b..bd18457fd5b 100644
--- a/sql/partition_element.h
+++ b/sql/partition_element.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2009 MySQL AB
+/* Copyright (C) 2006-2008 MySQL AB, Sun Microsystems Inc. 2008-2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index ef212fce28d..871ce4b8e45 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006-2008 MySQL AB, Sun Microsystems Inc. 2008-2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -363,7 +363,7 @@ char* partition_info::has_unique_fields()
for (j= 0; j < num_fields; j++)
{
field_name_inner= it_inner++;
- if (i == j)
+ if (i >= j)
continue;
if (!(my_strcasecmp(system_charset_info,
field_name_outer,
@@ -660,7 +660,7 @@ bool partition_info::check_range_constants(THD *thd)
if (column_list)
{
- part_column_list_val* loc_range_col_array;
+ part_column_list_val *loc_range_col_array;
part_column_list_val *current_largest_col_val;
uint num_column_values= part_field_list.elements;
uint size_entries= sizeof(part_column_list_val) * num_column_values;
@@ -669,7 +669,7 @@ bool partition_info::check_range_constants(THD *thd)
LINT_INIT(current_largest_col_val);
if (unlikely(range_col_array == NULL))
{
- mem_alloc_error(num_parts * sizeof(longlong));
+ mem_alloc_error(num_parts * size_entries);
goto end;
}
loc_range_col_array= range_col_array;
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 6e197198807..01d6ea93e2b 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -1,4 +1,4 @@
-/* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 52e28311ead..52b73a06600 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -1,4 +1,4 @@
-/* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+/* Copyright 2005-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1406,8 +1406,8 @@ static void set_up_partition_func_pointers(partition_info *part_info)
DBUG_ASSERT(part_info->get_part_partition_id);
if (!part_info->column_list)
{
- part_info->get_part_partition_id=
- part_info->get_part_partition_id_charset;
+ part_info->get_part_partition_id_charset=
+ part_info->get_part_partition_id;
part_info->get_part_partition_id= get_part_id_charset_func_part;
}
}
@@ -2673,7 +2673,7 @@ static void restore_part_field_pointers(Field **ptr, uchar **restore_ptr)
part_info A reference to the partition_info struct where all the
desired information is given
out:part_id The partition id is returned through this pointer
- out: func_value Value of partition function (longlong)
+ out:func_value Value of partition function (longlong)
RETURN VALUE
part_id Partition id of partition that would contain
@@ -2731,7 +2731,7 @@ static void restore_part_field_pointers(Field **ptr, uchar **restore_ptr)
get_partition_id_range_col
get_partition_id_hash_nosub
get_partition_id_key_nosub
- get_partition_id_linhash_nosub
+ get_partition_id_linear_hash_nosub
get_partition_id_linear_key_nosub
*/
@@ -2923,12 +2923,12 @@ uint32 get_partition_id_cols_list_for_endpoint(partition_info *part_info,
}
else
{
- DBUG_RETURN(list_index + test(left_endpoint ^ include_endpoint));
+ DBUG_RETURN(list_index + test(!tailf));
}
} while (max_list_index >= min_list_index);
-notfound:
if (cmp > 0)
list_index++;
+notfound:
DBUG_RETURN(list_index);
}
@@ -3027,7 +3027,6 @@ int get_partition_id_range_col(partition_info *part_info,
DBUG_PRINT("exit",("partition: %d", *part_id));
DBUG_RETURN(0);
- return 0;
}
@@ -6746,13 +6745,28 @@ setup_subparts:
}
-/* TODO Commenting those functions */
+/*
+ This function takes a memory of packed fields in opt-range format
+ and stores it in record format. To avoid having to worry about how
+ the length of fields are calculated in opt-range format we send
+ an array of lengths used for each field in store_length_array.
+
+ SYNOPSIS
+ store_tuple_to_record()
+ pfield Field array
+ store_length_array Array of field lengths
+ value Memory where fields are stored
+ value_end End of memory
+
+ RETURN VALUE
+ nparts Number of fields assigned
+*/
uint32 store_tuple_to_record(Field **pfield,
uint32 *store_length_array,
uchar *value,
uchar *value_end)
{
- // see store_key_image_to_rec
+ /* This function is inspired by store_key_image_rec. */
uint32 nparts= 0;
uchar *loc_value;
while (value < value_end)
@@ -6779,12 +6793,12 @@ uint32 store_tuple_to_record(Field **pfield,
/*
RANGE(columns) partitioning: compare value bound and probe tuple.
- The value bound always is a full tuple (but may include MIN_VALUE and
- MAX_VALUE special values).
+ The value bound always is a full tuple (but may include the MAX_VALUE
+ special value).
The probe tuple may be a prefix of partitioning tuple. The tail_is_min
parameter specifies whether the suffix components should be assumed to
- hold MIN_VALUE or MAX_VALUE
+ hold MAX_VALUE
*/
static int cmp_rec_and_tuple(part_column_list_val *val, uint32 nvals_in_rec)
diff --git a/sql/sql_partition.h b/sql/sql_partition.h
index 8fce2ebe6d1..47e5df0443f 100644
--- a/sql/sql_partition.h
+++ b/sql/sql_partition.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006 MySQL AB
+/* Copyright (C) 2006-2008 MySQL AB, Sun Microsystems Inc. 2008-2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -175,12 +175,12 @@ typedef struct st_partition_iter
part_info Partitioning info
is_subpart
store_length_array Length of fields packed in opt_range_key format
- min_val Left edge, field value in opt_range_key format.
- max_val Right edge, field value in opt_range_key format.
+ min_val Left edge, field value in opt_range_key format
+ max_val Right edge, field value in opt_range_key format
min_len Length of minimum value
max_len Length of maximum value
flags Some combination of NEAR_MIN, NEAR_MAX, NO_MIN_RANGE,
- NO_MAX_RANGE.
+ NO_MAX_RANGE
part_iter Iterator structure to be initialized
DESCRIPTION