![]() |
MySQL 9.4.0
Source Code Documentation
|
Classes | |
struct | Allocation_scheme |
class | Allocator |
Custom memory allocator. More... | |
class | AllocatorState |
Shared state between all instances of a given allocator. More... | |
class | Block |
Memory-block abstraction whose purpose is to serve as a building block for custom memory-allocator implementations. More... | |
class | Cell |
A cell is the intersection of a row and a column. More... | |
class | Cell_calculator |
Utility to perform calculations for a cell. More... | |
class | Chunk |
Chunk is an abstraction with the purpose of representing a smallest logical memory-unit within the Block. More... | |
class | Column |
A column class that describes the metadata of a column. More... | |
class | Cursor |
A cursor for iterating over an Index . More... | |
struct | Exponential_policy |
class | Handler |
Temptable engine handler. More... | |
class | Hash_duplicates |
class | Hash_unique |
class | Header |
Header is an abstraction with the purpose of holding and maintaining the Block metadata. More... | |
class | Index |
Index interface. More... | |
class | Indexed_cells |
Indexed cells represent one or more cells that are covered by an index. More... | |
class | Indexed_cells_equal_to |
Indexed cells comparator (a == b). More... | |
class | Indexed_cells_hash |
Indexed cells hasher. More... | |
class | Indexed_cells_less |
Indexed cells comparator (a < b). More... | |
class | Indexed_column |
class | Key_value_store |
Key-value store, a convenience wrapper class which models a thread-safe dictionary type. More... | |
class | Key_value_store_logger |
Default Key_value_store logging facility which turns to no-op in non-debug builds. More... | |
class | Key_value_store_logger< T, true > |
Key_value_store logging facility debug builds only. More... | |
struct | Key_value_store_stats |
This is a small convenience POD-like type which describes what kind of details we are interested in when monitoring the behavior of Key_value_store. More... | |
struct | Largest_lock_free_type_selector |
Largest lock-free type selector, a helper utility very much similar to Lock_free_type_selector with the difference being that it tries hard not to fail. More... | |
struct | Largest_lock_free_type_selector< T, typename std::enable_if< std::is_integral< T >::value >::type > |
Template-specialization for integral types. More... | |
struct | Largest_lock_free_type_selector< T, typename std::enable_if< std::is_pointer< T >::value >::type > |
Template-specialization for pointer types. More... | |
class | Lock_free_pool |
Lock-free pool which consists of POOL_SIZE Lock_free_type elements. More... | |
class | Lock_free_shared_block_pool |
Lock-free pool of POOL_SIZE Block elements. More... | |
struct | Lock_free_type |
Representation of an atomic type which is guaranteed to be always-lock-free. More... | |
struct | Lock_free_type< T, Alignment::L1_DCACHE_SIZE, TypeSelector > |
struct | Lock_free_type_selector |
Lock-free type selector, a helper utility which evaluates during the compile-time whether the given type T has a property of being always-lock-free for given platform. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_class< T >::value and std::is_trivially_copyable< T >::value >::type > |
Template-specialization for trivially-copyable classes/structs. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_pointer< T >::value >::type > |
Template-specialization for pointer types. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, bool >::value >::type > |
Template-specialization for boolean types. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, char >::value or std::is_same< T, unsigned char >::value >::type > |
Template-specialization for char types. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, int >::value or std::is_same< T, unsigned int >::value >::type > |
Template-specialization for int types. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, long >::value or std::is_same< T, unsigned long >::value >::type > |
Template-specialization for long types. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, long long >::value or std::is_same< T, unsigned long long >::value >::type > |
Template-specialization for long long types. More... | |
struct | Lock_free_type_selector< T, typename std::enable_if< std::is_same< T, short >::value or std::is_same< T, unsigned short >::value >::type > |
Template-specialization for short types. More... | |
struct | Memory |
Primary-template (functor) class for memory-utils. More... | |
struct | Memory< Source::MMAP_FILE > |
Template specialization for MMAP-based allocation/deallocation. More... | |
struct | Memory< Source::RAM > |
Template specialization for RAM-based allocation/deallocation. More... | |
struct | MemoryMonitor |
struct | Prefer_RAM_over_MMAP_policy |
class | Row |
A row representation. More... | |
class | Sharded_key_value_store |
Sharded key-value store, a convenience wrapper class around Key_value_store that creates N_SHARDS instances of Key_value_store and exposes a simple interface to further manipulate with them. More... | |
struct | Sharded_key_value_store_logger |
Default Sharded_key_value_store logging facility which turns to no-op in non-debug builds. More... | |
struct | Sharded_key_value_store_logger< T, true > |
Sharded_key_value_store logging facility debug builds only. More... | |
class | Storage |
Storage container. More... | |
class | Table |
class | TableResourceMonitor |
class | Tree |
Typedefs | |
using | Exponential_growth_preferring_RAM_over_MMAP = Allocation_scheme< Exponential_policy, Prefer_RAM_over_MMAP_policy > |
typedef std::vector< Column, Allocator< Column > > | Columns |
A type that designates all the columns of a table. More... | |
typedef std::multiset< Indexed_cells, Indexed_cells_less, Allocator< Indexed_cells > > | Tree_container |
The container used by tree unique and non-unique indexes. More... | |
typedef std::unordered_multiset< Indexed_cells, Indexed_cells_hash, Indexed_cells_equal_to, Allocator< Indexed_cells > > | Hash_duplicates_container |
The container used by hash non-unique indexes. More... | |
typedef std::unordered_set< Indexed_cells, Indexed_cells_hash, Indexed_cells_equal_to, Allocator< Indexed_cells > > | Hash_unique_container |
The container used by hash unique indexes. More... | |
Enumerations | |
enum class | Alignment { NATURAL , L1_DCACHE_SIZE } |
Enum class describing alignment-requirements. More... | |
enum class | Source { MMAP_FILE , RAM } |
Type of memory allocated. More... | |
enum class | Result { END_OF_FILE = HA_ERR_END_OF_FILE , FOUND_DUPP_KEY = HA_ERR_FOUND_DUPP_KEY , KEY_NOT_FOUND = HA_ERR_KEY_NOT_FOUND , NO_SUCH_TABLE = HA_ERR_NO_SUCH_TABLE , OK = 0 , OUT_OF_MEM = HA_ERR_OUT_OF_MEM , RECORD_FILE_FULL = HA_ERR_RECORD_FILE_FULL , TABLE_CORRUPT = HA_ERR_TABLE_CORRUPT , TABLE_EXIST = HA_ERR_TABLE_EXIST , TOO_BIG_ROW = HA_ERR_TOO_BIG_ROW , UNSUPPORTED = HA_ERR_UNSUPPORTED , WRONG_COMMAND = HA_ERR_WRONG_COMMAND , WRONG_INDEX = HA_ERR_WRONG_INDEX } |
Functions | |
void | Block_PSI_init () |
Initialize the PSI memory engine. More... | |
void | Block_PSI_track_logical_allocation (size_t size) |
Log logical (Chunk) memory allocation. More... | |
void | Block_PSI_track_logical_deallocation (size_t size) |
Log logical (Chunk) memory deallocation. More... | |
void | Block_PSI_track_physical_ram_allocation (void *ptr, size_t size) |
Log physical memory allocation of a Block located in RAM. More... | |
void | Block_PSI_track_physical_ram_deallocation (uint8_t *ptr) |
Log physical memory deallocation of a Block located in RAM. More... | |
void | Block_PSI_track_physical_disk_allocation (void *ptr, size_t size) |
Log physical memory allocation of a Block located in MMAP-ed file. More... | |
void | Block_PSI_track_physical_disk_deallocation (uint8_t *ptr) |
Log physical memory deallocation of a Block located in MMAP-ed file. More... | |
static uint8_t * | allocate_from (Source src, size_t size) |
static void | deallocate_from (Source src, size_t size, uint8_t *block_address) |
constexpr unsigned long long | operator""_KiB (unsigned long long n) |
Multiply a number by 1024. More... | |
constexpr unsigned long long | operator""_MiB (unsigned long long n) |
Multiply a number by 1024 * 1024. More... | |
constexpr unsigned long long | operator""_GiB (unsigned long long n) |
Multiply a number by 1024 * 1024 * 1024. More... | |
void | close_connection (THD *thd) |
Helper function that performs the temptable related cleanup. More... | |
bool | buf_is_inside_another (const unsigned char *small, size_t small_length, const unsigned char *big, size_t big_length) |
Check if a given buffer is inside another buffer. More... | |
const char * | result_to_string (Result r) |
static void | kv_store_shards_debug_dump () |
Small helper function which debug-prints the miscellaneous statistics which key-value store has collected. More... | |
static void | log_event (const std::string &msg, loglevel lvl) |
Helper function that calls the logging API to log errors. More... | |
static void | erase_owned_temptables (THD *thd) |
Function that erases leaked temptables by accessing the appropriate shard for the THD involved and iterating through the shard to find all temptables owned by this THD. More... | |
static void | shared_block_pool_release (THD *thd) |
Small helper function which releases the slot (and memory occupied by the Block) in shared-block pool. More... | |
static int | show_count_hit_max_ram_var (THD *, SHOW_VAR *var, char *buff) |
static void | get_count_hit_max_ram (void *, measurement_delivery_callback_t delivery, void *delivery_context) |
Variables | |
std::atomic_uint64_t | count_hit_max_ram {} |
Status variable that counts the memory limit breaches. More... | |
constexpr size_t | ALLOCATOR_MAX_BLOCK_MB_EXP = 9 |
log2(allocator max block size in MiB). More... | |
constexpr size_t | ALLOCATOR_MAX_BLOCK_BYTES |
Limit on the size of a block created by Allocator (in bytes). More... | |
constexpr size_t | STORAGE_PAGE_SIZE = 64_KiB |
Storage page size. More... | |
constexpr size_t | INDEX_DEFAULT_HASH_TABLE_BUCKETS = 1024 |
Number of buckets to have by default in a hash index. More... | |
constexpr bool | DEBUG_BUILD = true |
Store build-type information into the constexpr expression. More... | |
constexpr size_t | L1_DCACHE_SIZE = CPU_LEVEL1_DCACHE_LINESIZE |
Store L1-dcache size information into the constexpr expression. More... | |
constexpr size_t | KV_STORE_SHARDS_COUNT = 16 * 1024 |
Number of shards in key-value store. More... | |
constexpr size_t | SHARED_BLOCK_POOL_SIZE = 16 * 1024 |
Size of a pool containing shared-blocks. More... | |
PSI_memory_key | mem_key_physical_disk |
PFS key to account physical allocations and deallocations from disk. More... | |
PSI_memory_key | mem_key_physical_ram |
PFS key to account physical allocations and deallocations from RAM. More... | |
PSI_memory_info | pfs_info [] |
Array of PFS keys. More... | |
const size_t | pfs_info_num_elements = sizeof(pfs_info) / sizeof(pfs_info[0]) |
Number of elements inside pfs_info[] . More... | |
static Sharded_key_value_store< KV_STORE_SHARDS_COUNT > | kv_store_shard |
Key-value store containing all tables for all existing connections. More... | |
static Lock_free_shared_block_pool< SHARED_BLOCK_POOL_SIZE > | shared_block_pool |
static PSI_metric_info_v1 | metrics [] |
static PSI_meter_info_v1 | meter [] |
static SHOW_VAR | status_variables [] |
typedef std::vector<Column, Allocator<Column> > temptable::Columns |
A type that designates all the columns of a table.
using temptable::Exponential_growth_preferring_RAM_over_MMAP = typedef Allocation_scheme<Exponential_policy, Prefer_RAM_over_MMAP_policy> |
typedef std::unordered_multiset<Indexed_cells, Indexed_cells_hash, Indexed_cells_equal_to, Allocator<Indexed_cells> > temptable::Hash_duplicates_container |
The container used by hash non-unique indexes.
typedef std::unordered_set<Indexed_cells, Indexed_cells_hash, Indexed_cells_equal_to, Allocator<Indexed_cells> > temptable::Hash_unique_container |
The container used by hash unique indexes.
typedef std::multiset<Indexed_cells, Indexed_cells_less, Allocator<Indexed_cells> > temptable::Tree_container |
The container used by tree unique and non-unique indexes.
|
strong |
|
strong |
|
strong |
|
inlinestatic |
void temptable::Block_PSI_init | ( | ) |
Initialize the PSI memory engine.
void temptable::Block_PSI_track_logical_allocation | ( | size_t | size | ) |
Log logical (Chunk) memory allocation.
[in] Number of bytes allocated
void temptable::Block_PSI_track_logical_deallocation | ( | size_t | size | ) |
Log logical (Chunk) memory deallocation.
[in] Number of bytes deallocated
void temptable::Block_PSI_track_physical_disk_allocation | ( | void * | ptr, |
size_t | size | ||
) |
Log physical memory allocation of a Block located in MMAP-ed file.
[in] Pointer to user memory block [in] Number of bytes allocated
void temptable::Block_PSI_track_physical_disk_deallocation | ( | uint8_t * | ptr | ) |
Log physical memory deallocation of a Block located in MMAP-ed file.
[in] Pointer to PSI header
void temptable::Block_PSI_track_physical_ram_allocation | ( | void * | ptr, |
size_t | size | ||
) |
Log physical memory allocation of a Block located in RAM.
[in] Pointer to user memory block [in] Number of bytes allocated
void temptable::Block_PSI_track_physical_ram_deallocation | ( | uint8_t * | ptr | ) |
Log physical memory deallocation of a Block located in RAM.
[in] Pointer to PSI header
|
inline |
Check if a given buffer is inside another buffer.
[in] | small | First buffer, that should be inside the other. |
[in] | small_length | First buffer length in bytes. |
[in] | big | Second buffer, that should contain the other. |
[in] | big_length | Second buffer length in bytes. |
void temptable::close_connection | ( | THD * | thd | ) |
Helper function that performs the temptable related cleanup.
Called from plugin->close_connection.
|
inlinestatic |
|
static |
Function that erases leaked temptables by accessing the appropriate shard for the THD involved and iterating through the shard to find all temptables owned by this THD.
This should only be called during close_connection if there is a leaked temptable in the optimizer layer, so any time this is called it indicates a bug. It logs an error to the server logs.
|
static |
|
static |
Small helper function which debug-prints the miscellaneous statistics which key-value store has collected.
|
static |
Helper function that calls the logging API to log errors.
|
constexpr |
Multiply a number by 1024 * 1024 * 1024.
[in] | n | Number to multiply. |
|
constexpr |
Multiply a number by 1024.
[in] | n | Number to multiply. |
|
constexpr |
Multiply a number by 1024 * 1024.
[in] | n | Number to multiply. |
const char * temptable::result_to_string | ( | Result | r | ) |
|
static |
Small helper function which releases the slot (and memory occupied by the Block) in shared-block pool.
|
constexpr |
Limit on the size of a block created by Allocator
(in bytes).
A larger block could still be created if a single allocation request with bigger size is received.
|
constexpr |
log2(allocator max block size in MiB).
Ie. 2 ^ ALLOCATOR_MAX_BLOCK_MB_EXP * 1024^2 = ALLOCATOR_MAX_BLOCK_BYTES.
std::atomic_uint64_t temptable::count_hit_max_ram {} |
Status variable that counts the memory limit breaches.
|
constexpr |
Store build-type information into the constexpr expression.
|
constexpr |
Number of buckets to have by default in a hash index.
|
static |
Key-value store containing all tables for all existing connections.
See Sharded_key_value_store
documentation for more details.
|
constexpr |
Number of shards in key-value store.
|
constexpr |
Store L1-dcache size information into the constexpr expression.
PSI_memory_key temptable::mem_key_physical_disk |
PFS key to account physical allocations and deallocations from disk.
After we have allocated more than temptable_max_ram
we start taking memory from the OS disk, using mmap()'ed files.
PSI_memory_key temptable::mem_key_physical_ram |
PFS key to account physical allocations and deallocations from RAM.
Before we have allocated more than temptable_max_ram
we take memory from the OS RAM, using e.g. malloc().
|
static |
|
static |
PSI_memory_info temptable::pfs_info[] |
Array of PFS keys.
Number of elements inside pfs_info[]
.
|
static |
|
constexpr |
Size of a pool containing shared-blocks.
|
static |
|
constexpr |
Storage
page size.