MySQL 8.0.40
Source Code Documentation
Multi_value_logger Class Reference

Class to log the multi-value data and read it from the log. More...

#include <data0data.h>

Public Member Functions

 Multi_value_logger (const multi_value_data *mv_data, uint32_t field_len)
 Constructor. More...
 
uint32_t get_log_len (bool precise) const
 Get the log length for the multi-value data. More...
 
bytelog (byte **ptr)
 Log the multi-value data to specified memory. More...
 

Static Public Member Functions

static uint32_t read_log_len (const byte *ptr)
 Read the log length for the multi-value data log starting from ptr. More...
 
static const byteread (const byte *ptr, dfield_t *field, mem_heap_t *heap)
 Read the multi-value data from the ptr. More...
 
static uint32_t get_keys_capacity (uint32_t log_size, uint32_t key_length, uint32_t *num_keys)
 Estimate how many multi-value keys at most can be accommodated into the log of specified size. More...
 
static bool is_multi_value_log (const byte *ptr)
 Determine if the log starting from ptr is for multi-value data. More...
 

Private Attributes

const multi_value_datam_mv_data
 Multi-value data. More...
 
uint32_t m_field_len
 Multi-value field length. More...
 

Static Private Attributes

static constexpr uint32_t s_log_length_for_null_or_empty = 2
 Length of log for NULL value or no indexed value cases. More...
 
static constexpr uint8_t s_multi_value_virtual_col_length_marker = 0xFF
 Multi-value virtual column length marker. More...
 
static constexpr uint16_t s_multi_value_no_index_value = 0x0
 Multi-value virtual column length, which indicates that there is no value on the multi-value index. More...
 
static constexpr uint16_t s_multi_value_null = 0x1
 Multi-value virtual column length, which indicates that the field is NULL. More...
 
static constexpr uint8_t s_max_compressed_mv_key_length_size = 2
 The compressed length for multi-value key length logging. More...
 

Detailed Description

Class to log the multi-value data and read it from the log.

Constructor & Destructor Documentation

◆ Multi_value_logger()

Multi_value_logger::Multi_value_logger ( const multi_value_data mv_data,
uint32_t  field_len 
)
inline

Constructor.

Parameters
[in]mv_datamulti-value data structure to log
[in]field_lenmulti-value data field length

Member Function Documentation

◆ get_keys_capacity()

uint32_t Multi_value_logger::get_keys_capacity ( uint32_t  log_size,
uint32_t  key_length,
uint32_t *  num_keys 
)
static

Estimate how many multi-value keys at most can be accommodated into the log of specified size.

Parameters
[in]log_sizemax log size
[in]key_lengthmax multi-value key length, charset considered
[out]num_keysmax possible number of multi-value keys
Returns
the total size of the keys, let's assume all keys are concatenated one by one compactly

◆ get_log_len()

uint32_t Multi_value_logger::get_log_len ( bool  precise) const

Get the log length for the multi-value data.

Parameters
[in]precisetrue if precise length is needed, false if rough estimation is OK
Returns
the total log length for the multi-value data

◆ is_multi_value_log()

static bool Multi_value_logger::is_multi_value_log ( const byte ptr)
inlinestatic

Determine if the log starting from ptr is for multi-value data.

Returns
true if it is for multi-value data, otherwise false

◆ log()

byte * Multi_value_logger::log ( byte **  ptr)

Log the multi-value data to specified memory.

Parameters
[in,out]ptrthe memory to write
Returns
next to the end of the multi-value data log

◆ read()

const byte * Multi_value_logger::read ( const byte ptr,
dfield_t field,
mem_heap_t heap 
)
static

Read the multi-value data from the ptr.

Parameters
[in]ptrlog starting from here
[in,out]fieldmulti-value data field to store the array
[in,out]heapmemory heap
Returns
next to the end of the multi-value data log

◆ read_log_len()

uint32_t Multi_value_logger::read_log_len ( const byte ptr)
static

Read the log length for the multi-value data log starting from ptr.

Parameters
[in]ptrlog starting from here
Returns
the length of this log

Member Data Documentation

◆ m_field_len

uint32_t Multi_value_logger::m_field_len
private

Multi-value field length.

◆ m_mv_data

const multi_value_data* Multi_value_logger::m_mv_data
private

Multi-value data.

◆ s_log_length_for_null_or_empty

constexpr uint32_t Multi_value_logger::s_log_length_for_null_or_empty = 2
staticconstexprprivate

Length of log for NULL value or no indexed value cases.

◆ s_max_compressed_mv_key_length_size

constexpr uint8_t Multi_value_logger::s_max_compressed_mv_key_length_size = 2
staticconstexprprivate

The compressed length for multi-value key length logging.

This would not be longer than 2 bytes for now, while 2 bytes can actually support key length of 16384 bytes. And the actual key length would never be longer than this

◆ s_multi_value_no_index_value

constexpr uint16_t Multi_value_logger::s_multi_value_no_index_value = 0x0
staticconstexprprivate

Multi-value virtual column length, which indicates that there is no value on the multi-value index.

It's mapped to UNIV_NO_INDEX_VALUE

◆ s_multi_value_null

constexpr uint16_t Multi_value_logger::s_multi_value_null = 0x1
staticconstexprprivate

Multi-value virtual column length, which indicates that the field is NULL.

It's mapped to UNIV_SQL_NULL. Since any not NULL and not no value multi-value data must be longer than 1 byte, so this is safe for this special meaning

◆ s_multi_value_virtual_col_length_marker

constexpr uint8_t Multi_value_logger::s_multi_value_virtual_col_length_marker = 0xFF
staticconstexprprivate

Multi-value virtual column length marker.

With this length marker, a multi-value virtual column undo log can be identified. Meanwhile, this marker should/will not conflict with any normal compressed written length leading byte


The documentation for this class was generated from the following files: