1#ifndef PARTITION_INFO_INCLUDED
2#define PARTITION_INFO_INCLUDED
47#define NOT_A_PARTITION_ID UINT_MAX32
165 uchar *min_val,
uchar *max_val, uint min_len, uint max_len, uint
flags,
494 bool check_partition_function);
513 bool copy_default_values,
MY_BITMAP *used_partitions);
528 bool *prune_needs_default_values,
566 const char *part_name);
Definition: sql_bitmap.h:144
This class encapsulates a data change operation.
Definition: sql_data_change.h:73
Create_field is a description a field/column that may or may not exists in a table.
Definition: create_field.h:50
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
Definition: sql_list.h:433
Definition: partition_info.h:179
partition_element *const current_partition
Definition: partition_info.h:182
uint curr_list_object
Definition: partition_info.h:185
part_elem_value * curr_list_val
Definition: partition_info.h:184
partition_info *const part_info
Definition: partition_info.h:181
bool add_column_list_value(THD *thd, Item *item)
Add a column value in VALUES LESS THAN or VALUES IN.
Definition: partition_info.cc:2055
bool init_column_part()
Initialize a new column for VALUES {LESS THAN|IN}.
Definition: partition_info.cc:2108
bool reorganize_into_single_field_col_val()
Reorganize the preallocated buffer into a single field col list.
Definition: partition_info.cc:2157
part_column_list_val * add_column_value()
Create a new column value in current list.
Definition: partition_info.cc:1976
Parser_partition_info(partition_info *const part_info, partition_element *const current_partition, partition_element *const curr_part_elem, part_elem_value *curr_list_val, uint curr_list_object)
Definition: partition_info.h:189
void init_col_val(part_column_list_val *col_val, Item *item)
Initialise part_elem_value object at setting of a new object.
Definition: partition_info.cc:2021
partition_element *const curr_part_elem
Definition: partition_info.h:183
uint count_curr_subparts
Definition: partition_info.h:186
bool add_max_value()
Create a new column value in current list with maxvalue.
Definition: partition_info.cc:1954
Class for partitioning specific operations.
Definition: partition_handler.h:193
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4460
std::unordered_set, but with my_malloc, so that you can track the memory used using PSI memory keys.
Definition: map_helpers.h:167
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:109
Definition: partition_element.h:107
Definition: partition_info.h:208
bool init_partition_bitmap(MY_BITMAP *bitmap, MEM_ROOT *mem_root)
Allocate memory for one partitions bitmap and initialize it.
Definition: partition_info.cc:2853
char * part_func_string
Partition expression as string.
Definition: partition_info.h:348
uint num_full_part_fields
Definition: partition_info.h:376
longlong err_value
Definition: partition_info.h:346
bool use_default_num_subpartitions
Definition: partition_info.h:393
uchar ** part_field_buffers
Definition: partition_info.h:284
uint num_parts
Definition: partition_info.h:369
bool set_used_partition(THD *thd, const mem_root_deque< Item * > &fields, const mem_root_deque< Item * > &values, COPY_INFO &info, bool copy_default_values, MY_BITMAP *used_partitions)
Mark the partition, the record belongs to, as used.
Definition: partition_info.cc:470
bool fix_partition_values(part_elem_value *val, partition_element *part_elem, uint part_id)
This function handles the case of function-based partitioning.
Definition: partition_info.cc:2202
LIST_PART_ENTRY * list_array
Definition: partition_info.h:323
Key_map all_fields_in_PF
Definition: partition_info.h:359
Field ** part_charset_field_array
Definition: partition_info.h:264
uint get_next_used_partition(uint part_id) const
Definition: partition_info.h:543
get_partitions_in_range_iter get_subpart_iter_for_interval
Definition: partition_info.h:340
bool is_partition_used(uint part_id) const
Definition: partition_info.h:531
size_t part_func_len
Definition: partition_info.h:366
get_part_id_func get_part_partition_id
Definition: partition_info.h:241
bool fix_parser_data(THD *thd)
Fix partition data from parser.
Definition: partition_info.cc:2388
bool check_partition_info(THD *thd, handlerton **eng_type, handler *file, HA_CREATE_INFO *info, bool check_partition_function)
Definition: partition_info.cc:1405
bool has_null_value
Definition: partition_info.h:401
MY_BITMAP full_part_field_set
Definition: partition_info.h:277
bool use_default_num_partitions
Definition: partition_info.h:390
get_part_id_func get_part_partition_id_charset
Definition: partition_info.h:258
Item * get_column_item(Item *item, Field *field)
Get column item with a proper character set according to the field.
Definition: partition_info.cc:2266
partition_type subpart_type
Definition: partition_info.h:364
bool is_pruning_completed
True if pruning has been completed and can not be pruned any further, even if there are subqueries or...
Definition: partition_info.h:411
Key_map some_fields_in_PF
Definition: partition_info.h:360
char * create_default_partition_names(uint num_parts, uint start_no)
Definition: partition_info.cc:545
uint num_partitions_used()
Definition: partition_info.h:537
bool use_default_partitions
Definition: partition_info.h:389
void report_part_expr_error(bool use_subpart_expr)
Check what kind of error to report.
Definition: partition_info.cc:1861
uint has_null_part_id
Definition: partition_info.h:378
partition_type part_type
Definition: partition_info.h:363
uint num_subparts
Definition: partition_info.h:370
Field ** subpart_charset_field_array
Definition: partition_info.h:265
List< char > part_field_list
Definition: partition_info.h:216
longlong * range_int_array
Definition: partition_info.h:322
List< partition_element > temp_partitions
Definition: partition_info.h:214
bool can_prune_insert(THD *thd, enum_duplicates duplic, COPY_INFO &update, const mem_root_deque< Item * > &update_fields, const mem_root_deque< Item * > &fields, bool empty_values, enum_can_prune *can_prune_partitions, bool *prune_needs_default_values, MY_BITMAP *used_partitions)
Checks if possible to do prune partitions on insert.
Definition: partition_info.cc:311
char * find_duplicate_field()
Definition: partition_info.cc:811
Field ** part_field_array
Definition: partition_info.h:262
bool set_up_defaults_for_partitioning(Partition_handler *part_handler, HA_CREATE_INFO *info, uint start_no)
Definition: partition_info.cc:782
bool is_full_part_expr_in_fields(const mem_root_deque< Item * > &fields)
Check if all partitioning fields are included.
Definition: partition_info.cc:1918
part_column_list_val * list_col_array
Definition: partition_info.h:325
uint num_subpart_fields
Definition: partition_info.h:375
bool bitmaps_are_initialized
Definition: partition_info.h:318
bool set_part_expr(char *start_token, Item *item_ptr, char *end_token, bool is_subpart)
Definition: partition_info.cc:1659
Item * subpart_expr
Definition: partition_info.h:290
uint num_list_values
Definition: partition_info.h:372
uchar ** restore_part_field_ptrs
Definition: partition_info.h:286
Key_map all_fields_in_PPF
Definition: partition_info.h:359
Field ** subpart_field_array
Definition: partition_info.h:263
bool set_partition_bitmaps(Table_ref *table_list)
Set read/lock_partitions bitmap over non pruned partitions.
Definition: partition_info.cc:262
Key_map all_fields_in_SPF
Definition: partition_info.h:359
uint get_first_used_partition() const
Definition: partition_info.h:540
MY_BITMAP lock_partitions
Definition: partition_info.h:317
bool add_named_partition(const char *part_name, size_t length)
Mark named [sub]partition to be used/locked.
Definition: partition_info.cc:168
bool set_up_default_partitions(Partition_handler *part_handler, HA_CREATE_INFO *info, uint start_no)
Definition: partition_info.cc:643
char * subpart_func_string
Subpartition expression as string.
Definition: partition_info.h:349
uchar ** subpart_field_buffers
Definition: partition_info.h:285
bool check_list_constants(THD *thd)
Definition: partition_info.cc:1241
bool fix_column_value_functions(THD *thd, part_elem_value *val, uint part_id)
Evaluate VALUES functions for column list values.
Definition: partition_info.cc:2291
bool set_read_partitions(List< String > *partition_names)
Prune away partitions not mentioned in the PARTITION () clause, if used.
Definition: partition_info.cc:221
uint get_tot_partitions() const
Definition: partition_info.h:481
bool list_of_subpart_fields
Definition: partition_info.h:397
bool is_sub_partitioned() const
Definition: partition_info.h:476
get_subpart_id_func get_subpartition_id_charset
Definition: partition_info.h:259
enum_can_prune
PRUNE_NO - Unable to prune.
Definition: partition_info.h:523
@ PRUNE_DEFAULTS
Definition: partition_info.h:523
@ PRUNE_NO
Definition: partition_info.h:523
@ PRUNE_YES
Definition: partition_info.h:523
partition_info()
Definition: partition_info.h:413
List< char > subpart_field_list
Definition: partition_info.h:217
bool default_partitions_setup
Definition: partition_info.h:394
void print_debug(const char *str, uint *)
Definition: partition_info.cc:2720
bool set_up_default_subpartitions(Partition_handler *part_handler, HA_CREATE_INFO *info)
Definition: partition_info.cc:720
bool check_range_constants(THD *thd)
Definition: partition_info.cc:1096
void print_no_partition_found(THD *thd, TABLE *table)
Definition: partition_info.cc:1619
char * create_default_subpartition_name(uint subpart_no, const char *part_name)
Definition: partition_info.cc:605
uint num_columns
Definition: partition_info.h:351
get_subpart_id_func get_subpartition_id
Definition: partition_info.h:250
bool check_partition_field_length()
Definition: partition_info.cc:1698
bool linear_hash_ind
Definition: partition_info.h:398
bool is_auto_partitioned
Definition: partition_info.h:400
bool fixed
Definition: partition_info.h:399
void set_show_version_string(String *packet)
Definition: partition_info.cc:573
bool list_of_part_fields
Definition: partition_info.h:396
uint num_part_fields
Definition: partition_info.h:374
MY_BITMAP read_partitions
Definition: partition_info.h:316
bool use_default_subpartitions
Definition: partition_info.h:392
Item * item_list
Definition: partition_info.h:292
uchar ** restore_subpart_field_ptrs
Definition: partition_info.h:287
get_part_id_func get_partition_id
Definition: partition_info.h:231
handlerton * default_engine_type
Definition: partition_info.h:362
part_column_list_val * range_col_array
Definition: partition_info.h:324
bool defined_max_value
Definition: partition_info.h:395
bool is_fields_in_part_expr(const mem_root_deque< Item * > &fields)
Check if fields are in the partitioning expression.
Definition: partition_info.cc:1902
bool is_partition_locked(uint part_id) const
Definition: partition_info.h:534
bool check_engine_mix(handlerton *engine_type, bool default_engine)
Definition: partition_info.cc:1016
partition_info * get_clone(THD *thd, bool reset=false)
Definition: partition_info.cc:77
List< partition_element > partitions
Definition: partition_info.h:213
bool set_named_partition_bitmap(const char *part_name, size_t length)
Mark named [sub]partition to be used/locked.
Definition: partition_info.cc:204
uint16 linear_hash_mask
Definition: partition_info.h:384
Field ** full_part_field_array
Definition: partition_info.h:270
size_t subpart_func_len
Definition: partition_info.h:367
static bool compare_column_values(const part_column_list_val *a, const part_column_list_val *b)
Definition: partition_info.cc:1214
bool same_key_column_order(List< Create_field > *create_list)
Check if the partitioning columns are in the same order as the given list.
Definition: partition_info.cc:2709
const char * find_duplicate_name()
Definition: partition_info.cc:897
Item * part_expr
Definition: partition_info.h:289
TABLE * table
Definition: partition_info.h:353
partition_element * get_part_elem(const char *partition_name, uint32 *part_id)
Get part_elem and part_id from partition name.
Definition: partition_info.cc:847
partition_info * get_full_clone(THD *thd)
Definition: partition_info.cc:146
bool column_list
Definition: partition_info.h:402
bool has_same_partitioning(partition_info *new_part_info)
Check if the new part_info has the same partitioning.
Definition: partition_info.cc:2494
get_partitions_in_range_iter get_part_iter_for_interval
Definition: partition_info.h:335
enum_key_algorithm key_algorithm
Definition: partition_info.h:386
bool set_up_charset_field_preps()
Definition: partition_info.cc:1729
static MEM_ROOT mem_root
Definition: client_plugin.cc:113
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
static int flags[50]
Definition: hp_test1.cc:39
static bool bitmap_is_set(const MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:94
uint bitmap_bits_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:415
uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit)
Get the next set bit.
Definition: my_bitmap.cc:461
uint bitmap_get_first_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:438
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
unsigned char uchar
Definition: my_inttypes.h:51
long long int longlong
Definition: my_inttypes.h:54
uint16_t uint16
Definition: my_inttypes.h:64
uint32_t uint32
Definition: my_inttypes.h:66
static uint update
Definition: myisamlog.cc:93
static char * default_engine
Definition: mysqlslap.cc:151
std::string HARNESS_EXPORT reset()
get 'reset attributes' ESC sequence.
Definition: vt100.cc:36
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1063
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
partition_type
An enum and a struct to handle partitioning and subpartitioning.
Definition: partition_element.h:32
bool validate_partition_tablespace_name_lengths(partition_info *part_info)
Check if all tablespace names specified for partitions have a valid length.
Definition: partition_info.cc:2786
enum_key_algorithm
PARTITION BY KEY ALGORITHM=N Which algorithm to use for hashing the fields.
Definition: partition_info.h:173
static void init_single_partition_iterator(uint32 part_id, PARTITION_ITERATOR *part_iter)
Definition: partition_info.h:577
bool check_partition_dirs(partition_info *part_info)
Definition: partition_info.cc:1817
uint32 get_next_partition_id_range(PARTITION_ITERATOR *part_iter)
Definition: sql_partition.cc:6021
bool validate_partition_tablespace_names(partition_info *part_info, const handlerton *default_engine)
Check if all tablespace names specified for partitions are valid.
Definition: partition_info.cc:2813
int(* get_subpart_id_func)(partition_info *part_info, uint32 *part_id)
Definition: partition_info.h:124
int(* get_part_id_func)(partition_info *part_info, uint32 *part_id, longlong *func_value)
Definition: partition_info.h:122
int(* get_partitions_in_range_iter)(partition_info *part_info, bool is_subpart, uint32 *store_length_array, uchar *min_val, uchar *max_val, uint min_len, uint max_len, uint flags, PARTITION_ITERATOR *part_iter)
Get an iterator for set of partitions that match given field-space interval.
Definition: partition_info.h:163
uint32(* partition_iter_func)(PARTITION_ITERATOR *part_iter)
A "Get next" function for partition iterator.
Definition: partition_info.h:73
bool fill_partition_tablespace_names(partition_info *part_info, Tablespace_hash_set *tablespace_set)
Fill the Tablespace_hash_set with the tablespace names used by the partitions on the table.
Definition: partition_info.cc:2758
static void init_all_partitions_iterator(partition_info *part_info, PARTITION_ITERATOR *part_iter)
Definition: partition_info.h:586
bool has_external_data_or_index_dir(partition_info &pi)
Predicate which returns true if any partition or subpartition uses an external data directory or exte...
Definition: partition_info.cc:2729
Contains classes representing SQL-data change statements.
enum_duplicates
Definition: sql_data_change.h:47
Struct to hold information about the table that should be created.
Definition: handler.h:3091
Definition: partition_info.h:116
uint32 partition_id
Definition: partition_info.h:118
longlong list_value
Definition: partition_info.h:117
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
Definition: my_bitmap.h:42
Definition: partition_info.h:103
ulonglong end
Definition: partition_info.h:106
ulonglong cur
Definition: partition_info.h:105
ulonglong start
Definition: partition_info.h:104
Definition: partition_info.h:97
uint32 end
Definition: partition_info.h:100
uint32 start
Definition: partition_info.h:98
uint32 cur
Definition: partition_info.h:99
Partition set iterator.
Definition: partition_info.h:90
bool ret_null_part
Definition: partition_info.h:96
struct st_field_value_range field_vals
Definition: partition_info.h:111
bool ret_null_part_orig
Definition: partition_info.h:96
partition_info * part_info
Definition: partition_info.h:113
struct st_part_num_range part_nums
Definition: partition_info.h:110
partition_iter_func get_next
Definition: partition_info.h:91
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2661
Definition: partition_element.h:64
Definition: partition_element.h:99