MySQL  8.0.23
Source Code Documentation
binary_log::Rotate_event Class Reference

#include <control_events.h>

Inheritance diagram for binary_log::Rotate_event:
binary_log::Binary_log_event Rotate_log_event

Public Types

enum  { DUP_NAME = 2, RELAY_LOG = 4 }
 
enum  { R_POS_OFFSET = 0, R_IDENT_OFFSET = 8 }
 
- 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,
  TRANSACTION_PAYLOAD_HEADER_LEN = 0
}
 The lengths for the fixed data part of each event. More...
 

Public Member Functions

 Rotate_event (const char *new_log_ident_arg, size_t ident_len_arg, unsigned int flags_arg, uint64_t pos_arg)
 This is the minimal constructor, it will set the type code as ROTATE_EVENT. More...
 
 Rotate_event (const char *buf, const Format_description_event *fde)
 The layout of Rotate_event data part is as follows: More...
 
 ~Rotate_event () override
 
- 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

const char * new_log_ident
 
size_t ident_len
 
unsigned int flags
 
uint64_t pos
 

Additional Inherited Members

- Static Public Attributes inherited from binary_log::Binary_log_event
static const int LOG_EVENT_TYPES = (ENUM_END_EVENT - 1)
 
- 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...
 

Detailed Description

When a binary log file exceeds a size limit, a ROTATE_EVENT is written at the end of the file that points to the next file in the squence. This event is information for the slave to know the name of the next binary log it is going to receive.

ROTATE_EVENT is generated locally and written to the binary log on the master. It is written to the relay log on the slave when FLUSH LOGS occurs, and when receiving a ROTATE_EVENT from the master. In the latter case, there will be two rotate events in total originating on different servers.

Binary Format

Post-Header for Rotate_event
Name Format

Description

position 8 byte integer

The position within the binary log to rotate to.

The Body has one component:

Body for Rotate_event
Name Format

Description

new_log_ident variable length string without trailing zero, extending to the end of the event (determined by the length field of the Common-Header)

Name of the binlog to rotate to.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DUP_NAME 
RELAY_LOG 

◆ anonymous enum

anonymous enum
Enumerator
R_POS_OFFSET 
R_IDENT_OFFSET 

Constructor & Destructor Documentation

◆ Rotate_event() [1/2]

binary_log::Rotate_event::Rotate_event ( const char *  new_log_ident_arg,
size_t  ident_len_arg,
unsigned int  flags_arg,
uint64_t  pos_arg 
)
inline

This is the minimal constructor, it will set the type code as ROTATE_EVENT.

◆ Rotate_event() [2/2]

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

The layout of Rotate_event data part is as follows:

+-----------------------------------------------------------------------+
| common_header | post_header | position of the first event | file name |
+-----------------------------------------------------------------------+
Parameters
bufContains the serialized event.
fdeAn FDE event, used to get the following information: -binlog_version -server_version -post_header_len -common_header_len The content of this object depends on the binlog-version currently in use.

◆ ~Rotate_event()

binary_log::Rotate_event::~Rotate_event ( )
inlineoverride

Member Data Documentation

◆ flags

unsigned int binary_log::Rotate_event::flags

◆ ident_len

size_t binary_log::Rotate_event::ident_len

◆ new_log_ident

const char* binary_log::Rotate_event::new_log_ident

◆ pos

uint64_t binary_log::Rotate_event::pos

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