MySQL 9.1.0
Source Code Documentation
partition_info.h File Reference
#include <stddef.h>
#include <sys/types.h>
#include "my_bitmap.h"
#include "my_inttypes.h"
#include "sql/lock.h"
#include "sql/partition_element.h"
#include "sql/sql_bitmap.h"
#include "sql/sql_data_change.h"
#include "sql/sql_list.h"

Go to the source code of this file.

Classes

struct  PARTITION_ITERATOR
 Partition set iterator. More...
 
struct  PARTITION_ITERATOR::st_part_num_range
 
struct  PARTITION_ITERATOR::st_field_value_range
 
struct  LIST_PART_ENTRY
 
class  Parser_partition_info
 
class  partition_info
 

Macros

#define NOT_A_PARTITION_ID   UINT_MAX32
 

Typedefs

typedef uint32(* partition_iter_func) (PARTITION_ITERATOR *part_iter)
 A "Get next" function for partition iterator. More...
 
typedef int(* get_part_id_func) (partition_info *part_info, uint32 *part_id, longlong *func_value)
 
typedef int(* get_subpart_id_func) (partition_info *part_info, uint32 *part_id)
 
typedef 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. More...
 

Enumerations

enum class  enum_key_algorithm { KEY_ALGORITHM_NONE = 0 , KEY_ALGORITHM_51 = 1 , KEY_ALGORITHM_55 = 2 }
 PARTITION BY KEY ALGORITHM=N Which algorithm to use for hashing the fields. More...
 

Functions

uint32 get_next_partition_id_range (PARTITION_ITERATOR *part_iter)
 
bool check_partition_dirs (partition_info *part_info)
 
static void init_single_partition_iterator (uint32 part_id, PARTITION_ITERATOR *part_iter)
 
static void init_all_partitions_iterator (partition_info *part_info, PARTITION_ITERATOR *part_iter)
 
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. More...
 
bool validate_partition_tablespace_name_lengths (partition_info *part_info)
 Check if all tablespace names specified for partitions have a valid length. More...
 
bool validate_partition_tablespace_names (partition_info *part_info, const handlerton *default_engine)
 Check if all tablespace names specified for partitions are valid. More...
 
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 external index directory. More...
 

Macro Definition Documentation

◆ NOT_A_PARTITION_ID

#define NOT_A_PARTITION_ID   UINT_MAX32

Typedef Documentation

◆ get_part_id_func

typedef int(* get_part_id_func) (partition_info *part_info, uint32 *part_id, longlong *func_value)

◆ get_partitions_in_range_iter

typedef 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.

Functions with this signature are used to perform "Partitioning Interval Analysis". This analysis is applicable for any type of [sub]partitioning by some function of a single fieldX. The idea is as follows: Given an interval "const1 <=? fieldX <=? const2", find a set of partitions that may contain records with value of fieldX within the given interval.

The min_val, max_val and flags parameters specify the interval. The set of partitions is returned by initializing an iterator in *part_iter

Note
There are currently three functions of this type:
  • get_part_iter_for_interval_via_walking
  • get_part_iter_for_interval_cols_via_map
  • get_part_iter_for_interval_via_mapping
Parameters
part_infoPartitioning info
is_subpartWhen true, act for sub partitions. When false, act for partitions.
store_length_arrayLength of fields packed in opt_range_key format
min_valLeft edge, field value in opt_range_key format
max_valRight edge, field value in opt_range_key format
min_lenLength of minimum value
max_lenLength of maximum value
flagsSome combination of NEAR_MIN, NEAR_MAX, NO_MIN_RANGE, NO_MAX_RANGE
part_iterIterator structure to be initialized
Returns
Operation status
Return values
0No matching partitions, iterator not initialized
1Some partitions would match, iterator initialized for traversing them
-1All partitions would match, iterator not initialized

◆ get_subpart_id_func

typedef int(* get_subpart_id_func) (partition_info *part_info, uint32 *part_id)

◆ partition_iter_func

typedef uint32(* partition_iter_func) (PARTITION_ITERATOR *part_iter)

A "Get next" function for partition iterator.

Depending on whether partitions or sub-partitions are iterated, the function returns next subpartition id/partition number. The sequence of returned numbers is not ordered and may contain duplicates.

When the end of sequence is reached, NOT_A_PARTITION_ID is returned, and the iterator resets itself (so next get_next() call will start to enumerate the set all over again).

Parameters
[in,out]part_iterPartition iterator, you call only "iter.get_next(&iter)"
Returns
Partition id
Return values
NOT_A_PARTITION_IDif there are no more partitions.
[sub]partition_idof the next partition

Enumeration Type Documentation

◆ enum_key_algorithm

enum class enum_key_algorithm
strong

PARTITION BY KEY ALGORITHM=N Which algorithm to use for hashing the fields.

N = 1 - Use 5.1 hashing (numeric fields are hashed as binary) N = 2 - Use 5.5 hashing (numeric fields are hashed like latin1 bytes)

Enumerator
KEY_ALGORITHM_NONE 
KEY_ALGORITHM_51 
KEY_ALGORITHM_55 

Function Documentation

◆ check_partition_dirs()

bool check_partition_dirs ( partition_info part_info)

◆ 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.

Parameters
part_info- Partition info that could be using tablespaces.
tablespace_set- (OUT) Tablespace_hash_set where tablespace names are collected.
Returns
true - On failure.
false - On success.

◆ get_next_partition_id_range()

uint32 get_next_partition_id_range ( PARTITION_ITERATOR part_iter)

◆ 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 external index directory.

Parameters
pipartitioning information
Return values
trueif any partition or subpartition has an external data directory or external index directory.
falseotherwise

◆ init_all_partitions_iterator()

static void init_all_partitions_iterator ( partition_info part_info,
PARTITION_ITERATOR part_iter 
)
inlinestatic

◆ init_single_partition_iterator()

static void init_single_partition_iterator ( uint32  part_id,
PARTITION_ITERATOR part_iter 
)
inlinestatic

◆ 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.

Parameters
part_infoPartition info that could be using tablespaces.
Returns
true One of the tablespace names specified has invalid length and an error is reported.
false All the tablespace names specified for partitions have a valid length.

◆ 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.

Do the validation by invoking the SE specific validation function.

Parameters
part_infoPartition info that could be using tablespaces.
default_engineTable level engine.
Returns
true One of the tablespace names specified is invalid and an error is reported.
false All the tablespace names specified for partitions are valid.