MySQL 8.4.2
Source Code Documentation
partition_info.h
Go to the documentation of this file.
1#ifndef PARTITION_INFO_INCLUDED
2#define PARTITION_INFO_INCLUDED
3
4/* Copyright (c) 2006, 2024, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27#include <stddef.h>
28#include <sys/types.h>
29
30#include "my_bitmap.h"
31#include "my_inttypes.h"
32#include "sql/lock.h" // Tablespace_hash_set
34#include "sql/sql_bitmap.h" // Bitmap
35#include "sql/sql_data_change.h" // enum_duplicates
36#include "sql/sql_list.h"
37
38class Field;
39class Item;
41class String;
42class THD;
43class handler;
44struct HA_CREATE_INFO;
45struct TABLE;
46struct handlerton;
47
48#define NOT_A_PARTITION_ID UINT_MAX32
49
50class Create_field;
51class partition_info;
53class Table_ref;
54
55/**
56 A "Get next" function for partition iterator.
57
58
59 Depending on whether partitions or sub-partitions are iterated, the
60 function returns next subpartition id/partition number. The sequence of
61 returned numbers is not ordered and may contain duplicates.
62
63 When the end of sequence is reached, NOT_A_PARTITION_ID is returned, and
64 the iterator resets itself (so next get_next() call will start to
65 enumerate the set all over again).
66
67 @param[in,out] part_iter Partition iterator, you call only
68 "iter.get_next(&iter)"
69
70 @return Partition id
71 @retval NOT_A_PARTITION_ID if there are no more partitions.
72 @retval [sub]partition_id of the next partition
73*/
75
76/**
77 Partition set iterator. Used to enumerate a set of [sub]partitions
78 obtained in partition interval analysis (see get_partitions_in_range_iter).
79
80 For the user, the only meaningful field is get_next, which may be used as
81 follows:
82 part_iterator.get_next(&part_iterator);
83
84 Initialization is done by any of the following calls:
85 - get_partitions_in_range_iter-type function call
86 - init_single_partition_iterator()
87 - init_all_partitions_iterator()
88 Cleanup is not needed.
89*/
90
93 /*
94 Valid for "Interval mapping" in LIST partitioning: if true, let the
95 iterator also produce id of the partition that contains NULL value.
96 */
102 };
103
108 };
109
110 union {
113 };
115};
116
117typedef struct {
121
122/* Some function typedefs */
123typedef int (*get_part_id_func)(partition_info *part_info, uint32 *part_id,
124 longlong *func_value);
125typedef int (*get_subpart_id_func)(partition_info *part_info, uint32 *part_id);
126
127/**
128 Get an iterator for set of partitions that match given field-space interval.
129
130 Functions with this signature are used to perform "Partitioning Interval
131 Analysis". This analysis is applicable for any type of [sub]partitioning
132 by some function of a single fieldX. The idea is as follows:
133 Given an interval "const1 <=? fieldX <=? const2", find a set of partitions
134 that may contain records with value of fieldX within the given interval.
135
136 The min_val, max_val and flags parameters specify the interval.
137 The set of partitions is returned by initializing an iterator in *part_iter
138
139 @note
140 There are currently three functions of this type:
141 - get_part_iter_for_interval_via_walking
142 - get_part_iter_for_interval_cols_via_map
143 - get_part_iter_for_interval_via_mapping
144
145 @param part_info Partitioning info
146 @param is_subpart When true, act for sub partitions. When false, act
147 for partitions.
148 @param store_length_array Length of fields packed in opt_range_key format
149 @param min_val Left edge, field value in opt_range_key format
150 @param max_val Right edge, field value in opt_range_key format
151 @param min_len Length of minimum value
152 @param max_len Length of maximum value
153 @param flags Some combination of NEAR_MIN, NEAR_MAX,
154 NO_MIN_RANGE, NO_MAX_RANGE
155 @param part_iter Iterator structure to be initialized
156
157 @return Operation status
158 @retval 0 No matching partitions, iterator not initialized
159 @retval 1 Some partitions would match, iterator initialized for traversing
160 them
161 @retval -1 All partitions would match, iterator not initialized
162*/
163
165 partition_info *part_info, bool is_subpart, uint32 *store_length_array,
166 uchar *min_val, uchar *max_val, uint min_len, uint max_len, uint flags,
167 PARTITION_ITERATOR *part_iter);
168/**
169 PARTITION BY KEY ALGORITHM=N
170 Which algorithm to use for hashing the fields.
171 N = 1 - Use 5.1 hashing (numeric fields are hashed as binary)
172 N = 2 - Use 5.5 hashing (numeric fields are hashed like latin1 bytes)
173*/
178};
179
181 public:
184 partition_element *const curr_part_elem; // part or sub part
188
189 public:
200
201 void init_col_val(part_column_list_val *col_val, Item *item);
203 bool add_max_value();
205 bool init_column_part();
206 bool add_column_list_value(THD *thd, Item *item);
207};
208
210 public:
211 /*
212 * Here comes a set of definitions needed for partitioned table handlers.
213 */
216
219
220 /*
221 If there is no subpartitioning, use only this func to get partition ids.
222
223 If there is subpartitioning use this to get the partition_id which will
224 consider the subpartition as well. See the below example
225
226 A table with 3 partition and 0 subpartition then the return value will
227 lie in the range of [0, 2]
228
229 A table with 3 partition and 3 subpartition then the return value will
230 lie in the range of [0, 8(no of partition X no of sub_partition -1)].
231 */
233
234 /* Get partition id when we don't have subpartitioning
235 OR
236 Have both partition and subpartition fields but we don't want to consider
237 the subpartitions.
238 For example:
239 A table with 3 partition and 3 subpartition then the return value will
240 lie in the range of [0, 2].
241 */
243
244 /*
245 Get subpartition id when we have don't have partition fields by we do
246 have subpartition ids.
247 Mikael said that for given constant tuple
248 {subpart_field1, ..., subpart_fieldN} the subpartition id will be the
249 same in all subpartitions
250 */
252
253 /*
254 When we have various string fields we might need some preparation
255 before and clean-up after calling the get_part_id_func's. We need
256 one such method for get_part_partition_id and one for
257 get_subpartition_id.
258 */
261
262 /* NULL-terminated array of fields used in partitioned expression */
267 /*
268 Array of all fields used in partition and subpartition expression,
269 without duplicates, NULL-terminated.
270 */
272 /*
273 Set of all fields used in partition and subpartition expression.
274 Required for testing of partition fields in write_set when
275 updating. We need to set all bits in read_set because the row may
276 need to be inserted in a different [sub]partition.
277 */
279
280 /*
281 When we have a field that requires transformation before calling the
282 partition functions we must allocate field buffers for the field of
283 the fields in the partition function.
284 */
289
292
294
295 /*
296 Bitmaps of partitions used by the current query.
297 * read_partitions - partitions to be used for reading.
298 * lock_partitions - partitions that must be locked (read or write).
299 Usually read_partitions is the same set as lock_partitions, but
300 in case of UPDATE the WHERE clause can limit the read_partitions set,
301 but not necessarily the lock_partitions set.
302 Usage pattern:
303 * Initialized in ha_partition::open().
304 * read+lock_partitions is set according to explicit PARTITION,
305 WL#5217, in open_and_lock_tables().
306 * Bits in read_partitions can be cleared in prune_partitions()
307 in the optimizing step.
308 (WL#4443 is about allowing prune_partitions() to affect lock_partitions
309 and be done before locking too).
310 * When the partition enabled handler get an external_lock call it locks
311 all partitions in lock_partitions (and remembers which partitions it
312 locked, so that it can unlock them later). In case of LOCK TABLES it will
313 lock all partitions, and keep them locked while lock_partitions can
314 change for each statement under LOCK TABLES.
315 * Freed at the same time item_list is freed.
316 */
320 // TODO: Add first_read_partition and num_read_partitions?
321
322 union {
327 };
328
329 /********************************************
330 * INTERVAL ANALYSIS
331 ********************************************/
332 /*
333 Partitioning interval analysis function for partitioning, or NULL if
334 interval analysis is not supported for this kind of partitioning.
335 */
337 /*
338 Partitioning interval analysis function for subpartitioning, or NULL if
339 interval analysis is not supported for this kind of partitioning.
340 */
342
343 /********************************************
344 * INTERVAL ANALYSIS ENDS
345 ********************************************/
346
348
349 char *part_func_string; //!< Partition expression as string
350 char *subpart_func_string; //!< Subpartition expression as string
351
353
355 /*
356 These Key_maps are used for Partitioning to enable quick decisions
357 on whether we can derive more information about which partition to
358 scan just by looking at what index is used.
359 */
362
366
369
372
374
378
380 /*
381 This variable is used to calculate the partition id when using
382 LINEAR KEY/HASH. This functionality is kept in the MySQL Server
383 but mainly of use to handlers supporting partitioning.
384 */
386
388
389 /* Only the number of partitions defined (uses default names and options). */
392 /* Only the number of subpartitions defined (uses default names etc.). */
397 bool list_of_part_fields; // KEY or COLUMNS PARTITIONING
398 bool list_of_subpart_fields; // KEY SUBPARTITIONING
399 bool linear_hash_ind; // LINEAR HASH/KEY
400 bool fixed;
403 bool column_list; // COLUMNS PARTITIONING, 5.5+
404 /**
405 True if pruning has been completed and can not be pruned any further,
406 even if there are subqueries or stored programs in the condition.
407
408 Some times it is needed to run prune_partitions() a second time to prune
409 read partitions after tables are locked, when subquery and
410 stored functions might have been evaluated.
411 */
413
432 err_value(0),
435 num_columns(0),
436 table(nullptr),
440 part_func_len(0),
442 num_parts(0),
443 num_subparts(0),
456 defined_max_value(false),
457 list_of_part_fields(false),
459 linear_hash_ind(false),
460 fixed(false),
461 is_auto_partitioned(false),
462 has_null_value(false),
463 column_list(false),
464 is_pruning_completed(false) {
465 partitions.clear();
466 temp_partitions.clear();
467 part_field_list.clear();
468 subpart_field_list.clear();
469 }
470
471 partition_info *get_clone(THD *thd, bool reset = false);
473 bool set_named_partition_bitmap(const char *part_name, size_t length);
474 bool set_partition_bitmaps(Table_ref *table_list);
475 bool set_read_partitions(List<String> *partition_names);
476 /* Answers the question if subpartitioning is used for a certain table */
477 inline bool is_sub_partitioned() const {
479 }
480
481 /* Returns the total number of partitions on the leaf level */
482 inline uint get_tot_partitions() const {
483 return num_parts * (is_sub_partitioned() ? num_subparts : 1);
484 }
485
487 HA_CREATE_INFO *info, uint start_no);
488 char *find_duplicate_field();
489 const char *find_duplicate_name();
490 bool check_engine_mix(handlerton *engine_type, bool default_engine);
491 bool check_range_constants(THD *thd);
492 bool check_list_constants(THD *thd);
493 bool check_partition_info(THD *thd, handlerton **eng_type, handler *file,
494 HA_CREATE_INFO *info,
495 bool check_partition_function);
497 void print_debug(const char *str, uint *);
498 Item *get_column_item(Item *item, Field *field);
500 uint part_id);
501 bool fix_column_value_functions(THD *thd, part_elem_value *val, uint part_id);
502 bool fix_parser_data(THD *thd);
503 bool set_part_expr(char *start_token, Item *item_ptr, char *end_token,
504 bool is_subpart);
505 static bool compare_column_values(const part_column_list_val *a,
506 const part_column_list_val *b);
509 void set_show_version_string(String *packet);
510 partition_element *get_part_elem(const char *partition_name, uint32 *part_id);
511 void report_part_expr_error(bool use_subpart_expr);
512 bool set_used_partition(THD *thd, const mem_root_deque<Item *> &fields,
513 const mem_root_deque<Item *> &values, COPY_INFO &info,
514 bool copy_default_values, MY_BITMAP *used_partitions);
515 /**
516 PRUNE_NO - Unable to prune.
517 PRUNE_DEFAULTS - Partitioning field is only set to
518 DEFAULT values, only need to check
519 pruning for one row where the DEFAULTS
520 values are set.
521 PRUNE_YES - Pruning is possible, calculate the used partition set
522 by evaluate the partition_id on row by row basis.
523 */
526 const mem_root_deque<Item *> &update_fields,
527 const mem_root_deque<Item *> &fields, bool empty_values,
528 enum_can_prune *can_prune_partitions,
529 bool *prune_needs_default_values,
530 MY_BITMAP *used_partitions);
531 bool has_same_partitioning(partition_info *new_part_info);
532 inline bool is_partition_used(uint part_id) const {
533 return bitmap_is_set(&read_partitions, part_id);
534 }
535 inline bool is_partition_locked(uint part_id) const {
536 return bitmap_is_set(&lock_partitions, part_id);
537 }
538 inline uint num_partitions_used() {
540 }
541 inline uint get_first_used_partition() const {
543 }
544 inline uint get_next_used_partition(uint part_id) const {
545 return bitmap_get_next_set(&read_partitions, part_id);
546 }
547 bool same_key_column_order(List<Create_field> *create_list);
548
549 /**
550 Allocate memory for one partitions bitmap and initialize it.
551
552 @param bitmap Bitmap instance to initialize.
553 @param mem_root Memory root to use for bitmap buffer allocation.
554
555 @retval true Memory allocation failure
556 @retval false Success
557 */
559
560 private:
562 HA_CREATE_INFO *info, uint start_no);
564 HA_CREATE_INFO *info);
565 char *create_default_partition_names(uint num_parts, uint start_no);
566 char *create_default_subpartition_name(uint subpart_no,
567 const char *part_name);
568 bool add_named_partition(const char *part_name, size_t length);
571};
572
574bool check_partition_dirs(partition_info *part_info);
575
576/* Initialize the iterator to return a single partition with given part_id */
577
579 uint32 part_id, PARTITION_ITERATOR *part_iter) {
580 part_iter->part_nums.start = part_iter->part_nums.cur = part_id;
581 part_iter->part_nums.end = part_id + 1;
582 part_iter->ret_null_part = part_iter->ret_null_part_orig = false;
584}
585
586/* Initialize the iterator to enumerate all partitions */
587static inline void init_all_partitions_iterator(partition_info *part_info,
588 PARTITION_ITERATOR *part_iter) {
589 part_iter->part_nums.start = part_iter->part_nums.cur = 0;
590 part_iter->part_nums.end = part_info->num_parts;
591 part_iter->ret_null_part = part_iter->ret_null_part_orig = false;
593}
594
596 Tablespace_hash_set *tablespace_set);
597
598/**
599 Check if all tablespace names specified for partitions have a valid length.
600
601 @param part_info Partition info that could be using tablespaces.
602
603 @return true One of the tablespace names specified has invalid length
604 and an error is reported.
605 @return false All the tablespace names specified for partitions have
606 a valid length.
607*/
608
610
611/**
612 Check if all tablespace names specified for partitions are valid.
613
614 Do the validation by invoking the SE specific validation function.
615
616 @param part_info Partition info that could be using tablespaces.
617 @param default_engine Table level engine.
618
619 @return true One of the tablespace names specified is invalid
620 and an error is reported.
621 @return false All the tablespace names specified for
622 partitions are valid.
623*/
624
627
628/**
629 Predicate which returns true if any partition or subpartition uses
630 an external data directory or external index directory.
631
632 @param pi partitioning information
633 @retval true if any partition or subpartition has an external
634 data directory or external index directory.
635 @retval false otherwise
636 */
638
639#endif /* PARTITION_INFO_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
Definition: sql_bitmap.h:154
This class encapsulates a data change operation.
Definition: sql_data_change.h:74
Create_field is a description a field/column that may or may not exists in a table.
Definition: create_field.h:51
Definition: field.h:575
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:936
Definition: sql_list.h:467
Definition: partition_info.h:180
partition_element *const current_partition
Definition: partition_info.h:183
uint curr_list_object
Definition: partition_info.h:186
part_elem_value * curr_list_val
Definition: partition_info.h:185
partition_info *const part_info
Definition: partition_info.h:182
bool add_column_list_value(THD *thd, Item *item)
Add a column value in VALUES LESS THAN or VALUES IN.
Definition: partition_info.cc:2064
bool init_column_part()
Initialize a new column for VALUES {LESS THAN|IN}.
Definition: partition_info.cc:2117
bool reorganize_into_single_field_col_val()
Reorganize the preallocated buffer into a single field col list.
Definition: partition_info.cc:2166
part_column_list_val * add_column_value()
Create a new column value in current list.
Definition: partition_info.cc:1985
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:190
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:2030
partition_element *const curr_part_elem
Definition: partition_info.h:184
uint count_curr_subparts
Definition: partition_info.h:187
bool add_max_value()
Create a new column value in current list with maxvalue.
Definition: partition_info.cc:1963
Class for partitioning specific operations.
Definition: partition_handler.h:194
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: table.h:2864
The handler class is the interface for dynamically loadable storage engines.
Definition: handler.h:4573
std::unordered_set, but with my_malloc, so that you can track the memory used using PSI memory keys.
Definition: map_helpers.h:177
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
Definition: partition_element.h:108
Definition: partition_info.h:209
bool init_partition_bitmap(MY_BITMAP *bitmap, MEM_ROOT *mem_root)
Allocate memory for one partitions bitmap and initialize it.
Definition: partition_info.cc:2862
char * part_func_string
Partition expression as string.
Definition: partition_info.h:349
uint num_full_part_fields
Definition: partition_info.h:377
longlong err_value
Definition: partition_info.h:347
bool use_default_num_subpartitions
Definition: partition_info.h:394
uchar ** part_field_buffers
Definition: partition_info.h:285
uint num_parts
Definition: partition_info.h:370
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:471
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:2211
LIST_PART_ENTRY * list_array
Definition: partition_info.h:324
Key_map all_fields_in_PF
Definition: partition_info.h:360
Field ** part_charset_field_array
Definition: partition_info.h:265
uint get_next_used_partition(uint part_id) const
Definition: partition_info.h:544
get_partitions_in_range_iter get_subpart_iter_for_interval
Definition: partition_info.h:341
bool is_partition_used(uint part_id) const
Definition: partition_info.h:532
size_t part_func_len
Definition: partition_info.h:367
get_part_id_func get_part_partition_id
Definition: partition_info.h:242
bool fix_parser_data(THD *thd)
Fix partition data from parser.
Definition: partition_info.cc:2397
bool check_partition_info(THD *thd, handlerton **eng_type, handler *file, HA_CREATE_INFO *info, bool check_partition_function)
Definition: partition_info.cc:1414
bool has_null_value
Definition: partition_info.h:402
MY_BITMAP full_part_field_set
Definition: partition_info.h:278
bool use_default_num_partitions
Definition: partition_info.h:391
get_part_id_func get_part_partition_id_charset
Definition: partition_info.h:259
Item * get_column_item(Item *item, Field *field)
Get column item with a proper character set according to the field.
Definition: partition_info.cc:2275
partition_type subpart_type
Definition: partition_info.h:365
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:412
Key_map some_fields_in_PF
Definition: partition_info.h:361
char * create_default_partition_names(uint num_parts, uint start_no)
Definition: partition_info.cc:546
uint num_partitions_used()
Definition: partition_info.h:538
bool use_default_partitions
Definition: partition_info.h:390
void report_part_expr_error(bool use_subpart_expr)
Check what kind of error to report.
Definition: partition_info.cc:1870
uint has_null_part_id
Definition: partition_info.h:379
partition_type part_type
Definition: partition_info.h:364
uint num_subparts
Definition: partition_info.h:371
Field ** subpart_charset_field_array
Definition: partition_info.h:266
List< char > part_field_list
Definition: partition_info.h:217
longlong * range_int_array
Definition: partition_info.h:323
List< partition_element > temp_partitions
Definition: partition_info.h:215
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:312
char * find_duplicate_field()
Definition: partition_info.cc:812
Field ** part_field_array
Definition: partition_info.h:263
bool set_up_defaults_for_partitioning(Partition_handler *part_handler, HA_CREATE_INFO *info, uint start_no)
Definition: partition_info.cc:783
bool is_full_part_expr_in_fields(const mem_root_deque< Item * > &fields)
Check if all partitioning fields are included.
Definition: partition_info.cc:1927
part_column_list_val * list_col_array
Definition: partition_info.h:326
uint num_subpart_fields
Definition: partition_info.h:376
bool bitmaps_are_initialized
Definition: partition_info.h:319
bool set_part_expr(char *start_token, Item *item_ptr, char *end_token, bool is_subpart)
Definition: partition_info.cc:1668
Item * subpart_expr
Definition: partition_info.h:291
uint num_list_values
Definition: partition_info.h:373
uchar ** restore_part_field_ptrs
Definition: partition_info.h:287
Key_map all_fields_in_PPF
Definition: partition_info.h:360
Field ** subpart_field_array
Definition: partition_info.h:264
bool set_partition_bitmaps(Table_ref *table_list)
Set read/lock_partitions bitmap over non pruned partitions.
Definition: partition_info.cc:263
Key_map all_fields_in_SPF
Definition: partition_info.h:360
uint get_first_used_partition() const
Definition: partition_info.h:541
MY_BITMAP lock_partitions
Definition: partition_info.h:318
bool add_named_partition(const char *part_name, size_t length)
Mark named [sub]partition to be used/locked.
Definition: partition_info.cc:169
bool set_up_default_partitions(Partition_handler *part_handler, HA_CREATE_INFO *info, uint start_no)
Definition: partition_info.cc:644
char * subpart_func_string
Subpartition expression as string.
Definition: partition_info.h:350
uchar ** subpart_field_buffers
Definition: partition_info.h:286
bool check_list_constants(THD *thd)
Definition: partition_info.cc:1247
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:2300
bool set_read_partitions(List< String > *partition_names)
Prune away partitions not mentioned in the PARTITION () clause, if used.
Definition: partition_info.cc:222
uint get_tot_partitions() const
Definition: partition_info.h:482
bool list_of_subpart_fields
Definition: partition_info.h:398
bool is_sub_partitioned() const
Definition: partition_info.h:477
get_subpart_id_func get_subpartition_id_charset
Definition: partition_info.h:260
enum_can_prune
PRUNE_NO - Unable to prune.
Definition: partition_info.h:524
@ PRUNE_DEFAULTS
Definition: partition_info.h:524
@ PRUNE_NO
Definition: partition_info.h:524
@ PRUNE_YES
Definition: partition_info.h:524
partition_info()
Definition: partition_info.h:414
List< char > subpart_field_list
Definition: partition_info.h:218
bool default_partitions_setup
Definition: partition_info.h:395
void print_debug(const char *str, uint *)
Definition: partition_info.cc:2729
bool set_up_default_subpartitions(Partition_handler *part_handler, HA_CREATE_INFO *info)
Definition: partition_info.cc:721
bool check_range_constants(THD *thd)
Definition: partition_info.cc:1097
void print_no_partition_found(THD *thd, TABLE *table)
Definition: partition_info.cc:1628
char * create_default_subpartition_name(uint subpart_no, const char *part_name)
Definition: partition_info.cc:606
uint num_columns
Definition: partition_info.h:352
get_subpart_id_func get_subpartition_id
Definition: partition_info.h:251
bool check_partition_field_length()
Definition: partition_info.cc:1707
bool linear_hash_ind
Definition: partition_info.h:399
bool is_auto_partitioned
Definition: partition_info.h:401
bool fixed
Definition: partition_info.h:400
void set_show_version_string(String *packet)
Definition: partition_info.cc:574
bool list_of_part_fields
Definition: partition_info.h:397
uint num_part_fields
Definition: partition_info.h:375
MY_BITMAP read_partitions
Definition: partition_info.h:317
bool use_default_subpartitions
Definition: partition_info.h:393
Item * item_list
Definition: partition_info.h:293
uchar ** restore_subpart_field_ptrs
Definition: partition_info.h:288
get_part_id_func get_partition_id
Definition: partition_info.h:232
handlerton * default_engine_type
Definition: partition_info.h:363
part_column_list_val * range_col_array
Definition: partition_info.h:325
bool defined_max_value
Definition: partition_info.h:396
bool is_fields_in_part_expr(const mem_root_deque< Item * > &fields)
Check if fields are in the partitioning expression.
Definition: partition_info.cc:1911
bool is_partition_locked(uint part_id) const
Definition: partition_info.h:535
bool check_engine_mix(handlerton *engine_type, bool default_engine)
Definition: partition_info.cc:1017
partition_info * get_clone(THD *thd, bool reset=false)
Definition: partition_info.cc:78
List< partition_element > partitions
Definition: partition_info.h:214
bool set_named_partition_bitmap(const char *part_name, size_t length)
Mark named [sub]partition to be used/locked.
Definition: partition_info.cc:205
uint16 linear_hash_mask
Definition: partition_info.h:385
Field ** full_part_field_array
Definition: partition_info.h:271
size_t subpart_func_len
Definition: partition_info.h:368
static bool compare_column_values(const part_column_list_val *a, const part_column_list_val *b)
Definition: partition_info.cc:1220
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:2718
const char * find_duplicate_name()
Definition: partition_info.cc:898
Item * part_expr
Definition: partition_info.h:290
TABLE * table
Definition: partition_info.h:354
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:848
partition_info * get_full_clone(THD *thd)
Definition: partition_info.cc:147
bool column_list
Definition: partition_info.h:403
bool has_same_partitioning(partition_info *new_part_info)
Check if the new part_info has the same partitioning.
Definition: partition_info.cc:2503
get_partitions_in_range_iter get_part_iter_for_interval
Definition: partition_info.h:336
enum_key_algorithm key_algorithm
Definition: partition_info.h:387
bool set_up_charset_field_preps()
Definition: partition_info.cc:1738
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
static int flags[50]
Definition: hp_test1.cc:40
static bool bitmap_is_set(const MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:95
uint bitmap_bits_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:416
uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit)
Get the next set bit.
Definition: my_bitmap.cc:462
uint bitmap_get_first_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:439
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
uint16_t uint16
Definition: my_inttypes.h:65
uint32_t uint32
Definition: my_inttypes.h:67
static uint update
Definition: myisamlog.cc:94
static char * default_engine
Definition: mysqlslap.cc:152
std::string HARNESS_EXPORT reset()
get 'reset attributes' ESC sequence.
Definition: vt100.cc:37
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
Definition: os0file.h:89
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:76
partition_type
An enum and a struct to handle partitioning and subpartitioning.
Definition: partition_element.h:33
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:2795
enum_key_algorithm
PARTITION BY KEY ALGORITHM=N Which algorithm to use for hashing the fields.
Definition: partition_info.h:174
static void init_single_partition_iterator(uint32 part_id, PARTITION_ITERATOR *part_iter)
Definition: partition_info.h:578
bool check_partition_dirs(partition_info *part_info)
Definition: partition_info.cc:1826
uint32 get_next_partition_id_range(PARTITION_ITERATOR *part_iter)
Definition: sql_partition.cc:6022
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:2822
int(* get_subpart_id_func)(partition_info *part_info, uint32 *part_id)
Definition: partition_info.h:125
int(* get_part_id_func)(partition_info *part_info, uint32 *part_id, longlong *func_value)
Definition: partition_info.h:123
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:164
uint32(* partition_iter_func)(PARTITION_ITERATOR *part_iter)
A "Get next" function for partition iterator.
Definition: partition_info.h:74
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:2767
static void init_all_partitions_iterator(partition_info *part_info, PARTITION_ITERATOR *part_iter)
Definition: partition_info.h:587
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:2738
Contains classes representing SQL-data change statements.
enum_duplicates
Definition: sql_data_change.h:48
Struct to hold information about the table that should be created.
Definition: handler.h:3202
Definition: partition_info.h:117
uint32 partition_id
Definition: partition_info.h:119
longlong list_value
Definition: partition_info.h:118
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: my_bitmap.h:43
Definition: partition_info.h:104
ulonglong end
Definition: partition_info.h:107
ulonglong cur
Definition: partition_info.h:106
ulonglong start
Definition: partition_info.h:105
Definition: partition_info.h:98
uint32 end
Definition: partition_info.h:101
uint32 start
Definition: partition_info.h:99
uint32 cur
Definition: partition_info.h:100
Partition set iterator.
Definition: partition_info.h:91
bool ret_null_part
Definition: partition_info.h:97
struct st_field_value_range field_vals
Definition: partition_info.h:112
bool ret_null_part_orig
Definition: partition_info.h:97
partition_info * part_info
Definition: partition_info.h:114
struct st_part_num_range part_nums
Definition: partition_info.h:111
partition_iter_func get_next
Definition: partition_info.h:92
Definition: table.h:1406
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2734
Definition: partition_element.h:65
Definition: partition_element.h:100