MySQL 9.1.0
Source Code Documentation
Binlog_event_writer Class Reference

Auxiliary class to copy serialized events to the binary log and correct some of the fields that are not known until just before writing the event. More...

Inheritance diagram for Binlog_event_writer:
[legend]

Public Member Functions

 Binlog_event_writer (MYSQL_BIN_LOG::Binlog_ofile *binlog_file)
 Constructs a new Binlog_event_writer. More...
 
void update_header ()
 
bool write (const unsigned char *buffer, my_off_t length) override
 Write some bytes into the output stream. More...
 
bool is_checksum_enabled ()
 Returns true if per event checksum is enabled. More...
 
- Public Member Functions inherited from Basic_ostream
virtual ~Basic_ostream ()=default
 

Private Attributes

MYSQL_BIN_LOG::Binlog_ofilem_binlog_file
 
bool have_checksum
 
ha_checksum initial_checksum
 
ha_checksum checksum
 
uint32 end_log_pos
 
uchar header [LOG_EVENT_HEADER_LEN]
 
my_off_t header_len = 0
 
uint32 event_len = 0
 

Detailed Description

Auxiliary class to copy serialized events to the binary log and correct some of the fields that are not known until just before writing the event.

This class allows feeding events in parts, so it is practical to use in do_write_cache() which reads events from an IO_CACHE where events may span multiple cache pages.

The following fields are fixed before writing the event:

  • end_log_pos is set
  • the checksum is computed if checksums are enabled
  • the length is incremented by the checksum size if checksums are enabled

Constructor & Destructor Documentation

◆ Binlog_event_writer()

Binlog_event_writer::Binlog_event_writer ( MYSQL_BIN_LOG::Binlog_ofile binlog_file)
inline

Constructs a new Binlog_event_writer.

Should be called once before starting to flush the transaction or statement cache to the binlog.

Parameters
binlog_fileto write to.

Member Function Documentation

◆ is_checksum_enabled()

bool Binlog_event_writer::is_checksum_enabled ( )
inline

Returns true if per event checksum is enabled.

◆ update_header()

void Binlog_event_writer::update_header ( )
inline

◆ write()

bool Binlog_event_writer::write ( const unsigned char *  buffer,
my_off_t  length 
)
inlineoverridevirtual

Write some bytes into the output stream.

When all data is written into the stream successfully, then it return false. Otherwise, true is returned. It will never returns false when partial data is written into the stream.

Parameters
[in]bufferData to be written
[in]lengthLength of the data
Return values
falseSuccess.
trueError.

Implements Basic_ostream.

Member Data Documentation

◆ checksum

ha_checksum Binlog_event_writer::checksum
private

◆ end_log_pos

uint32 Binlog_event_writer::end_log_pos
private

◆ event_len

uint32 Binlog_event_writer::event_len = 0
private

◆ have_checksum

bool Binlog_event_writer::have_checksum
private

◆ header

uchar Binlog_event_writer::header[LOG_EVENT_HEADER_LEN]
private

◆ header_len

my_off_t Binlog_event_writer::header_len = 0
private

◆ initial_checksum

ha_checksum Binlog_event_writer::initial_checksum
private

◆ m_binlog_file

MYSQL_BIN_LOG::Binlog_ofile* Binlog_event_writer::m_binlog_file
private

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