MySQL  8.0.27
Source Code Documentation
rpl_write_set_handler.cc File Reference
#include "sql/rpl_write_set_handler.h"
#include <inttypes.h>
#include <stddef.h>
#include <sys/types.h>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "lex_string.h"
#include "m_ctype.h"
#include "my_base.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_murmur3.h"
#include "my_xxhash.h"
#include "mysql_com.h"
#include "sql/field.h"
#include "sql/json_binary.h"
#include "sql/json_dom.h"
#include "sql/key.h"
#include "sql/query_options.h"
#include "sql/rpl_transaction_write_set_ctx.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/transaction_info.h"
#include "template_utils.h"

Macros

#define HASH_STRING_SEPARATOR   "½"
 

Functions

const char * get_write_set_algorithm_string (unsigned int algorithm)
 Function that returns the write set extraction algorithm name. More...
 
template<class type >
uint64 calc_hash (ulong algorithm, type T, size_t len)
 
static void check_foreign_key (TABLE *table, THD *thd, std::map< std::string, std::string > &foreign_key_map)
 Function to check if the given TABLE has any foreign key field. More...
 
static void debug_check_for_write_sets (std::vector< std::string > &key_list_to_hash, std::vector< uint64 > &hash_list)
 
static bool generate_hash_pke (const std::string &pke, THD *thd, std::vector< std::string > &write_sets, std::vector< uint64 > &hash_list)
 Function to generate the hash of the string passed to this function. More...
 
static bool generate_mv_hash_pke (const std::string &prefix_pke, THD *thd, Field *fld, std::vector< std::string > &write_sets, std::vector< uint64 > &hash_list)
 Function to generate set of hashes for a multi-valued key. More...
 
bool add_pke (TABLE *table, THD *thd, const uchar *record)
 Function to add the hash of the PKE to the transaction context object. More...
 

Variables

const char * transaction_write_set_hashing_algorithms []
 

Macro Definition Documentation

◆ HASH_STRING_SEPARATOR

#define HASH_STRING_SEPARATOR   "½"

Function Documentation

◆ add_pke()

bool add_pke ( TABLE table,
THD thd,
const uchar record 
)

Function to add the hash of the PKE to the transaction context object.

Parameters
[in]table- TABLE object
[in]thd- THD object pointing to current thread.
[in]record- The record to process (record[0] or record[1]).
Returns
true if an issues exists adding the pke, false otherwise

◆ calc_hash()

template<class type >
uint64 calc_hash ( ulong  algorithm,
type  T,
size_t  len 
)

◆ check_foreign_key()

static void check_foreign_key ( TABLE table,
THD thd,
std::map< std::string, std::string > &  foreign_key_map 
)
static

Function to check if the given TABLE has any foreign key field.

This is needed to be checked to get the hash of the field value in the foreign table.

This function is meant to be only called by add_pke() function, some conditions are check there for performance optimization.

Parameters
[in]table- TABLE object
[in]thd- THD object pointing to current thread.
[out]foreign_key_map- a standard map which keeps track of the foreign key fields.

◆ debug_check_for_write_sets()

static void debug_check_for_write_sets ( std::vector< std::string > &  key_list_to_hash,
std::vector< uint64 > &  hash_list 
)
static

◆ generate_hash_pke()

static bool generate_hash_pke ( const std::string &  pke,
THD thd,
std::vector< std::string > &  write_sets,
std::vector< uint64 > &  hash_list 
)
static

Function to generate the hash of the string passed to this function.

Parameters
[in]pke- the string to be hashed.
[in]thd- THD object pointing to current thread.
Returns
true if a problem occurred on generation or write set tracking.
Parameters
[in]write_sets- list of all write sets
[in]hash_list- list of all hashes

◆ generate_mv_hash_pke()

static bool generate_mv_hash_pke ( const std::string &  prefix_pke,
THD thd,
Field fld,
std::vector< std::string > &  write_sets,
std::vector< uint64 > &  hash_list 
)
static

Function to generate set of hashes for a multi-valued key.

Parameters
[in]prefix_pke- stringified non-multi-valued prefix of key
[in]thd- THD object pointing to current thread.
[in]fld- multi-valued keypart's field
Returns
true if a problem occurred on generation or write set tracking.
Parameters
[in]write_sets- DEBUG ONLY, vector of added PKEs
[in]hash_list- DEBUG ONLY, list of all hashes

◆ get_write_set_algorithm_string()

const char* get_write_set_algorithm_string ( unsigned int  algorithm)

Function that returns the write set extraction algorithm name.

Parameters
[in]algorithmThe algorithm value
Returns
the algorithm name

Variable Documentation

◆ transaction_write_set_hashing_algorithms

const char* transaction_write_set_hashing_algorithms[]
Initial value:
= {"OFF", "MURMUR32",
"XXHASH64", nullptr}