summaryrefslogtreecommitdiff
path: root/sql/partition_info.h
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-11-28 12:10:44 +0100
committerSergei Golubchik <sergii@pisem.net>2013-11-28 12:10:44 +0100
commit1387e71531495b1224bfafd6867ae5fae9cf469c (patch)
tree6307410443d2eeee3817acf552e3ce583e9444d8 /sql/partition_info.h
parent44db9c41b389a2eacdd9591f825ed86e9bffd0e8 (diff)
downloadmariadb-git-1387e71531495b1224bfafd6867ae5fae9cf469c.tar.gz
MDEV-5281 Partitioning issue after upgrade from 10.0.3-1 to 10.0.5-1
merged from 5.6: Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING Bug#16589511: MYSQL_UPGRADE FAILS TO WRITE OUT ENTIRE ALTER TABLE ... ALGORITHM= ... STATEMENT Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHEN DOWNGRADED FROM 5.6.11 TO 5.6.10 plus minor changes from 5.6, mainly comments
Diffstat (limited to 'sql/partition_info.h')
-rw-r--r--sql/partition_info.h44
1 files changed, 29 insertions, 15 deletions
diff --git a/sql/partition_info.h b/sql/partition_info.h
index 59b40d7ce88..777cd6065eb 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -168,8 +168,8 @@ public:
char *part_func_string;
char *subpart_func_string;
- partition_element *curr_part_elem;
- partition_element *current_partition;
+ partition_element *curr_part_elem; // part or sub part
+ partition_element *current_partition; // partition
part_elem_value *curr_list_val;
uint curr_list_object;
uint num_columns;
@@ -193,9 +193,7 @@ public:
uint num_parts;
uint num_subparts;
- uint count_curr_subparts;
-
- uint part_error_code;
+ uint count_curr_subparts; // used during parsing
uint num_list_values;
@@ -210,21 +208,35 @@ public:
but mainly of use to handlers supporting partitioning.
*/
uint16 linear_hash_mask;
-
+ /*
+ PARTITION BY KEY ALGORITHM=N
+ Which algorithm to use for hashing the fields.
+ N = 1 - Use 5.1 hashing (numeric fields are hashed as binary)
+ N = 2 - Use 5.5 hashing (numeric fields are hashed like latin1 bytes)
+ */
+ enum enum_key_algorithm
+ {
+ KEY_ALGORITHM_NONE= 0,
+ KEY_ALGORITHM_51= 1,
+ KEY_ALGORITHM_55= 2
+ };
+ enum_key_algorithm key_algorithm;
+
+ /* Only the number of partitions defined (uses default names and options). */
bool use_default_partitions;
bool use_default_num_partitions;
+ /* Only the number of subpartitions defined (uses default names etc.). */
bool use_default_subpartitions;
bool use_default_num_subpartitions;
bool default_partitions_setup;
bool defined_max_value;
- bool list_of_part_fields;
- bool list_of_subpart_fields;
- bool linear_hash_ind;
+ bool list_of_part_fields; // KEY or COLUMNS PARTITIONING
+ bool list_of_subpart_fields; // KEY SUBPARTITIONING
+ bool linear_hash_ind; // LINEAR HASH/KEY
bool fixed;
bool is_auto_partitioned;
- bool from_openfrm;
bool has_null_value;
- bool column_list;
+ bool column_list; // COLUMNS PARTITIONING, 5.5+
/**
True if pruning has been completed and can not be pruned any further,
even if there are subqueries or stored programs in the condition.
@@ -251,21 +263,22 @@ public:
part_info_string(NULL),
part_func_string(NULL), subpart_func_string(NULL),
curr_part_elem(NULL), current_partition(NULL),
- curr_list_object(0), num_columns(0),
+ curr_list_object(0), num_columns(0), table(NULL),
default_engine_type(NULL),
part_type(NOT_A_PARTITION), subpart_type(NOT_A_PARTITION),
part_info_len(0),
part_func_len(0), subpart_func_len(0),
num_parts(0), num_subparts(0),
- count_curr_subparts(0), part_error_code(0),
+ count_curr_subparts(0),
num_list_values(0), num_part_fields(0), num_subpart_fields(0),
num_full_part_fields(0), has_null_part_id(0), linear_hash_mask(0),
+ key_algorithm(KEY_ALGORITHM_NONE),
use_default_partitions(TRUE), use_default_num_partitions(TRUE),
use_default_subpartitions(TRUE), use_default_num_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),
+ is_auto_partitioned(FALSE),
has_null_value(FALSE), column_list(FALSE), is_pruning_completed(false)
{
all_fields_in_PF.clear_all();
@@ -314,7 +327,7 @@ public:
bool fix_column_value_functions(THD *thd,
part_elem_value *val,
uint part_id);
- int fix_parser_data(THD *thd);
+ bool fix_parser_data(THD *thd);
int add_max_value();
void init_col_val(part_column_list_val *col_val, Item *item);
int reorganize_into_single_field_col_val();
@@ -355,6 +368,7 @@ public:
enum_can_prune *can_prune_partitions,
bool *prune_needs_default_values,
MY_BITMAP *used_partitions);
+ bool has_same_partitioning(partition_info *new_part_info);
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,