Commit 1f38322d authored by Mikael Ronstrom's avatar Mikael Ronstrom

Merged in latest changes

parents 1ef62bf6 d5230553
......@@ -24,8 +24,8 @@ data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1619 <DATA DIRECTORY> option ignored
Warning 1619 <INDEX DIRECTORY> option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
......
......@@ -84,11 +84,6 @@ create table t1 (a int, b char(20))
partition by range(a)
(partition p0 values less than (1,"b"));
ERROR HY000: Cannot have more than one value for this type of RANGE partitioning
create table t1 (a int, b char(20));
create global index inx on t1 (a,b)
partition by range (a)
(partition p0 values less than (1));
drop table t1;
create table t1 (a int, b char(20))
partition by range column_list(b)
(partition p0 values less than ("b"));
......
......@@ -101,8 +101,8 @@ data directory='/not/existing'
index directory='/not/existing'
);
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1619 <DATA DIRECTORY> option ignored
Warning 1619 <INDEX DIRECTORY> option ignored
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
......
......@@ -74,12 +74,6 @@ create table t1 (a int, b char(20))
partition by range(a)
(partition p0 values less than (1,"b"));
create table t1 (a int, b char(20));
create global index inx on t1 (a,b)
partition by range (a)
(partition p0 values less than (1));
drop table t1;
create table t1 (a int, b char(20))
partition by range column_list(b)
(partition p0 values less than ("b"));
......
/* 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
......
/* 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
......
/* 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 @@ class RANGE_OPT_PARAM
*/
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 @@ int find_used_partitions(PART_PRUNE_PARAM *ppar, SEL_ARG *key_tree)
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;
......
/* 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
......
/* Copyrght (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;
......
/* 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
......
......@@ -6180,8 +6180,6 @@ ER_TOO_LONG_FIELD_COMMENT
ER_FUNC_INEXISTENT_NAME_COLLISION 42000
eng "FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual"
ER_GLOBAL_PARTITION_INDEX_ERROR
eng "Partitioning of indexes only supported for global indexes"
ER_PARTITION_COLUMN_LIST_ERROR
eng "Inconsistency in usage of column lists for partitioning"
ER_WRONG_TYPE_COLUMN_VALUE_ERROR
......
......@@ -323,7 +323,6 @@ void lex_start(THD *thd)
lex->select_lex.select_number= 1;
lex->length=0;
lex->part_info= 0;
lex->global_flag= 0;
lex->select_lex.in_sum_expr=0;
lex->select_lex.ftfunc_list_alloc.empty();
lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc;
......
......@@ -1565,9 +1565,6 @@ typedef struct st_lex : public Query_tables_list
/* Partition info structure filled in by PARTITION BY parse part */
partition_info *part_info;
/* Flag to index a global index created */
bool global_flag;
/*
The definer of the object being created (view, trigger, stored routine).
I.e. the value of DEFINER clause.
......
/* 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;
}
}
......@@ -2677,7 +2677,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
......@@ -2735,7 +2735,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
*/
......@@ -2927,12 +2927,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);
}
......@@ -3031,7 +3031,6 @@ int get_partition_id_range_col(partition_info *part_info,
DBUG_PRINT("exit",("partition: %d", *part_id));
DBUG_RETURN(0);
return 0;
}
......@@ -6760,13 +6759,28 @@ static void set_up_range_analysis_info(partition_info *part_info)
}
/* 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)
......@@ -6793,12 +6807,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)
......
/* 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
......
......@@ -1157,7 +1157,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
opt_natural_language_mode opt_query_expansion
opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment
ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt
opt_global
%type <ulong_num>
ulong_num real_ulong_num merge_insert_types
......@@ -1691,12 +1690,12 @@ create:
$5->table.str);
}
}
| CREATE opt_global opt_unique_or_fulltext INDEX_SYM ident key_alg ON
| CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON
table_ident
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_CREATE_INDEX;
if (!lex->current_select->add_table_to_list(lex->thd, $8,
if (!lex->current_select->add_table_to_list(lex->thd, $7,
NULL,
TL_OPTION_UPDATING))
MYSQL_YYABORT;
......@@ -1704,7 +1703,6 @@ create:
lex->alter_info.flags= ALTER_ADD_INDEX;
lex->col_list.empty();
lex->change=NullS;
lex->global_flag= $2;
}
'(' key_list ')' key_options
{
......@@ -1715,22 +1713,13 @@ create:
my_parse_error(ER(ER_SYNTAX_ERROR));
MYSQL_YYABORT;
}
key= new Key($3, $5.str, &lex->key_create_info, 0,
key= new Key($2, $4.str, &lex->key_create_info, 0,
lex->col_list);
if (key == NULL)
MYSQL_YYABORT;
lex->alter_info.key_list.push_back(key);
lex->col_list.empty();
}
opt_partitioning
{
LEX *lex= Lex;
if (!lex->global_flag && lex->part_info)
{
my_error(ER_GLOBAL_PARTITION_INDEX_ERROR, MYF(0));
YYABORT;
}
}
| CREATE DATABASE opt_if_not_exists ident
{
Lex->create_info.default_table_charset= NULL;
......@@ -4366,11 +4355,6 @@ opt_part_option:
{ Lex->part_info->curr_part_elem->part_comment= $3.str; }
;
opt_global:
/* empty */ { $$= FALSE;}
| GLOBAL_SYM { $$= TRUE; }
;
/*
End of partition parser part
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment