|
enum | row_lookup_mode {
ROW_LOOKUP_UNDEFINED = 0,
ROW_LOOKUP_NOT_NEEDED = 1,
ROW_LOOKUP_INDEX_SCAN = 2,
ROW_LOOKUP_TABLE_SCAN = 3,
ROW_LOOKUP_HASH_SCAN = 4
} |
|
enum | enum_error {
ERR_OPEN_FAILURE = -1,
ERR_OK = 0,
ERR_TABLE_LIMIT_EXCEEDED = 1,
ERR_OUT_OF_MEM = 2,
ERR_BAD_TABLE_DEF = 3,
ERR_RBR_TO_SBR = 4
} |
| Enumeration of the errors that can be returned. More...
|
|
enum | { RLE_NO_FLAGS = 0U
} |
|
typedef uint16 | flag_set |
|
enum | enum_flag { STMT_END_F = (1U << 0),
NO_FOREIGN_KEY_CHECKS_F = (1U << 1),
RELAXED_UNIQUE_CHECKS_F = (1U << 2),
COMPLETE_ROWS_F = (1U << 3)
} |
| These definitions allow to combine the flags into an appropriate flag set using the normal bitwise operators. More...
|
|
enum | enum_post_header_length {
QUERY_HEADER_MINIMAL_LEN = (4 + 4 + 1 + 2),
QUERY_HEADER_LEN = (QUERY_HEADER_MINIMAL_LEN + 2),
STOP_HEADER_LEN = 0,
START_V3_HEADER_LEN = (2 + ST_SERVER_VER_LEN + 4),
ROTATE_HEADER_LEN = 8,
INTVAR_HEADER_LEN = 0,
APPEND_BLOCK_HEADER_LEN = 4,
DELETE_FILE_HEADER_LEN = 4,
RAND_HEADER_LEN = 0,
USER_VAR_HEADER_LEN = 0,
FORMAT_DESCRIPTION_HEADER_LEN = (START_V3_HEADER_LEN + 1 + LOG_EVENT_TYPES),
XID_HEADER_LEN = 0,
BEGIN_LOAD_QUERY_HEADER_LEN = APPEND_BLOCK_HEADER_LEN,
ROWS_HEADER_LEN_V1 = 8,
TABLE_MAP_HEADER_LEN = 8,
EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN = (4 + 4 + 4 + 1),
EXECUTE_LOAD_QUERY_HEADER_LEN,
INCIDENT_HEADER_LEN = 2,
HEARTBEAT_HEADER_LEN = 0,
IGNORABLE_HEADER_LEN = 0,
ROWS_HEADER_LEN_V2 = 10,
TRANSACTION_CONTEXT_HEADER_LEN = 18,
VIEW_CHANGE_HEADER_LEN = 52,
XA_PREPARE_HEADER_LEN = 0
} |
| The lengths for the fixed data part of each event. More...
|
|
enum | enum_skip_reason { EVENT_SKIP_NOT,
EVENT_SKIP_IGNORE,
EVENT_SKIP_COUNT
} |
| Enumeration of what kinds of skipping (and non-skipping) that can occur when the slave executes an event. More...
|
|
|
| ~Rows_log_event () override |
|
void | set_flags (flag_set flags_arg) |
|
void | clear_flags (flag_set flags_arg) |
|
flag_set | get_flags (flag_set flags_arg) const |
|
virtual Log_event_type | get_general_type_code ()=0 |
|
virtual int | pack_info (Protocol *protocol) override |
| Stores a string representation of this event in the Protocol. More...
|
|
int | add_row_data (uchar *data, size_t length) |
|
virtual size_t | get_data_size () override |
|
MY_BITMAP const * | get_cols () const |
|
MY_BITMAP const * | get_cols_ai () const |
|
size_t | get_width () const |
|
const Table_id & | get_table_id () const |
|
virtual bool | read_write_bitmaps_cmp (const TABLE *table) const =0 |
| Compares the table's read/write_set with the columns included in this event's before-image and/or after-image. More...
|
|
virtual bool | write_data_header (Basic_ostream *ostream) override |
|
virtual bool | write_data_body (Basic_ostream *ostream) override |
|
virtual const char * | get_db () override |
|
| Rows_event (Log_event_type type_arg) |
| Constructs an event directly. More...
|
|
| Rows_event (const char *buf, const Format_description_event *fde) |
| The constructor is responsible for decoding the event contained in the buffer. More...
|
|
virtual | ~Rows_event () |
|
unsigned long long | get_table_id () const |
|
enum_flag | get_flags () const |
|
uint32_t | get_null_bits_len () const |
|
unsigned long | get_width () const |
|
virtual | ~Binary_log_event ()=0 |
|
| Binary_log_event (const Binary_log_event &)=default |
|
| Binary_log_event (Binary_log_event &&)=default |
|
Binary_log_event & | operator= (const Binary_log_event &)=default |
|
Binary_log_event & | operator= (Binary_log_event &&)=default |
|
enum Log_event_type | get_event_type () const |
| Helper method. More...
|
|
const Log_event_header * | header () const |
| Return a const pointer to the header of the log event. More...
|
|
Log_event_header * | header () |
| Return a non-const pointer to the header of the log event. More...
|
|
const Log_event_footer * | footer () const |
| Return a const pointer to the footer of the log event. More...
|
|
Log_event_footer * | footer () |
| Return a non-const pointer to the footer of the log event. More...
|
|
Event_reader & | reader () |
| Returns a reference to the event Event_reader object. More...
|
|
| Log_event (Log_event_header *header, Log_event_footer *footer, enum_event_cache_type cache_type_arg, enum_event_logging_type logging_type_arg) |
| This minimal constructor is for when you are not even sure that there is a valid THD. More...
|
|
| Log_event (THD *thd_arg, uint16 flags_arg, enum_event_cache_type cache_type_arg, enum_event_logging_type logging_type_arg, Log_event_header *header, Log_event_footer *footer) |
|
int | net_send (Protocol *protocol, const char *log_name, my_off_t pos) |
| Only called by SHOW BINLOG EVENTS. More...
|
|
void * | operator new (size_t size) |
|
bool | wrapper_my_b_safe_write (Basic_ostream *ostream, const uchar *buf, size_t data_length) |
| Write the given buffer to the given output stream, updating the checksum if checksums are enabled. More...
|
|
virtual bool | write (Basic_ostream *ostream) |
|
time_t | get_time () |
| Prints a "session_var=value" string. More...
|
|
Log_event_type | get_type_code () const |
|
virtual bool | is_sbr_logging_format () const |
| Return true if the event has to be logged using SBR for DMLs. More...
|
|
bool | is_valid () |
|
void | set_artificial_event () |
|
void | set_relay_log_event () |
|
bool | is_artificial_event () const |
|
bool | is_relay_log_event () const |
|
bool | is_ignorable_event () const |
|
bool | is_no_filter_event () const |
|
bool | is_using_trans_cache () const |
|
bool | is_using_stmt_cache () const |
|
bool | is_using_immediate_logging () const |
|
| Log_event (Log_event_header *header, Log_event_footer *footer) |
|
virtual | ~Log_event () |
|
void | register_temp_buf (char *buf, bool free_in_destructor=true) |
|
void | free_temp_buf () |
|
const char * | get_type_str () const |
| Returns the human readable name of this event's type. More...
|
|
bool | is_mts_sequential_exec () |
| Is called from get_mts_execution_mode() to. More...
|
|
virtual uint8 | get_mts_dbs (Mts_db_names *arg, Rpl_filter *rpl_filter) |
| The method fills in pointers to event's database name c-strings to a supplied array. More...
|
|
bool | contains_partition_info (bool) |
|
virtual uint8 | mts_number_dbs () |
|
bool | is_mts_group_isolated () |
|
virtual bool | starts_group () const |
| Events of a certain type can start or end a group of events treated transactionally wrt binlog. More...
|
|
virtual bool | ends_group () const |
|
int | apply_event (Relay_log_info *rli) |
| Apply the event to the database. More...
|
|
int | apply_gtid_event (Relay_log_info *rli) |
| Apply the GTID event in curr_group_data to the database. More...
|
|
int | update_pos (Relay_log_info *rli) |
| Update the relay log position. More...
|
|
enum_skip_reason | shall_skip (Relay_log_info *rli) |
| Decide if the event shall be skipped, and the reason for skipping it. More...
|
|
virtual int | do_apply_event_worker (Slave_worker *w) |
|
|
| Rows_log_event (THD *, TABLE *, const Table_id &table_id, MY_BITMAP const *cols, bool is_transactional, Log_event_type event_type, const unsigned char *extra_row_ndb_info) |
|
| Rows_log_event (const char *row_data, const Format_description_event *description_event) |
|
virtual int | do_add_row_data (uchar *data, size_t length) |
|
int | unpack_current_row (const Relay_log_info *const rli, MY_BITMAP const *cols, bool is_after_image, bool only_seek=false) |
| Unpack the current row image from the event into m_table->record[0]. More...
|
|
void | decide_row_lookup_algorithm_and_key () |
|
int | row_operations_scan_and_key_setup () |
|
int | row_operations_scan_and_key_teardown (int error) |
|
bool | is_auto_inc_in_extra_columns () |
| Helper function to check whether there is an auto increment column on the table where the event is to be applied. More...
|
|
bool | is_rbr_logging_format () const override |
| Return true if the event has to be logged using RBR for DMLs. More...
|
|
| Binary_log_event (Log_event_type type_code) |
| This constructor is used to initialize the type_code of header object m_header. More...
|
|
| Binary_log_event (const char **buf, const Format_description_event *fde) |
| This constructor will create a new object of Log_event_header and initialize the variable m_header, which in turn will be used to initialize Log_event's member common_header. More...
|
|
uint32 | write_header_to_memory (uchar *buf) |
| Writes the common header of this event to the given memory buffer. More...
|
|
bool | write_header (Basic_ostream *ostream, size_t data_length) |
| Writes the common-header of this event to the given output stream and updates the checksum. More...
|
|
bool | write_footer (Basic_ostream *ostream) |
|
bool | need_checksum () |
| A decider of whether to trigger checksum computation or not. More...
|
|
enum_skip_reason | continue_group (Relay_log_info *rli) |
| Helper function to ignore an event w.r.t. More...
|
|
|
static std::string | get_flag_string (enum_flag flag) |
|
static void | init_show_field_list (List< Item > *field_list) |
| init_show_field_list() prepares the column names and types for the output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG EVENTS. More...
|
|
static void | operator delete (void *ptr, size_t) |
|
static void * | operator new (size_t, void *ptr) |
|
static void | operator delete (void *, void *) |
|
static const char * | get_type_str (Log_event_type type) |
| Returns the human readable name of the given event type. More...
|
|
static const int | LOG_EVENT_TYPES = (ENUM_END_EVENT - 1) |
|
enum | enum_event_cache_type {
EVENT_INVALID_CACHE = 0,
EVENT_STMT_CACHE,
EVENT_TRANSACTIONAL_CACHE,
EVENT_NO_CACHE,
EVENT_CACHE_COUNT
} |
|
enum | enum_event_logging_type { EVENT_INVALID_LOGGING = 0,
EVENT_NORMAL_LOGGING,
EVENT_IMMEDIATE_LOGGING,
EVENT_CACHE_LOGGING_COUNT
} |
|
Common base class for all row-containing log events.
RESPONSIBILITIES
Encode the common parts of all events containing rows, which are:
- Write data header and data body to an IO_CACHE.
Virtual inheritance is required here to handle the diamond problem in the class Write_rows_log_event, Update_rows_log_event and Delete_rows_log_event. The diamond structure is explained in Write_rows_log_event
, Update_rows_log_event
, Delete_rows_log_event
Primitive to apply an event to the database.
This is where the change to the database is made.
- Note
- The primitive is protected instead of private, since there is a hierarchy of actions to be performed in some cases.
- See also
- Format_description_log_event::do_apply_event()
- Parameters
-
rli | Pointer to relay log info structure |
- Return values
-
0 | Event applied successfully |
errno | Error code if event application failed |
When using RBR and MyISAM MERGE tables the base tables that make up the MERGE table can be appended to the list of tables to lock.
Thus, we just check compatibility for those that tables that have a correspondent table map event (ie, those that are actually going to be accessed while applying the event). That's why the loop stops at rli->tables_to_lock_count .
NOTE: The base tables are added here are removed when close_thread_tables is called.
Skip update rows events that don't have data for this slave's table.
If there are no columns marked in the read_set for this table, that means that we cannot lookup any row using the available BI in the binarr log. Thence, we immediatly raise an error: HA_ERR_END_OF_FILE.
Reimplemented from Log_event.
This member function scans the table and applies the changes that had been previously hashed.
As such, m_hash MUST be filled by do_hash_row before calling this member function.
- Parameters
-
rli | The reference to the relay log info object. |
- Returns
- 0 on success. Otherwise, the error code.
The do..while loop takes care of the scenario of same row being updated more than once within a single Update_rows_log_event by performing the hash lookup for the updated_row(by taking the AI stored in table->record[0] after the ha_update_row()) when table has no primary key.
This can happen when update is called from a stored function. Ex: CREATE FUNCTION f1 () RETURNS INT BEGIN UPDATE t1 SET a = 2 WHERE a = 1; UPDATE t1 SET a = 3 WHERE a = 2; RETURN 0; END
If there are collisions we need to be sure that this is indeed the record we want. Loop through all records for the given key and explicitly compare them against the record we got from the storage engine.
We found the entry we needed, just apply the changes.
At this point, both table->record[0] and table->record[1] have the SE row that matched the one in the hash table.
Thence if this is a DELETE we wouldn't need to mess around with positions anymore, but since this can be an update, we need to provide positions so that AI is unpacked correctly to table->record[0] in UPDATE implementation of do_exec_row().
if the rbr_exec_mode is set to Idempotent, we cannot expect the hash to be empty. In such cases we count the number of idempotent errors and check if it is equal to or greater than the number of rows left in the hash.
Reset the last positions, because the positions are lost while handling entries in the hash.