mariadb/sql/partition_info.h

293 lines
9.8 KiB
C
Raw Normal View History

/* Copyright (C) 2000,2006 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
#include "partition_element.h"
class partition_info;
/* Some function typedefs */
typedef int (*get_part_id_func)(partition_info *part_info,
uint32 *part_id,
longlong *func_value);
typedef uint32 (*get_subpart_id_func)(partition_info *part_info);
WL 2826: Error handling of ALTER TABLE for partitioning Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements 5.1.7 was released still with partition states in clear text Fixed io_size bug Fixed bug in open that TRUNCATED before reading :) file_entry => file_entry_buf Don't open DDL log until first write call to DDL log handler_type => handler_name no => num sql/ha_partition.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log sql/mysql_priv.h: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/mysqld.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/partition_element.h: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/partition_info.h: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/share/errmsg.txt: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/sql_base.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/sql_partition.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements sql/sql_table.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements Fixed io_size bug Fixed bug in open that TRUNCATED before reading :) file_entry => file_entry_buf Don't open DDL log until first write call to DDL log handler_type => handler_name no => num sql/table.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements 5.1.7 was released still with partition states in clear text Fixed io_size bug Fixed bug in open that TRUNCATED before reading :) file_entry => file_entry_buf Don't open DDL log until first write call to DDL log handler_type => handler_name no => num
2006-03-25 00:19:13 +01:00
struct st_ddl_log_memory_entry;
class partition_info : public Sql_alloc
{
public:
/*
* Here comes a set of definitions needed for partitioned table handlers.
*/
List<partition_element> partitions;
List<partition_element> temp_partitions;
List<char> part_field_list;
List<char> subpart_field_list;
/*
If there is no subpartitioning, use only this func to get partition ids.
If there is subpartitioning, use the this func to get partition id when
you have both partition and subpartition fields.
*/
get_part_id_func get_partition_id;
/* Get partition id when we don't have subpartition fields */
get_part_id_func get_part_partition_id;
/*
Get subpartition id when we have don't have partition fields by we do
have subpartition ids.
Mikael said that for given constant tuple
{subpart_field1, ..., subpart_fieldN} the subpartition id will be the
same in all subpartitions
*/
get_subpart_id_func get_subpartition_id;
/* NULL-terminated array of fields used in partitioned expression */
Field **part_field_array;
/* NULL-terminated array of fields used in subpartitioned expression */
Field **subpart_field_array;
/*
Array of all fields used in partition and subpartition expression,
without duplicates, NULL-terminated.
*/
Field **full_part_field_array;
Item *part_expr;
Item *subpart_expr;
Item *item_free_list;
2006-03-22 06:17:22 +01:00
WL 2826: Error handling of ALTER TABLE for partitioning Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements 5.1.7 was released still with partition states in clear text Fixed io_size bug Fixed bug in open that TRUNCATED before reading :) file_entry => file_entry_buf Don't open DDL log until first write call to DDL log handler_type => handler_name no => num sql/ha_partition.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log sql/mysql_priv.h: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/mysqld.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/partition_element.h: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/partition_info.h: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/share/errmsg.txt: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/sql_base.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter sql/sql_partition.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements sql/sql_table.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements Fixed io_size bug Fixed bug in open that TRUNCATED before reading :) file_entry => file_entry_buf Don't open DDL log until first write call to DDL log handler_type => handler_name no => num sql/table.cc: Loads of review comments fixed inactivate => deactivate table log => ddl log Commented on Error Inject Module added Put various #defines into enums Fixed abort_and_upgrade_lock, removed unnecessary parameter Fixed mysqlish method intro's Fixed warning statements 5.1.7 was released still with partition states in clear text Fixed io_size bug Fixed bug in open that TRUNCATED before reading :) file_entry => file_entry_buf Don't open DDL log until first write call to DDL log handler_type => handler_name no => num
2006-03-25 00:19:13 +01:00
struct st_ddl_log_memory_entry *first_log_entry;
struct st_ddl_log_memory_entry *exec_log_entry;
struct st_ddl_log_memory_entry *frm_log_entry;
2006-03-22 06:17:22 +01:00
/*
A bitmap of partitions used by the current query.
Usage pattern:
* The handler->extra(HA_EXTRA_RESET) call at query start/end sets all
partitions to be unused.
* Before index/rnd_init(), partition pruning code sets the bits for used
partitions.
*/
MY_BITMAP used_partitions;
union {
longlong *range_int_array;
LIST_PART_ENTRY *list_array;
};
/********************************************
* INTERVAL ANALYSIS
********************************************/
/*
Partitioning interval analysis function for partitioning, or NULL if
interval analysis is not supported for this kind of partitioning.
*/
get_partitions_in_range_iter get_part_iter_for_interval;
/*
Partitioning interval analysis function for subpartitioning, or NULL if
interval analysis is not supported for this kind of partitioning.
*/
get_partitions_in_range_iter get_subpart_iter_for_interval;
/*
Valid iff
get_part_iter_for_interval=get_part_iter_for_interval_via_walking:
controls how we'll process "field < C" and "field > C" intervals.
If the partitioning function F is strictly increasing, then for any x, y
"x < y" => "F(x) < F(y)" (*), i.e. when we get interval "field < C"
we can perform partition pruning on the equivalent "F(field) < F(C)".
If the partitioning function not strictly increasing (it is simply
increasing), then instead of (*) we get "x < y" => "F(x) <= F(y)"
i.e. for interval "field < C" we can perform partition pruning for
"F(field) <= F(C)".
*/
bool range_analysis_include_bounds;
/********************************************
* INTERVAL ANALYSIS ENDS
********************************************/
char* part_info_string;
char *part_func_string;
char *subpart_func_string;
uchar *part_state;
partition_element *curr_part_elem;
partition_element *current_partition;
/*
These key_map's are used for Partitioning to enable quick decisions
on whether we can derive more information about which partition to
scan just by looking at what index is used.
*/
key_map all_fields_in_PF, all_fields_in_PPF, all_fields_in_SPF;
key_map some_fields_in_PF;
handlerton *default_engine_type;
Item_result part_result_type;
partition_type part_type;
partition_type subpart_type;
uint part_info_len;
uint part_state_len;
uint part_func_len;
uint subpart_func_len;
uint no_parts;
uint no_subparts;
uint count_curr_subparts;
uint part_error_code;
uint no_list_values;
uint no_part_fields;
uint no_subpart_fields;
uint no_full_part_fields;
BUG#16002: Make partition functions that are unsigned work properly mysql-test/r/partition.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_error.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_range.result: A number of new test cases for unsigned partition functions mysql-test/t/partition.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_error.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_range.test: A number of new test cases for unsigned partition functions sql/ha_partition.cc: Error message for no partition found needs to take signed/unsigned into account when printing erroneus value sql/partition_element.h: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order sql/partition_info.cc: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order Lots of new code to handle checks of proper definition of table when partition function is unsigned sql/partition_info.h: Mostly rearrangement of code and some addition of a THD object in check_partition_info call plus a new method for comparing unsigned values sql/share/errmsg.txt: Negative values not ok for unsigned partition functions sql/sql_partition.cc: Fixed a multi-thread bug (when defining several partitioned tables in parallel) New code to generate partition syntax that takes into account sign of constants. Made function fix_fields_part_func more reusable. Fixed a number of get_partition_id functions for range and list and similar functions for partition pruning code. Unfortunately fairly much duplication of code with just small changes. sql/sql_partition.h: New function headers sql/sql_show.cc: Changed list of values for LIST partitioned tables Also fixed printing of unsigned values in INFORMATION SCHEMA for partitioned table sql/sql_table.cc: Fixed for new interface sql/sql_yacc.yy: Moved definition of struct to partition_element.h Added code to keep track of sign of constants in RANGE and LIST partitions sql/table.cc: Fixed for new interface
2006-04-18 04:51:34 +02:00
uint has_null_part_id;
/*
This variable is used to calculate the partition id when using
LINEAR KEY/HASH. This functionality is kept in the MySQL Server
but mainly of use to handlers supporting partitioning.
*/
uint16 linear_hash_mask;
bool use_default_partitions;
bool use_default_no_partitions;
bool use_default_subpartitions;
bool use_default_no_subpartitions;
bool default_partitions_setup;
bool defined_max_value;
bool list_of_part_fields;
bool list_of_subpart_fields;
bool linear_hash_ind;
bool fixed;
BUG#19010: Fix issues with that ALTER TABLE from auto-partitioned NDB table doesn't work unless primary key exists on table. mysql-test/r/ndb_bitfield.result: Test cases changes now that auto-partitioning is remembered in frm file mysql-test/r/ndb_dd_basic.result: Test cases changes now that auto-partitioning is remembered in frm file mysql-test/r/ndb_dd_disk2memory.result: Test cases changes now that auto-partitioning is remembered in frm file mysql-test/r/ndb_gis.result: Test cases changes now that auto-partitioning is remembered in frm file mysql-test/r/ndb_partition_key.result: New test cases for auto-partitioning change that was made to fix bug mysql-test/r/rpl_ndb_UUID.result: Test cases changes now that auto-partitioning is remembered in frm file mysql-test/r/rpl_ndb_dd_advance.result: Test cases changes now that auto-partitioning is remembered in frm file mysql-test/t/ndb_partition_key.test: New test cases for auto-partitioning change that was made to fix bug sql/partition_info.h: New boolean to keep track of auto partitioned or not sql/sql_partition.cc: Ensure that auto-partitiong flag is reset when partitions are dropped, added, reorganised or coalesced. Ensure that auto-partitioned tables are altered into non-partitioned table when ALTER TABLE t1 engine=X is performed. sql/sql_show.cc: Only print partition info for non-auto-partitioned tables sql/sql_table.cc: Set auto partition flag when auto partitions are generated in create table sql/table.cc: Fix reading of frm file where new auto-partition flag is introduced. sql/table.h: New flag for auto partition on share object sql/unireg.cc: Fix code for writing frm to also write autopartition flag at end of partition info, fix some length issues at the same time that was in this part that caused no problems since partition info always was the last info in the file.
2006-05-10 18:53:40 +02:00
bool is_auto_partitioned;
bool from_openfrm;
bool has_null_value;
BUG#18198: Less flexibility in defining partition functions Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations mysql-test/r/partition.result: Changed test case since no longer supported to use multicharacter collations in comparisons mysql-test/t/partition.test: Changed test case since no longer supported to use multicharacter collations in comparisons sql/item.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_cmpfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_func.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_strfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_timefunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_xmlfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_partition.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_table.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations
2006-06-23 07:21:26 +02:00
char pf_collation_allowed;
char spf_collation_allowed;
partition_info()
: get_partition_id(NULL), get_part_partition_id(NULL),
get_subpartition_id(NULL),
part_field_array(NULL), subpart_field_array(NULL),
full_part_field_array(NULL),
part_expr(NULL), subpart_expr(NULL), item_free_list(NULL),
2006-03-22 06:17:22 +01:00
first_log_entry(NULL), exec_log_entry(NULL), frm_log_entry(NULL),
list_array(NULL),
part_info_string(NULL),
part_func_string(NULL), subpart_func_string(NULL),
part_state(NULL),
curr_part_elem(NULL), current_partition(NULL),
default_engine_type(NULL),
part_result_type(INT_RESULT),
part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION),
part_info_len(0), part_state_len(0),
part_func_len(0), subpart_func_len(0),
no_parts(0), no_subparts(0),
count_curr_subparts(0), part_error_code(0),
no_list_values(0), no_part_fields(0), no_subpart_fields(0),
BUG#16002: Make partition functions that are unsigned work properly mysql-test/r/partition.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_error.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_range.result: A number of new test cases for unsigned partition functions mysql-test/t/partition.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_error.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_range.test: A number of new test cases for unsigned partition functions sql/ha_partition.cc: Error message for no partition found needs to take signed/unsigned into account when printing erroneus value sql/partition_element.h: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order sql/partition_info.cc: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order Lots of new code to handle checks of proper definition of table when partition function is unsigned sql/partition_info.h: Mostly rearrangement of code and some addition of a THD object in check_partition_info call plus a new method for comparing unsigned values sql/share/errmsg.txt: Negative values not ok for unsigned partition functions sql/sql_partition.cc: Fixed a multi-thread bug (when defining several partitioned tables in parallel) New code to generate partition syntax that takes into account sign of constants. Made function fix_fields_part_func more reusable. Fixed a number of get_partition_id functions for range and list and similar functions for partition pruning code. Unfortunately fairly much duplication of code with just small changes. sql/sql_partition.h: New function headers sql/sql_show.cc: Changed list of values for LIST partitioned tables Also fixed printing of unsigned values in INFORMATION SCHEMA for partitioned table sql/sql_table.cc: Fixed for new interface sql/sql_yacc.yy: Moved definition of struct to partition_element.h Added code to keep track of sign of constants in RANGE and LIST partitions sql/table.cc: Fixed for new interface
2006-04-18 04:51:34 +02:00
no_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
use_default_partitions(TRUE), use_default_no_partitions(TRUE),
use_default_subpartitions(TRUE), use_default_no_subpartitions(TRUE),
default_partitions_setup(FALSE), defined_max_value(FALSE),
list_of_part_fields(FALSE), list_of_subpart_fields(FALSE),
linear_hash_ind(FALSE), fixed(FALSE),
is_auto_partitioned(FALSE), from_openfrm(FALSE),
BUG#18198: Less flexibility in defining partition functions Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations mysql-test/r/partition.result: Changed test case since no longer supported to use multicharacter collations in comparisons mysql-test/t/partition.test: Changed test case since no longer supported to use multicharacter collations in comparisons sql/item.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_cmpfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_func.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_strfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_timefunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_xmlfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_partition.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_table.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations
2006-06-23 07:21:26 +02:00
has_null_value(FALSE),
pf_collation_allowed(0),
spf_collation_allowed(0)
{
all_fields_in_PF.clear_all();
all_fields_in_PPF.clear_all();
all_fields_in_SPF.clear_all();
some_fields_in_PF.clear_all();
partitions.empty();
temp_partitions.empty();
part_field_list.empty();
subpart_field_list.empty();
}
~partition_info() {}
partition_info *get_clone();
/* Answers the question if subpartitioning is used for a certain table */
bool is_sub_partitioned()
{
return (subpart_type == NOT_A_PARTITION ? FALSE : TRUE);
}
/* Returns the total number of partitions on the leaf level */
uint get_tot_partitions()
{
return no_parts * (is_sub_partitioned() ? no_subparts : 1);
}
bool set_up_defaults_for_partitioning(handler *file, ulonglong max_rows,
uint start_no);
char *has_unique_names();
static bool check_engine_mix(handlerton **engine_array, uint no_parts);
bool check_range_constants();
bool check_list_constants();
BUG#16002: Make partition functions that are unsigned work properly mysql-test/r/partition.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_error.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_range.result: A number of new test cases for unsigned partition functions mysql-test/t/partition.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_error.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_range.test: A number of new test cases for unsigned partition functions sql/ha_partition.cc: Error message for no partition found needs to take signed/unsigned into account when printing erroneus value sql/partition_element.h: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order sql/partition_info.cc: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order Lots of new code to handle checks of proper definition of table when partition function is unsigned sql/partition_info.h: Mostly rearrangement of code and some addition of a THD object in check_partition_info call plus a new method for comparing unsigned values sql/share/errmsg.txt: Negative values not ok for unsigned partition functions sql/sql_partition.cc: Fixed a multi-thread bug (when defining several partitioned tables in parallel) New code to generate partition syntax that takes into account sign of constants. Made function fix_fields_part_func more reusable. Fixed a number of get_partition_id functions for range and list and similar functions for partition pruning code. Unfortunately fairly much duplication of code with just small changes. sql/sql_partition.h: New function headers sql/sql_show.cc: Changed list of values for LIST partitioned tables Also fixed printing of unsigned values in INFORMATION SCHEMA for partitioned table sql/sql_table.cc: Fixed for new interface sql/sql_yacc.yy: Moved definition of struct to partition_element.h Added code to keep track of sign of constants in RANGE and LIST partitions sql/table.cc: Fixed for new interface
2006-04-18 04:51:34 +02:00
bool check_partition_info(THD *thd, handlerton **eng_type,
BUG#18198: Less flexibility in defining partition functions Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations mysql-test/r/partition.result: Changed test case since no longer supported to use multicharacter collations in comparisons mysql-test/t/partition.test: Changed test case since no longer supported to use multicharacter collations in comparisons sql/item.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_cmpfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_func.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_strfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_timefunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/item_xmlfunc.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/partition_info.h: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_partition.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations sql/sql_table.cc: Changed test for functions if they are supported. 3 categories: 1) Fully supported 2) Supported for single character collations 3) Supported for binary collations
2006-06-23 07:21:26 +02:00
handler *file, ulonglong max_rows,
bool check_partition_function);
void print_no_partition_found(TABLE *table);
private:
static int list_part_cmp(const void* a, const void* b);
BUG#16002: Make partition functions that are unsigned work properly mysql-test/r/partition.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_error.result: A number of new test cases for unsigned partition functions mysql-test/r/partition_range.result: A number of new test cases for unsigned partition functions mysql-test/t/partition.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_error.test: A number of new test cases for unsigned partition functions mysql-test/t/partition_range.test: A number of new test cases for unsigned partition functions sql/ha_partition.cc: Error message for no partition found needs to take signed/unsigned into account when printing erroneus value sql/partition_element.h: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order sql/partition_info.cc: Introduced signed_flag and max_value flag on partition elements Also list is now a list of a struct rather than simply longlong values Small rearranges of order Lots of new code to handle checks of proper definition of table when partition function is unsigned sql/partition_info.h: Mostly rearrangement of code and some addition of a THD object in check_partition_info call plus a new method for comparing unsigned values sql/share/errmsg.txt: Negative values not ok for unsigned partition functions sql/sql_partition.cc: Fixed a multi-thread bug (when defining several partitioned tables in parallel) New code to generate partition syntax that takes into account sign of constants. Made function fix_fields_part_func more reusable. Fixed a number of get_partition_id functions for range and list and similar functions for partition pruning code. Unfortunately fairly much duplication of code with just small changes. sql/sql_partition.h: New function headers sql/sql_show.cc: Changed list of values for LIST partitioned tables Also fixed printing of unsigned values in INFORMATION SCHEMA for partitioned table sql/sql_table.cc: Fixed for new interface sql/sql_yacc.yy: Moved definition of struct to partition_element.h Added code to keep track of sign of constants in RANGE and LIST partitions sql/table.cc: Fixed for new interface
2006-04-18 04:51:34 +02:00
static int list_part_cmp_unsigned(const void* a, const void* b);
bool set_up_default_partitions(handler *file, ulonglong max_rows,
uint start_no);
bool set_up_default_subpartitions(handler *file, ulonglong max_rows);
char *create_default_partition_names(uint part_no, uint no_parts,
uint start_no);
char *create_subpartition_name(uint subpart_no, const char *part_name);
bool has_unique_name(partition_element *element);
};
uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
/* Initialize the iterator to return a single partition with given part_id */
static inline void init_single_partition_iterator(uint32 part_id,
PARTITION_ITERATOR *part_iter)
{
part_iter->part_nums.start= part_iter->part_nums.cur= part_id;
part_iter->part_nums.end= part_id+1;
part_iter->get_next= get_next_partition_id_range;
}
/* Initialize the iterator to enumerate all partitions */
static inline
void init_all_partitions_iterator(partition_info *part_info,
PARTITION_ITERATOR *part_iter)
{
part_iter->part_nums.start= part_iter->part_nums.cur= 0;
part_iter->part_nums.end= part_info->no_parts;
part_iter->get_next= get_next_partition_id_range;
}