Skip to content

Commit 191b1d1

Browse files
author
Libing Song
committed
WL#10956 Binlog Access API - Step2 Binlog Input Streams
Binlog events are read in a stream pipeline/chain way, like: Byte Stream --> Event Data Stream --> Event Object Stream - Event data is the serialized binlog event. It is a chunk of data in buffer. Event data istream read data from byte stream and organize byte data into event data. - Event object stream trasforms event data to Log_event object. Byte Stream includes: - Binlog_ifile Read binlog files generated on master side - Relaylog_ifile Read binlog files generated on slave side - Mysqlbinlog_ifile Read both master and slave side binlog files through os files or stdin. Event Data Stream includes: - Binlog_event_data_istream Event_data is serialized event object. It is a chunk of data in buffer. Binlog_event_data_istream fetches byte data from Basic_istream and divides them into event_data chunk according to the format. - Mysqlbinlog_event_data_istream Handle a couple of special things from mysqlbinlog Event Object Stream includes: - Binlog_event_object_istream It read event_data from an event data stream and deserialize the event_datas to Log_event object. * Reader classes To make code simple and easy to use the pipeline is encapsulate in to a template class called Basic_binlog_file_reader. It owns a byte stream, an event_data stream and an event object stream. The stream pipeline is setup in constructor. All the objects required for reading a binlog file is initialized in reader class. It also includes some convenient functions to encapsulate the access of the streams. Reader classes have: - Binlog_file_reader - Relaylog_file_reader - Binlog_sender::File_reader - Mysqlbinlog_file_reader
1 parent cf10f4a commit 191b1d1

32 files changed

+1935
-1454
lines changed

client/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ SET(MYSQLBINLOG_LIB_SOURCES
8080
${CMAKE_SOURCE_DIR}/sql/rpl_gtid_set.cc
8181
${CMAKE_SOURCE_DIR}/sql/rpl_gtid_specification.cc
8282
${CMAKE_SOURCE_DIR}/sql/rpl_tblmap.cc
83+
${CMAKE_SOURCE_DIR}/sql/basic_istream.cc
84+
${CMAKE_SOURCE_DIR}/sql/binlog_istream.cc
85+
${CMAKE_SOURCE_DIR}/sql/binlog_reader.cc
8386
)
8487
ADD_LIBRARY(mysqlbinlog_lib STATIC ${MYSQLBINLOG_LIB_SOURCES})
8588
ADD_DEPENDENCIES(mysqlbinlog_lib GenError)

0 commit comments

Comments
 (0)