My Project
|
Classes | |
struct | old_sql_ex |
struct | sql_ex_info |
struct | st_mts_db_names |
class | Log_event |
class | Query_log_event |
class | Load_log_event |
class | Start_log_event_v3 |
class | Format_description_log_event |
class | Intvar_log_event |
class | Rand_log_event |
class | Xid_log_event |
class | User_var_log_event |
class | Stop_log_event |
class | Rotate_log_event |
class | Create_file_log_event |
class | Append_block_log_event |
class | Delete_file_log_event |
class | Execute_load_log_event |
class | Begin_load_query_log_event |
class | Execute_load_query_log_event |
class | Table_map_log_event |
class | Rows_log_event |
class | Write_rows_log_event |
class | Update_rows_log_event |
class | Delete_rows_log_event |
class | Incident_log_event |
class | Ignorable_log_event |
class | Rows_query_log_event |
class | Gtid_log_event |
class | Previous_gtids_log_event |
Files | |
file | log_event.h |
Binary log event definitions. This includes generic code common to all types of log events, as well as specific code for each type of log event. | |
file | rpl_slave.cc |
Code to run the io thread and the sql thread on the replication slave. | |
file | rpl_slave.h |
Defines | |
#define | PREFIX_SQL_LOAD "SQL_LOAD-" |
#define | TEMP_FILE_MAX_LEN UUID_LENGTH+38 |
#define | ASSERT_OR_RETURN_ERROR(COND, ERRNO) DBUG_ASSERT(COND) |
#define | LOG_READ_EOF -1 |
#define | LOG_READ_BOGUS -2 |
#define | LOG_READ_IO -3 |
#define | LOG_READ_MEM -5 |
#define | LOG_READ_TRUNC -6 |
#define | LOG_READ_TOO_LARGE -7 |
#define | LOG_READ_CHECKSUM_FAILURE -8 |
#define | LOG_EVENT_OFFSET 4 |
#define | BINLOG_VERSION 4 |
#define | ST_SERVER_VER_LEN 50 |
#define | DUMPFILE_FLAG 0x1 |
#define | OPT_ENCLOSED_FLAG 0x2 |
#define | REPLACE_FLAG 0x4 |
#define | IGNORE_FLAG 0x8 |
#define | FIELD_TERM_EMPTY 0x1 |
#define | ENCLOSED_EMPTY 0x2 |
#define | LINE_TERM_EMPTY 0x4 |
#define | LINE_START_EMPTY 0x8 |
#define | ESCAPED_EMPTY 0x10 |
#define | NUM_LOAD_DELIM_STRS 5 |
#define | LOG_EVENT_HEADER_LEN 19U /* the fixed header length */ |
#define | OLD_HEADER_LEN 13U /* the fixed header length in 3.23 */ |
#define | LOG_EVENT_MINIMAL_HEADER_LEN 19U |
#define | QUERY_HEADER_MINIMAL_LEN (4 + 4 + 1 + 2) |
#define | QUERY_HEADER_LEN (QUERY_HEADER_MINIMAL_LEN + 2) |
#define | STOP_HEADER_LEN 0 |
#define | LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4) |
#define | START_V3_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4) |
#define | ROTATE_HEADER_LEN 8 |
#define | INTVAR_HEADER_LEN 0 |
#define | CREATE_FILE_HEADER_LEN 4 |
#define | APPEND_BLOCK_HEADER_LEN 4 |
#define | EXEC_LOAD_HEADER_LEN 4 |
#define | DELETE_FILE_HEADER_LEN 4 |
#define | NEW_LOAD_HEADER_LEN LOAD_HEADER_LEN |
#define | RAND_HEADER_LEN 0 |
#define | USER_VAR_HEADER_LEN 0 |
#define | FORMAT_DESCRIPTION_HEADER_LEN (START_V3_HEADER_LEN+1+LOG_EVENT_TYPES) |
#define | XID_HEADER_LEN 0 |
#define | BEGIN_LOAD_QUERY_HEADER_LEN APPEND_BLOCK_HEADER_LEN |
#define | ROWS_HEADER_LEN_V1 8 |
#define | TABLE_MAP_HEADER_LEN 8 |
#define | EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1) |
#define | EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN) |
#define | INCIDENT_HEADER_LEN 2 |
#define | HEARTBEAT_HEADER_LEN 0 |
#define | IGNORABLE_HEADER_LEN 0 |
#define | ROWS_HEADER_LEN_V2 10 |
#define | MAX_DBS_IN_EVENT_MTS 16 |
#define | OVER_MAX_DBS_IN_EVENT_MTS 254 |
#define | MAX_SIZE_LOG_EVENT_STATUS |
#define | MAX_LOG_EVENT_HEADER |
#define | MAX_MAX_ALLOWED_PACKET 1024*1024*1024 |
#define | EVENT_TYPE_OFFSET 4 |
#define | SERVER_ID_OFFSET 5 |
#define | EVENT_LEN_OFFSET 9 |
#define | LOG_POS_OFFSET 13 |
#define | FLAGS_OFFSET 17 |
#define | ST_BINLOG_VER_OFFSET 0 |
#define | ST_SERVER_VER_OFFSET 2 |
#define | ST_CREATED_OFFSET (ST_SERVER_VER_OFFSET + ST_SERVER_VER_LEN) |
#define | ST_COMMON_HEADER_LEN_OFFSET (ST_CREATED_OFFSET + 4) |
#define | SL_MASTER_PORT_OFFSET 8 |
#define | SL_MASTER_POS_OFFSET 0 |
#define | SL_MASTER_HOST_OFFSET 10 |
#define | Q_THREAD_ID_OFFSET 0 |
#define | Q_EXEC_TIME_OFFSET 4 |
#define | Q_DB_LEN_OFFSET 8 |
#define | Q_ERR_CODE_OFFSET 9 |
#define | Q_STATUS_VARS_LEN_OFFSET 11 |
#define | Q_DATA_OFFSET QUERY_HEADER_LEN |
#define | Q_FLAGS2_CODE 0 |
#define | Q_SQL_MODE_CODE 1 |
#define | Q_CATALOG_CODE 2 |
#define | Q_AUTO_INCREMENT 3 |
#define | Q_CHARSET_CODE 4 |
#define | Q_TIME_ZONE_CODE 5 |
#define | Q_CATALOG_NZ_CODE 6 |
#define | Q_LC_TIME_NAMES_CODE 7 |
#define | Q_CHARSET_DATABASE_CODE 8 |
#define | Q_TABLE_MAP_FOR_UPDATE_CODE 9 |
#define | Q_MASTER_DATA_WRITTEN_CODE 10 |
#define | Q_INVOKER 11 |
#define | Q_UPDATED_DB_NAMES 12 |
#define | Q_MICROSECONDS 13 |
#define | I_TYPE_OFFSET 0 |
#define | I_VAL_OFFSET 1 |
#define | RAND_SEED1_OFFSET 0 |
#define | RAND_SEED2_OFFSET 8 |
#define | UV_VAL_LEN_SIZE 4 |
#define | UV_VAL_IS_NULL 1 |
#define | UV_VAL_TYPE_SIZE 1 |
#define | UV_NAME_LEN_SIZE 4 |
#define | UV_CHARSET_NUMBER_SIZE 4 |
#define | L_THREAD_ID_OFFSET 0 |
#define | L_EXEC_TIME_OFFSET 4 |
#define | L_SKIP_LINES_OFFSET 8 |
#define | L_TBL_LEN_OFFSET 12 |
#define | L_DB_LEN_OFFSET 13 |
#define | L_NUM_FIELDS_OFFSET 14 |
#define | L_SQL_EX_OFFSET 18 |
#define | L_DATA_OFFSET LOAD_HEADER_LEN |
#define | R_POS_OFFSET 0 |
#define | R_IDENT_OFFSET 8 |
#define | CF_FILE_ID_OFFSET 0 |
#define | CF_DATA_OFFSET CREATE_FILE_HEADER_LEN |
#define | AB_FILE_ID_OFFSET 0 |
#define | AB_DATA_OFFSET APPEND_BLOCK_HEADER_LEN |
#define | EL_FILE_ID_OFFSET 0 |
#define | DF_FILE_ID_OFFSET 0 |
#define | TM_MAPID_OFFSET 0 |
#define | TM_FLAGS_OFFSET 6 |
#define | RW_MAPID_OFFSET 0 |
#define | RW_FLAGS_OFFSET 6 |
#define | RW_VHLEN_OFFSET 8 |
#define | RW_V_TAG_LEN 1 |
#define | RW_V_EXTRAINFO_TAG 0 |
#define | ELQ_FILE_ID_OFFSET QUERY_HEADER_LEN |
#define | ELQ_FN_POS_START_OFFSET ELQ_FILE_ID_OFFSET + 4 |
#define | ELQ_FN_POS_END_OFFSET ELQ_FILE_ID_OFFSET + 8 |
#define | ELQ_DUP_HANDLING_OFFSET ELQ_FILE_ID_OFFSET + 12 |
#define | BINLOG_MAGIC "\xfe\x62\x69\x6e" |
#define | LOG_EVENT_BINLOG_IN_USE_F 0x1 |
#define | LOG_EVENT_THREAD_SPECIFIC_F 0x4 |
#define | LOG_EVENT_SUPPRESS_USE_F 0x8 |
#define | LOG_EVENT_ARTIFICIAL_F 0x20 |
#define | LOG_EVENT_RELAY_LOG_F 0x40 |
#define | LOG_EVENT_IGNORABLE_F 0x80 |
#define | LOG_EVENT_NO_FILTER_F 0x100 |
#define | LOG_EVENT_MTS_ISOLATE_F 0x200 |
#define | OPTIONS_WRITTEN_TO_BIN_LOG |
#define | EXPECTED_OPTIONS ((ULL(1) << 14) | (ULL(1) << 26) | (ULL(1) << 27) | (ULL(1) << 19)) |
#define | CHECKSUM_CRC32_SIGNATURE_LEN 4 |
#define | BINLOG_CHECKSUM_LEN CHECKSUM_CRC32_SIGNATURE_LEN |
#define | BINLOG_CHECKSUM_ALG_DESC_LEN 1 /* 1 byte checksum alg descriptor */ |
#define | LOG_EVENT_TYPES (ENUM_END_EVENT-1) |
#define | SLAVE_MAX_HEARTBEAT_PERIOD 4294967 |
#define | SLAVE_IO 1 |
#define | SLAVE_SQL 2 |
Typedefs | |
typedef ulonglong | sql_mode_t |
typedef struct st_db_worker_hash_entry | db_worker_hash_entry |
typedef struct st_mts_db_names | Mts_db_names |
Enumerations | |
enum | enum_binlog_checksum_alg { BINLOG_CHECKSUM_ALG_OFF = 0, BINLOG_CHECKSUM_ALG_CRC32 = 1, BINLOG_CHECKSUM_ALG_ENUM_END, BINLOG_CHECKSUM_ALG_UNDEF = 255 } |
enum | Log_event_type { UNKNOWN_EVENT = 0, START_EVENT_V3 = 1, QUERY_EVENT = 2, STOP_EVENT = 3, ROTATE_EVENT = 4, INTVAR_EVENT = 5, LOAD_EVENT = 6, SLAVE_EVENT = 7, CREATE_FILE_EVENT = 8, APPEND_BLOCK_EVENT = 9, EXEC_LOAD_EVENT = 10, DELETE_FILE_EVENT = 11, NEW_LOAD_EVENT = 12, RAND_EVENT = 13, USER_VAR_EVENT = 14, FORMAT_DESCRIPTION_EVENT = 15, XID_EVENT = 16, BEGIN_LOAD_QUERY_EVENT = 17, EXECUTE_LOAD_QUERY_EVENT = 18, TABLE_MAP_EVENT = 19, PRE_GA_WRITE_ROWS_EVENT = 20, PRE_GA_UPDATE_ROWS_EVENT = 21, PRE_GA_DELETE_ROWS_EVENT = 22, WRITE_ROWS_EVENT_V1 = 23, UPDATE_ROWS_EVENT_V1 = 24, DELETE_ROWS_EVENT_V1 = 25, INCIDENT_EVENT = 26, HEARTBEAT_LOG_EVENT = 27, IGNORABLE_LOG_EVENT = 28, ROWS_QUERY_LOG_EVENT = 29, WRITE_ROWS_EVENT = 30, UPDATE_ROWS_EVENT = 31, DELETE_ROWS_EVENT = 32, GTID_LOG_EVENT = 33, ANONYMOUS_GTID_LOG_EVENT = 34, PREVIOUS_GTIDS_LOG_EVENT = 35, ENUM_END_EVENT } |
enum | Int_event_type { INVALID_INT_EVENT = 0, LAST_INSERT_ID_EVENT = 1, INSERT_ID_EVENT = 2 } |
enum | enum_load_dup_handling { LOAD_DUP_ERROR = 0, LOAD_DUP_IGNORE, LOAD_DUP_REPLACE } |
Functions | |
char * | str_to_hex (char *to, const char *from, uint len) |
int | append_query_string (THD *thd, const CHARSET_INFO *csinfo, String const *from, String *to) |
bool | event_checksum_test (uchar *buf, ulong event_len, uint8 alg) |
uint8 | get_checksum_alg (const char *buf, ulong len) |
bool | is_gtid_event (Log_event *evt) |
ulong | version_product (const uchar *version_split) |
void | do_server_version_split (char *version, uchar split_versions[3]) |
size_t | my_strmov_quoted_identifier (char *buffer, const char *identifier) |
size_t | my_strmov_quoted_identifier_helper (int q, char *buffer, const char *identifier, uint length) |
Variables | |
char | server_version [SERVER_VERSION_LENGTH] |
TYPELIB | binlog_checksum_typelib |
#define ASSERT_OR_RETURN_ERROR | ( | COND, | |
ERRNO | |||
) | DBUG_ASSERT(COND) |
Either assert or return an error.
In debug build, the condition will be checked, but in non-debug builds, the error code given will be returned instead.
COND | Condition to check |
ERRNO | Error number to return in non-debug builds |
#define BINLOG_CHECKSUM_LEN CHECKSUM_CRC32_SIGNATURE_LEN |
defined statically while there is just one alg implemented
#define LOG_EVENT_ARTIFICIAL_F 0x20 |
Artificial events are created arbitarily and not written to binary log
These events should not update the master log position when slave SQL thread executes them.
#define LOG_EVENT_IGNORABLE_F 0x80 |
For an event, 'e', carrying a type code, that a slave, 's', does not recognize, 's' will check 'e' for LOG_EVENT_IGNORABLE_F, and if the flag is set, then 'e' is ignored. Otherwise, 's' acknowledges that it has found an unknown event in the relay log.
#define LOG_EVENT_MTS_ISOLATE_F 0x200 |
MTS: group of events can be marked to force its execution in isolation from any other Workers. So it's a marker for Coordinator to memorize and perform necessary operations in order to guarantee no interference from other Workers. The flag can be set ON only for an event that terminates its group. Typically that is done for a transaction that contains a query accessing more than OVER_MAX_DBS_IN_EVENT_MTS databases.
#define LOG_EVENT_NO_FILTER_F 0x100 |
Events with this flag are not filtered (e.g. on the current database) and are always written to the binary log regardless of filters.
#define LOG_EVENT_RELAY_LOG_F 0x40 |
Events with this flag set are created by slave IO thread and written to relay log
#define LOG_EVENT_SUPPRESS_USE_F 0x8 |
Suppress the generation of 'USE' statements before the actual statement. This flag should be set for any events that does not need the current database set to function correctly. Most notable cases are 'CREATE DATABASE' and 'DROP DATABASE'.
This flags should only be used in exceptional circumstances, since it introduce a significant change in behaviour regarding the replication logic together with the flags --binlog-do-db and --replicated-do-db.
#define LOG_EVENT_THREAD_SPECIFIC_F 0x4 |
If the query depends on the thread (for example: TEMPORARY TABLE). Currently this is used by mysqlbinlog to know it must print SET @PSEUDO_THREAD_ID=xx; before the query (it would not hurt to print it for every query but this would be slow).
#define MAX_LOG_EVENT_HEADER |
( /* in order of Query_log_event::write */ \ LOG_EVENT_HEADER_LEN + /* write_header */ \ QUERY_HEADER_LEN + /* write_data */ \ EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN + /*write_post_header_for_derived */ \ MAX_SIZE_LOG_EVENT_STATUS + /* status */ \ NAME_LEN + 1)
#define MAX_SIZE_LOG_EVENT_STATUS |
(1U + 4 /* type, flags2 */ + \ 1U + 8 /* type, sql_mode */ + \ 1U + 1 + 255 /* type, length, catalog */ + \ 1U + 4 /* type, auto_increment */ + \ 1U + 6 /* type, charset */ + \ 1U + 1 + 255 /* type, length, time_zone */ + \ 1U + 2 /* type, lc_time_names_number */ + \ 1U + 2 /* type, charset_database_number */ + \ 1U + 8 /* type, table_map_for_update */ + \ 1U + 4 /* type, master_data_written */ + \ /* type, db_1, db_2, ... */ \ 1U + (MAX_DBS_IN_EVENT_MTS * (1 + NAME_LEN)) + \ 3U + /* type, microseconds */ + \ 1U + 16 + 1 + 60/* type, user_len, user, host_len, host */)
#define OPTIONS_WRITTEN_TO_BIN_LOG |
(OPTION_AUTO_IS_NULL | OPTION_NO_FOREIGN_KEY_CHECKS | \ OPTION_RELAXED_UNIQUE_CHECKS | OPTION_NOT_AUTOCOMMIT)
OPTIONS_WRITTEN_TO_BIN_LOG are the bits of thd->options which must be written to the binlog. OPTIONS_WRITTEN_TO_BIN_LOG could be written into the Format_description_log_event, so that if later we don't want to replicate a variable we did replicate, or the contrary, it's doable. But it should not be too hard to decide once for all of what we replicate and what we don't, among the fixed 32 bits of thd->options.
I (Guilhem) have read through every option's usage, and it looks like OPTION_AUTO_IS_NULL and OPTION_NO_FOREIGN_KEYS are the only ones which alter how the query modifies the table. It's good to replicate OPTION_RELAXED_UNIQUE_CHECKS too because otherwise, the slave may insert data slower than the master, in InnoDB. OPTION_BIG_SELECTS is not needed (the slave thread runs with max_join_size=HA_POS_ERROR) and OPTION_BIG_TABLES is not needed either, as the manual says (because a too big in-memory temp table is automatically written to disk).
#define SLAVE_MAX_HEARTBEAT_PERIOD 4294967 |
Some of defines are need in parser even though replication is not compiled in (embedded). The maximum is defined as (ULONG_MAX/1000) with 4 bytes ulong
#define TEMP_FILE_MAX_LEN UUID_LENGTH+38 |
Maximum length of the name of a temporary file PREFIX LENGTH - 9 UUID - UUID_LENGTH SEPARATORS - 2 SERVER ID - 10 (range of server ID 1 to (2^32)-1 = 4,294,967,295) FILE ID - 10 (uint) EXTENSION - 7 (Assuming that the extension is always less than 7 characters)
enum Log_event_type |
Enumeration type for the different types of log events.
int append_query_string | ( | THD * | thd, |
const CHARSET_INFO * | csinfo, | ||
String const * | from, | ||
String * | to | ||
) |
Append a version of the 'from' string suitable for use in a query to the 'to' string. To generate a correct escaping, the character set information in 'csinfo' is used.
void do_server_version_split | ( | char * | version, |
uchar | split_versions[3] | ||
) | [inline] |
Splits server 'version' string into three numeric pieces stored into 'split_versions': X.Y.Zabc (X,Y,Z numbers, a not a digit) -> {X,Y,Z} X.Yabc -> {X,Y,0}
bool event_checksum_test | ( | uchar * | event_buf, |
ulong | event_len, | ||
uint8 | alg | ||
) |
even_buf | point to the buffer containing serialized event |
event_len | length of the event accounting possible checksum alg |
uint8 get_checksum_alg | ( | const char * | buf, |
ulong | len | ||
) |
buf | buffer holding serialized FD event |
len | netto (possible checksum is stripped off) length of the event buf |
char* str_to_hex | ( | char * | to, |
const char * | from, | ||
uint | len | ||
) |
Transforms a string into "" or its expression in 0x... form.