MySQL  8.0.18
Source Code Documentation
binary_log::Append_block_event Class Reference

This event is created to contain the file data. More...

#include <load_data_events.h>

Inheritance diagram for binary_log::Append_block_event:
binary_log::Binary_log_event Append_block_log_event binary_log::Begin_load_query_event Begin_load_query_log_event Begin_load_query_log_event

Public Types

enum  Append_block_offset { AB_FILE_ID_OFFSET = 0, AB_DATA_OFFSET = APPEND_BLOCK_HEADER_LEN }
 
- Public Types inherited from binary_log::Binary_log_event
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...
 

Public Member Functions

 Append_block_event (const char *buf, const Format_description_event *fde)
 Appends the buffered data, received as a parameter, to the file being loaded via LOAD_DATA_FILE. More...
 
 ~Append_block_event ()
 
- Public Member Functions inherited from binary_log::Binary_log_event
virtual ~Binary_log_event ()=0
 
 Binary_log_event (const Binary_log_event &)=default
 
 Binary_log_event (Binary_log_event &&)=default
 
Binary_log_eventoperator= (const Binary_log_event &)=default
 
Binary_log_eventoperator= (Binary_log_event &&)=default
 
enum Log_event_type get_event_type () const
 Helper method. More...
 
const Log_event_headerheader () const
 Return a const pointer to the header of the log event. More...
 
Log_event_headerheader ()
 Return a non-const pointer to the header of the log event. More...
 
const Log_event_footerfooter () const
 Return a const pointer to the footer of the log event. More...
 
Log_event_footerfooter ()
 Return a non-const pointer to the footer of the log event. More...
 
Event_readerreader ()
 Returns a reference to the event Event_reader object. More...
 

Public Attributes

unsigned char * block
 
unsigned int block_len
 
uint32_t file_id
 
const char * db
 'db' is filled when the event is created in mysql_load() (the event needs to have a 'db' member to be well filtered by binlog-*-db rules). More...
 

Protected Member Functions

 Append_block_event (const char *db_arg, unsigned char *block_arg, unsigned int block_len_arg, uint32_t file_id_arg)
 This constructor is used by the MySQL server. More...
 
 Append_block_event (Log_event_type type_arg=APPEND_BLOCK_EVENT)
 
- Protected Member Functions inherited from binary_log::Binary_log_event
 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...
 

Additional Inherited Members

- Static Public Attributes inherited from binary_log::Binary_log_event
static const int LOG_EVENT_TYPES = (ENUM_END_EVENT - 1)
 

Detailed Description

This event is created to contain the file data.

One LOAD_DATA_INFILE can have 0 or more instances of this event written to the binary log depending on the size of the file. If the file to be loaded is greater than the threshold value, which is roughly 2^17 bytes, the file is divided into blocks of size equal to the threshold, and each block is sent across as a separate event.

Binary Format

The post header contains the following:

Post header for Append_block_event
Name Format

Description

file_id 32 bit integer The ID of the file to append the block to

The body of the event contains the raw data to load. The raw data size is the event size minus the size of all the fixed event parts.

Member Enumeration Documentation

◆ Append_block_offset

Enumerator
AB_FILE_ID_OFFSET 

AB = "Append Block".

AB_DATA_OFFSET 

Constructor & Destructor Documentation

◆ Append_block_event() [1/3]

binary_log::Append_block_event::Append_block_event ( const char *  db_arg,
unsigned char *  block_arg,
unsigned int  block_len_arg,
uint32_t  file_id_arg 
)
inlineprotected

This constructor is used by the MySQL server.

◆ Append_block_event() [2/3]

binary_log::Append_block_event::Append_block_event ( Log_event_type  type_arg = APPEND_BLOCK_EVENT)
inlineprotected

◆ Append_block_event() [3/3]

binary_log::Append_block_event::Append_block_event ( const char *  buf,
const Format_description_event fde 
)

Appends the buffered data, received as a parameter, to the file being loaded via LOAD_DATA_FILE.

The buffer layout for fixed data part is as follows:

+---------+
| file_id |
+---------+

The buffer layout for variable data part is as follows:

+-------------------+
| block | block_len |
+-------------------+
Parameters
bufContains the serialized event.
fdeAn FDE event (see Rotate_event constructor for more info).

◆ ~Append_block_event()

binary_log::Append_block_event::~Append_block_event ( )
inline

Member Data Documentation

◆ block

unsigned char* binary_log::Append_block_event::block

◆ block_len

unsigned int binary_log::Append_block_event::block_len

◆ db

const char* binary_log::Append_block_event::db

'db' is filled when the event is created in mysql_load() (the event needs to have a 'db' member to be well filtered by binlog-*-db rules).

'db' is not written to the binlog (it's not used by Append_block_log_event::write()), so it can't be read in the Append_block_event(const char* buf, int event_len) constructor. In other words, 'db' is used only for filtering by binlog-*-db rules. Create_file_event is different: it's 'db' (which is inherited from Load_event) is written to the binlog and can be re-read.

◆ file_id

uint32_t binary_log::Append_block_event::file_id

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