MySQL 8.0.39
Source Code Documentation
|
#include "sql/sql_partition.h"
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstring>
#include "field_types.h"
#include "m_ctype.h"
#include "m_string.h"
#include "my_alloc.h"
#include "my_bitmap.h"
#include "my_byteorder.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_io.h"
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "mysql/components/services/bits/my_io_bits.h"
#include "mysql/components/services/bits/psi_statement_bits.h"
#include "mysql/plugin.h"
#include "mysql/psi/mysql_file.h"
#include "mysql/service_mysql_alloc.h"
#include "mysql/udf_registration_types.h"
#include "mysql_com.h"
#include "mysql_time.h"
#include "mysqld_error.h"
#include "sql/create_field.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"
#include "sql/derror.h"
#include "sql/enum_query_type.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/item.h"
#include "sql/item_func.h"
#include "sql/key.h"
#include "sql/mdl.h"
#include "sql/mysqld.h"
#include "sql/parse_tree_node_base.h"
#include "sql/partition_info.h"
#include "sql/partitioning/partition_handler.h"
#include "sql/psi_memory_key.h"
#include "sql/query_options.h"
#include "sql/range_optimizer/range_optimizer.h"
#include "sql/sql_alter.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_digest_stream.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_parse.h"
#include "sql/sql_show.h"
#include "sql/sql_table.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thd_raii.h"
#include "sql/thr_malloc.h"
#include "sql_string.h"
Macros | |
#define | MAX_COMPARE_PARTITION_OPTION_ERRORS 5 |
#define | MAX_RANGE_TO_WALK 32 |
Typedefs | |
typedef uint32(* | get_endpoint_func) (partition_info *, bool left_endpoint, bool include_endpoint) |
typedef uint32(* | get_col_endpoint_func) (partition_info *, bool left_endpoint, bool include_endpoint, uint32 num_parts) |
Functions | |
static int | get_partition_id_list_col (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_list (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_range_col (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_range (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_part_id_charset_func_part (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_part_id_charset_func_subpart (partition_info *part_info, uint32 *part_id) |
static int | get_partition_id_hash_nosub (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_key_nosub (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_linear_hash_nosub (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_linear_key_nosub (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_with_sub (partition_info *part_info, uint32 *part_id, longlong *func_value) |
static int | get_partition_id_hash_sub (partition_info *part_info, uint32 *part_id) |
static int | get_partition_id_key_sub (partition_info *part_info, uint32 *part_id) |
static int | get_partition_id_linear_hash_sub (partition_info *part_info, uint32 *part_id) |
static int | get_partition_id_linear_key_sub (partition_info *part_info, uint32 *part_id) |
static uint32 | get_next_partition_via_walking (PARTITION_ITERATOR *) |
static void | set_up_range_analysis_info (partition_info *part_info) |
static uint32 | get_next_subpartition_via_walking (PARTITION_ITERATOR *) |
static uint32 | get_partition_id_range_for_endpoint (partition_info *part_info, bool left_endpoint, bool include_endpoint) |
static uint32 | get_next_partition_id_list (PARTITION_ITERATOR *part_iter) |
static int | get_part_iter_for_interval_via_mapping (partition_info *part_info, bool is_subpart, uint32 *store_length_array, uchar *min_value, uchar *max_value, uint min_len, uint max_len, uint flags, PARTITION_ITERATOR *part_iter) |
Partitioning Interval Analysis: Initialize the iterator for "mapping" case. More... | |
static int | get_part_iter_for_interval_cols_via_map (partition_info *part_info, bool is_subpart, uint32 *store_length_array, uchar *min_value, uchar *max_value, uint min_len, uint max_len, uint flags, PARTITION_ITERATOR *part_iter) |
static int | get_part_iter_for_interval_via_walking (partition_info *part_info, bool is_subpart, uint32 *store_length_array, uchar *min_value, uchar *max_value, uint min_len, uint max_len, uint flags, PARTITION_ITERATOR *part_iter) |
static int | cmp_rec_and_tuple (part_column_list_val *val, uint32 nvals_in_rec) |
RANGE(columns) partitioning: compare partition value bound and probe tuple. More... | |
static int | cmp_rec_and_tuple_prune (part_column_list_val *val, uint32 n_vals_in_rec, bool is_left_endpoint, bool include_endpoint) |
Compare record and columns partition tuple including endpoint handling. More... | |
static void | set_field_ptr (Field **ptr, const uchar *new_buf, const uchar *old_buf) |
static uint32 | get_list_array_idx_for_endpoint (partition_info *part_info, bool left_endpoint, bool include_endpoint) |
Item * | convert_charset_partition_constant (Item *item, const CHARSET_INFO *cs) |
static bool | is_name_in_list (const char *name, List< String > list_names) |
A support function to check if a name is in a list of strings. More... | |
static bool | partition_default_handling (TABLE *table, partition_info *part_info, bool is_create_table_ind, const char *normalized_path) |
int | get_parts_for_update (const uchar *old_data, const uchar *new_data, const uchar *rec0, partition_info *part_info, uint32 *old_part_id, uint32 *new_part_id, longlong *new_func_value) |
int | get_part_for_delete (const uchar *buf, const uchar *rec0, partition_info *part_info, uint32 *part_id) |
static bool | set_up_field_array (TABLE *table, bool is_sub_part) |
static bool | create_full_part_field_array (THD *thd, TABLE *table, partition_info *part_info) |
static void | clear_indicator_in_key_fields (KEY *key_info) |
static void | set_indicator_in_key_fields (KEY *key_info) |
static void | check_fields_in_PF (Field **ptr, bool *all_fields, bool *some_fields) |
static void | clear_field_flag (TABLE *table) |
static bool | handle_list_of_fields (List_iterator< char > it, TABLE *table, partition_info *part_info, bool is_sub_part) |
static int | check_signed_flag (partition_info *part_info) |
static bool | init_lex_with_single_table (THD *thd, TABLE *table, LEX *lex) |
Initialize lex object for use in fix_fields and parsing. More... | |
static void | end_lex_with_single_table (THD *thd, TABLE *table, LEX *old_lex) |
End use of local lex with single table. More... | |
static bool | fix_fields_part_func (THD *thd, Item *func_expr, TABLE *table, bool is_sub_part, bool is_create_table_ind) |
static bool | check_primary_key (TABLE *table) |
static bool | check_unique_keys (TABLE *table) |
static void | check_range_capable_PF (TABLE *) |
static bool | set_up_partition_bitmaps (partition_info *part_info) |
Set up partition bitmaps. More... | |
static void | set_up_partition_key_maps (TABLE *table, partition_info *part_info) |
static void | set_up_partition_func_pointers (partition_info *part_info) |
void | set_linear_hash_mask (partition_info *part_info, uint num_parts) |
static uint32 | get_part_id_from_linear_hash (longlong hash_value, uint mask, uint num_parts) |
bool | field_is_partition_charset (Field *field) |
bool | check_part_func_fields (Field **ptr, bool ok_with_charsets) |
bool | fix_partition_func (THD *thd, TABLE *table, bool is_create_table_ind) |
static int | add_write (File fptr, const char *buf, size_t len) |
static int | add_string_object (File fptr, String *string) |
static int | add_string (File fptr, const char *string) |
static int | add_string_len (File fptr, const char *string, size_t len) |
static int | add_space (File fptr) |
static int | add_comma (File fptr) |
static int | add_equal (File fptr) |
static int | add_end_parenthesis (File fptr) |
static int | add_begin_parenthesis (File fptr) |
static int | add_part_key_word (File fptr, const char *key_string) |
static int | add_partition (File fptr) |
static int | add_subpartition (File fptr) |
static int | add_partition_by (File fptr) |
static int | add_subpartition_by (File fptr) |
static bool | append_field_list (THD *thd, String *str, List< char > field_list) |
Append field list to string. More... | |
static int | add_part_field_list (File fptr, List< char > field_list) |
static int | add_ident_string (File fptr, const char *name) |
static int | add_name_string (File fptr, const char *name) |
static int | add_int (File fptr, longlong number) |
static int | add_uint (File fptr, ulonglong number) |
static int | add_quoted_string (File fptr, const char *quotestr) |
void | truncate_partition_filename (MEM_ROOT *root, const char **path) |
Truncate the partition file name from a path if it exists. More... | |
static int | add_keyword_path (File fptr, const char *keyword, const char *path) |
Output a filepath. More... | |
static int | add_keyword_string (File fptr, const char *keyword, bool should_use_quotes, const char *keystr) |
static int | add_keyword_int (File fptr, const char *keyword, longlong num) |
static int | add_engine (File fptr, handlerton *engine_type) |
static int | add_partition_options (File fptr, partition_element *p_elem) |
static int | check_part_field (enum_field_types sql_type, const char *field_name, Item_result *result_type, bool *need_cs_check) |
static Create_field * | get_sql_field (const char *field_name, List< Create_field > *create_fields) |
int | expr_to_string (String *val_conv, Item *item_expr, Field *field, const char *field_name, const HA_CREATE_INFO *create_info, List< Create_field > *create_fields) |
static int | add_column_list_values (File fptr, partition_info *part_info, part_elem_value *list_value) |
static int | add_partition_values (File fptr, partition_info *part_info, partition_element *p_elem) |
static int | add_key_with_algorithm (File fptr, partition_info *part_info, const char *current_comment_start) |
Add 'KEY' word, with optional 'ALGORTIHM = N'. More... | |
static char * | get_file_content (File fptr, uint *buf_length, bool use_sql_alloc) |
char * | generate_partition_syntax (partition_info *part_info, uint *buf_length, bool use_sql_alloc, bool show_partition_options, bool print_expr, const char *current_comment_start) |
Generate the partition syntax from the partition data structure. More... | |
bool | partition_key_modified (TABLE *table, const MY_BITMAP *fields) |
static int | part_val_int (Item *item_expr, longlong *result) |
static uint32 | get_part_id_for_sub (uint32 loc_part_id, uint32 sub_part_id, uint num_subparts) |
static int | get_part_id_hash (uint num_parts, Item *part_expr, uint32 *part_id, longlong *func_value) |
static int | get_part_id_linear_hash (partition_info *part_info, uint num_parts, Item *part_expr, uint32 *part_id, longlong *func_value) |
static uint32 | get_part_id_key (handler *file, Field **field_array, uint num_parts, longlong *func_value) |
Calculate part_id for (SUB)PARTITION BY KEY. More... | |
static uint32 | get_part_id_linear_key (partition_info *part_info, Field **field_array, uint num_parts, longlong *func_value) |
static void | copy_to_part_field_buffers (Field **ptr, uchar **field_bufs, uchar **restore_ptr) |
static void | restore_part_field_pointers (Field **ptr, uchar **restore_ptr) |
static uint32 | get_partition_id_cols_list_for_endpoint (partition_info *part_info, bool left_endpoint, bool include_endpoint, uint32 nparts) |
static uint32 | get_list_array_idx_for_endpoint_charset (partition_info *part_info, bool left_endpoint, bool include_endpoint) |
Find the sub-array part_info->list_array that corresponds to given interval. More... | |
static uint32 | get_partition_id_range_for_endpoint_charset (partition_info *part_info, bool left_endpoint, bool include_endpoint) |
static bool | set_PF_fields_in_key (KEY *key_info, uint key_length) |
static bool | check_part_func_bound (Field **ptr) |
static int | get_sub_part_id_from_key (const TABLE *table, uchar *buf, KEY *key_info, const key_range *key_spec, uint32 *part_id) |
static bool | get_part_id_from_key (const TABLE *table, uchar *buf, KEY *key_info, const key_range *key_spec, uint32 *part_id) |
void | get_full_part_id_from_key (const TABLE *table, uchar *buf, KEY *key_info, const key_range *key_spec, part_id_range *part_spec) |
bool | verify_data_with_partition (TABLE *table, TABLE *part_table, uint32 part_id) |
Verify that all rows in a table is in the given partition. More... | |
void | prune_partition_set (const TABLE *table, part_id_range *part_spec) |
void | get_partition_set (const TABLE *table, uchar *buf, const uint index, const key_range *key_spec, part_id_range *part_spec) |
bool | mysql_unpack_partition (THD *thd, char *part_buf, uint part_info_len, TABLE *table, bool is_create_table_ind, handlerton *default_db_type, bool *work_part_info_used) |
static void | set_engine_all_partitions (partition_info *part_info, handlerton *engine_type) |
static bool | check_native_partitioned (HA_CREATE_INFO *create_info, bool *ret_val, partition_info *part_info, THD *thd) |
void | set_all_part_state (partition_info *tab_part_info, enum partition_state part_state) |
Set part_state for all partitions to given state. More... | |
bool | set_part_state (Alter_info *alter_info, partition_info *tab_part_info, enum partition_state part_state, bool include_subpartitions) |
Sets which partitions to be used in the command. More... | |
bool | compare_partition_options (HA_CREATE_INFO *table_create_info, partition_element *part_elem) |
Check if partition is exchangeable with table by checking table options. More... | |
uint | prep_alter_part_table (THD *thd, TABLE *table, Alter_info *alter_info, HA_CREATE_INFO *create_info, Alter_table_ctx *alter_ctx, bool *partition_changed, partition_info **new_part_info) |
void | append_row_to_str (String &str, const uchar *row, TABLE *table) |
Append all fields in read_set to string. More... | |
void | mem_alloc_error (size_t size) |
bool | make_used_partitions_str (partition_info *part_info, List< const char > *parts) |
Return comma-separated list of used partitions in the provided given string. More... | |
static uint32 | store_tuple_to_record (Field **pfield, uint32 *store_length_array, uchar *value, uchar *value_end) |
static uint32 | get_partition_id_cols_range_for_endpoint (partition_info *part_info, bool is_left_endpoint, bool include_endpoint, uint32 nparts) |
Get partition for RANGE COLUMNS endpoint. More... | |
uint32 | get_next_partition_id_range (PARTITION_ITERATOR *part_iter) |
uint | get_partition_field_store_length (Field *field) |
Variables | |
const LEX_CSTRING | partition_keywords [] |
static const char * | part_str = "PARTITION" |
static const char * | sub_str = "SUB" |
static const char * | by_str = "BY" |
static const char * | space_str = " " |
static const char * | equal_str = "=" |
static const char * | end_paren_str = ")" |
static const char * | begin_paren_str = "(" |
static const char * | comma_str = "," |
#define MAX_COMPARE_PARTITION_OPTION_ERRORS 5 |
#define MAX_RANGE_TO_WALK 32 |
typedef uint32(* get_col_endpoint_func) (partition_info *, bool left_endpoint, bool include_endpoint, uint32 num_parts) |
typedef uint32(* get_endpoint_func) (partition_info *, bool left_endpoint, bool include_endpoint) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Add 'KEY' word, with optional 'ALGORTIHM = N'.
fptr | File to write to. |
part_info | partition_info holding the used key_algorithm |
current_comment_start | NULL, or comment string encapsulating the PARTITION BY clause. |
0 | Success |
!= | 0 Failure |
|
static |
Output a filepath.
Similar to add_keyword_string except it also converts \ to / on Windows and skips the partition file name at the end if found.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Append field list to string.
Used by KEY and COLUMNS partitioning.
[in] | thd | Thread handle. |
[in,out] | str | String to append. |
[in] | field_list | List of field names to append. |
Append all fields in read_set to string.
[in,out] | str | String to append to. |
[in] | row | Row to append. |
[in] | table | Table containing read_set and fields for the row. |
|
static |
|
static |
|
static |
|
static |
bool check_part_func_fields | ( | Field ** | ptr, |
bool | ok_with_charsets | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
RANGE(columns) partitioning: compare partition value bound and probe tuple.
val | Partition column values. |
nvals_in_rec | Number of (prefix) fields to compare. |
|
static |
Compare record and columns partition tuple including endpoint handling.
val | Columns partition tuple |
n_vals_in_rec | Number of columns to compare |
is_left_endpoint | True if left endpoint (part_tuple < rec or part_tuple <= rec) |
include_endpoint | If endpoint is included (part_tuple <= rec or rec <= part_tuple) |
bool compare_partition_options | ( | HA_CREATE_INFO * | table_create_info, |
partition_element * | part_elem | ||
) |
Check if partition is exchangeable with table by checking table options.
table_create_info | Table options from table. |
part_elem | All the info of the partition. |
false | if they are equal, otherwise true. |
Item * convert_charset_partition_constant | ( | Item * | item, |
const CHARSET_INFO * | cs | ||
) |
|
static |
|
static |
End use of local lex with single table.
SYNOPSIS end_lex_with_single_table()
thd | The thread object |
table | The table object |
old_lex | The real lex object connected to THD |
DESCRIPTION This function restores the real lex object after calling init_lex_with_single_table and also restores some table variables temporarily set.
int expr_to_string | ( | String * | val_conv, |
Item * | item_expr, | ||
Field * | field, | ||
const char * | field_name, | ||
const HA_CREATE_INFO * | create_info, | ||
List< Create_field > * | create_fields | ||
) |
bool field_is_partition_charset | ( | Field * | field | ) |
|
static |
char * generate_partition_syntax | ( | partition_info * | part_info, |
uint * | buf_length, | ||
bool | use_sql_alloc, | ||
bool | show_partition_options, | ||
bool | print_expr, | ||
const char * | current_comment_start | ||
) |
Generate the partition syntax from the partition data structure.
Useful for support of generating defaults, SHOW CREATE TABLES and easy partition management.
part_info | The partitioning data structure |
buf_length | A pointer to the returned buffer length |
use_sql_alloc | Allocate buffer from sql_alloc if true otherwise use my_malloc |
show_partition_options | Should we display partition options |
print_expr | Indicates whether partitioning expressions should be re-printed to get quoting according to current sql_mode. |
current_comment_start | NULL, or comment string encapsulating the PARTITION BY clause. |
NULL | - error |
The implementation writes the syntax to a temporary file (essentially an abstraction of a dynamic array) and if all writes goes well it allocates a buffer and writes the syntax into this one and returns it.
As a security precaution the file is deleted before writing into it. This means that no other processes on the machine can open and read the file while this processing is ongoing.
The code is optimised for minimal code size since it is not used in any common queries.
void get_full_part_id_from_key | ( | const TABLE * | table, |
uchar * | buf, | ||
KEY * | key_info, | ||
const key_range * | key_spec, | ||
part_id_range * | part_spec | ||
) |
|
static |
|
static |
Find the sub-array part_info->list_array that corresponds to given interval.
part_info | Partitioning info (partitioning type must be LIST) |
left_endpoint | true - the interval is [a; +inf) or (a; +inf) false - the interval is (-inf; a] or (-inf; a) |
include_endpoint | true iff the interval includes the endpoint |
This function finds the sub-array of part_info->list_array where values of list_array[idx].list_value are contained within the specified interval. list_array is ordered by list_value, so
|
static |
uint32 get_next_partition_id_range | ( | PARTITION_ITERATOR * | part_iter | ) |
|
static |
|
static |
int get_part_for_delete | ( | const uchar * | buf, |
const uchar * | rec0, | ||
partition_info * | part_info, | ||
uint32 * | part_id | ||
) |
|
static |
|
static |
|
inlinestatic |
|
static |
|
static |
|
static |
|
inlinestatic |
Calculate part_id for (SUB)PARTITION BY KEY.
file | Handler to storage engine | |
field_array | Array of fields for PARTTION KEY | |
num_parts | Number of KEY partitions | |
[out] | func_value | Returns calculated hash value |
|
static |
|
inlinestatic |
|
static |
|
static |
Partitioning Interval Analysis: Initialize the iterator for "mapping" case.
part_info | Partition info |
is_subpart | true - act for subpartitioning false - act for partitioning |
store_length_array | Ignored. |
min_value | minimum field value, in opt_range key format. |
max_value | minimum field value, in opt_range key format. |
min_len | Ignored. |
max_len | Ignored. |
flags | Some combination of NEAR_MIN, NEAR_MAX, NO_MIN_RANGE, NO_MAX_RANGE. |
part_iter | Iterator structure to be initialized |
Initialize partition set iterator to walk over the interval in ordered-array-of-partitions (for RANGE partitioning) or ordered-array-of-list-constants (for LIST partitioning) space.
This function is used when partitioning is done by <RANGE|LIST>(ascending_func(t.field)), and we can map an interval in t.field space into a sub-array of partition_info::range_int_array or partition_info::list_array (see get_partition_id_range_for_endpoint, get_list_array_idx_for_endpoint for details).
The function performs this interval mapping, and sets the iterator to traverse the sub-array and return appropriate partitions.
0 | No matching partitions (iterator not initialized) |
1 | Ok, iterator initialized for traversal of matching partitions. |
-1 | All partitions would match (iterator not initialized) |
|
static |
|
static |
|
static |
Get partition for RANGE COLUMNS endpoint.
part_info | Partitioning metadata. |
is_left_endpoint | True if left endpoint (const <=/< cols) |
include_endpoint | True if range includes the endpoint (<=/>=) |
nparts | Total number of partitions |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void get_partition_set | ( | const TABLE * | table, |
uchar * | buf, | ||
const uint | index, | ||
const key_range * | key_spec, | ||
part_id_range * | part_spec | ||
) |
int get_parts_for_update | ( | const uchar * | old_data, |
const uchar * | new_data, | ||
const uchar * | rec0, | ||
partition_info * | part_info, | ||
uint32 * | old_part_id, | ||
uint32 * | new_part_id, | ||
longlong * | new_func_value | ||
) |
|
static |
|
static |
|
static |
Initialize lex object for use in fix_fields and parsing.
thd | The thread object |
table | The table object |
lex | The LEX object, must be initialized and contain query_block. |
This function is used to set up a lex object on the stack for resolving of fields from a single table.
A support function to check if a name is in a list of strings.
name | String searched for |
list_names | A list of names searched in |
true | String found |
false | String not found |
bool make_used_partitions_str | ( | partition_info * | part_info, |
List< const char > * | parts | ||
) |
Return comma-separated list of used partitions in the provided given string.
part_info | Partitioning info | |
[out] | parts | The resulting list of string to fill |
Generate a list of used partitions (from bits in part_info->read_partitions bitmap), and store it into the provided String object.
void mem_alloc_error | ( | size_t | size | ) |
bool mysql_unpack_partition | ( | THD * | thd, |
char * | part_buf, | ||
uint | part_info_len, | ||
TABLE * | table, | ||
bool | is_create_table_ind, | ||
handlerton * | default_db_type, | ||
bool * | work_part_info_used | ||
) |
|
static |
uint prep_alter_part_table | ( | THD * | thd, |
TABLE * | table, | ||
Alter_info * | alter_info, | ||
HA_CREATE_INFO * | create_info, | ||
Alter_table_ctx * | alter_ctx, | ||
bool * | partition_changed, | ||
partition_info ** | new_part_info | ||
) |
void prune_partition_set | ( | const TABLE * | table, |
part_id_range * | part_spec | ||
) |
void set_all_part_state | ( | partition_info * | tab_part_info, |
enum partition_state | part_state | ||
) |
Set part_state for all partitions to given state.
tab_part_info | partition_info holding all partitions. |
part_state | Which state to set for the named partitions. |
|
static |
|
static |
void set_linear_hash_mask | ( | partition_info * | part_info, |
uint | num_parts | ||
) |
bool set_part_state | ( | Alter_info * | alter_info, |
partition_info * | tab_part_info, | ||
enum partition_state | part_state, | ||
bool | include_subpartitions | ||
) |
Sets which partitions to be used in the command.
alter_info | Alter_info pointer holding partition names and flags. |
tab_part_info | partition_info holding all partitions. |
part_state | Which state to set for the named partitions. |
include_subpartitions | Also include subpartitions in the search. |
false | Success |
true | Failure |
|
static |
|
static |
Set up partition bitmaps.
part_info | Reference to partitioning data structure |
true | Memory allocation failure |
false | Success |
Allocate memory for bitmaps of the partitioned table and initialise it.
|
static |
|
static |
|
static |
|
static |
void truncate_partition_filename | ( | MEM_ROOT * | root, |
const char ** | path | ||
) |
Truncate the partition file name from a path if it exists.
A partition file name will contain one or more '#' characters. One of the occurrences of '#' will be either "#P#" or "#p#" depending on whether the storage engine has converted the filename to lower case. If we need to truncate the name, we will allocate a new string and replace with, in case the original string was owned by something else.
[in] | root | MEM_ROOT to allocate from. If NULL alter the string directly. |
[in,out] | path | Pointer to string to check and truncate. |
Verify that all rows in a table is in the given partition.
table | Table which contains the data that will be checked if it is matching the partition definition. |
part_table | Partitioned table containing the partition to check. |
part_id | Which partition to match with. |
true | Not all rows match the given partition |
false | OK |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
const LEX_CSTRING partition_keywords[] |
|
static |
|
static |