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