MySQL 8.0.39
Source Code Documentation
|
#include "sql/rpl_utility.h"
#include <string.h>
#include <iterator>
#include <new>
#include <regex>
#include <utility>
#include "lex_string.h"
#include "libbinlogevents/export/binary_log_funcs.h"
#include "my_byteorder.h"
#include "my_dbug.h"
#include "my_loglevel.h"
#include "my_sys.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/service_mysql_alloc.h"
#include "sql/thr_malloc.h"
#include <algorithm>
#include "libbinlogevents/include/binlog_event.h"
#include "m_ctype.h"
#include "m_string.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "mysql/psi/psi_memory.h"
#include "mysqld_error.h"
#include "sql/changestreams/misc/replicated_columns_view_factory.h"
#include "sql/create_field.h"
#include "sql/dd/dd.h"
#include "sql/dd/dictionary.h"
#include "sql/derror.h"
#include "sql/field.h"
#include "sql/log.h"
#include "sql/log_event.h"
#include "sql/my_decimal.h"
#include "sql/mysqld.h"
#include "sql/psi_memory_key.h"
#include "sql/rpl_replica.h"
#include "sql/rpl_rli.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_gipk.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sql_tmp_table.h"
#include "sql_show.h"
#include "sql_string.h"
#include "template_utils.h"
#include "typelib.h"
Macros | |
#define | HASH_ROWS_POS_SEARCH_INVALID -1 |
Functions | |
static int | compare (size_t a, size_t b) |
Function to compare two size_t integers for their relative order. More... | |
static int | compare_lengths (Field *field, enum_field_types source_type, uint16 metadata) |
static bool | is_conversion_ok (int order) |
Check the order variable and print errors if the order is not acceptable according to the current settings. More... | |
bool | timestamp_cross_check (enum_field_types type1, enum_field_types type2) |
Check if the types are criss cross means type1 is MYSQL_TYPE_TIMESTAMP and type2 as MYSQL_TYPE_TIMESTAMP2 or vice versa. More... | |
bool | datetime_cross_check (enum_field_types type1, enum_field_types type2) |
Check if the types are criss cross means type1 is MYSQL_TYPE_DATETIME and type2 as MYSQL_TYPE_DATETIME or vice versa. More... | |
bool | time_cross_check (enum_field_types type1, enum_field_types type2) |
Check if the types are criss cross means type1 is MYSQL_TYPE_TIME and type2 as MYSQL_TYPE_TIME2 or vice versa. More... | |
static bool | can_convert_field_to (Field *field, enum_field_types source_type, uint metadata, bool is_array, Relay_log_info *rli, uint16 mflags, int *order_var) |
Can a type potentially be converted to another type? More... | |
std::pair< my_off_t, std::pair< uint, bool > > | read_field_metadata (const uchar *buffer, enum_field_types binlog_type) |
Decode field metadata from a char buffer (serialized form) into an int (packed form). More... | |
std::string | replace_all_in_str (std::string from, std::string find, std::string replace) |
Replaces every occurrence of the string find by the string replace , within the string from and return the resulting string. More... | |
bool | is_require_row_format_violation (const THD *thd) |
This method shall evaluate if a command being executed goes against any of the restrictions of server variable session.require_row_format. More... | |
void | rename_fields_use_old_replica_source_terms (THD *thd, mem_root_deque< Item * > &field_list) |
This function shall blindly replace some deprecated terms used in the field names with more recent ones. More... | |
bool | is_immediate_server_gipk_ready (THD &thd) |
Checks if the immediate_server_version supports GIPKs or not. More... | |
bool | does_source_table_contain_gipk (Relay_log_info const *rli, TABLE *table) |
Returns if the replicated table contains a GIPK or not. More... | |
std::string | decimal_numeric_version_to_string (uint32 version) |
Returns a string representation for a given version. More... | |
Variables | |
PSI_memory_key | key_memory_table_def_memory |
static const std::unordered_map< std::string, std::string > | deprecated_field_map |
#define HASH_ROWS_POS_SEARCH_INVALID -1 |
|
static |
Can a type potentially be converted to another type?
This function check if the types are convertible and what conversion is required.
If conversion is not possible, and error is printed.
If conversion is possible:
[in] | field | Target field |
[in] | source_type | Source field type |
[in] | metadata | Source field metadata |
[in] | is_array | Whether the source field is a typed array |
[in] | rli | Relay log info (for error reporting) |
[in] | mflags | Flags from the table map event |
[out] | order_var | Order between source field and target field |
true
if conversion is possible according to the current settings, false
if conversion is not possible according to the current setting.
|
static |
Function to compare two size_t integers for their relative order.
Used below.
|
static |
|
inline |
Check if the types are criss cross means type1 is MYSQL_TYPE_DATETIME and type2 as MYSQL_TYPE_DATETIME or vice versa.
std::string decimal_numeric_version_to_string | ( | uint32 | version | ) |
Returns a string representation for a given version.
version | a version represented using a integer |
bool does_source_table_contain_gipk | ( | Relay_log_info const * | rli, |
TABLE * | table | ||
) |
Returns if the replicated table contains a GIPK or not.
rli | The relay log object associated to the channel |
table | The table to check for the GIPK |
|
static |
Check the order variable and print errors if the order is not acceptable according to the current settings.
order | The computed order of the conversion needed. |
bool is_immediate_server_gipk_ready | ( | THD & | thd | ) |
Checks if the immediate_server_version supports GIPKs or not.
thd | The THD context to check the version |
bool is_require_row_format_violation | ( | const THD * | thd | ) |
This method shall evaluate if a command being executed goes against any of the restrictions of server variable session.require_row_format.
thd | The thread associated to the command |
std::pair< my_off_t, std::pair< uint, bool > > read_field_metadata | ( | const uchar * | buffer, |
enum_field_types | binlog_type | ||
) |
Decode field metadata from a char buffer (serialized form) into an int (packed form).
buffer | Field metadata, in the character stream form produced by save_field_metadata. |
binlog_type | The type of the field, in the form returned by Field::binlog_type and stored in Table_map_log_event. |
pair | where:
|
void rename_fields_use_old_replica_source_terms | ( | THD * | thd, |
mem_root_deque< Item * > & | field_list | ||
) |
This function shall blindly replace some deprecated terms used in the field names with more recent ones.
This function must be removed once the related syntax (SHOW SLAVE STATUS and friends) is removed.
thd | the thread context. |
field_list | the list of fields that will have their name checked and altered if needed. |
std::string replace_all_in_str | ( | std::string | from, |
std::string | find, | ||
std::string | replace | ||
) |
Replaces every occurrence of the string find
by the string replace
, within the string from
and return the resulting string.
The original string from
remains untouched.
from | the string to search within. |
find | the string to search for. |
replace | the string to replace every occurrence of from |
|
inline |
Check if the types are criss cross means type1 is MYSQL_TYPE_TIME and type2 as MYSQL_TYPE_TIME2 or vice versa.
|
inline |
Check if the types are criss cross means type1 is MYSQL_TYPE_TIMESTAMP and type2 as MYSQL_TYPE_TIMESTAMP2 or vice versa.
|
static |
PSI_memory_key key_memory_table_def_memory |