MySQL 9.1.0
Source Code Documentation
Binlog_iterator_ctx Class Reference

This class holds the context of the iterator. More...

Classes

class  Passthrough_allocator
 This is a passthrough allocator. More...
 

Public Member Functions

 Binlog_iterator_ctx (const Binlog_iterator_ctx &rhs)=delete
 
Binlog_iterator_ctxoperator= (const Binlog_iterator_ctx &rhs)=delete
 
 Binlog_iterator_ctx (bool verify_checksum, const Gtid_set &excluded_gtids)
 
 ~Binlog_iterator_ctx ()
 
bool is_valid () const
 Checks whether the given context is valid or not. More...
 
std::string get_current_file_open () const
 Get the current file open object. More...
 
void set_current_file_open (const std::string &filename)
 Set the current file open object. More...
 
File_readerget_reader ()
 Get the reader object. More...
 
void set_buffer (unsigned char *buffer)
 Set the buffer object. More...
 
unsigned char * get_buffer ()
 Get the buffer object. More...
 
uint64_t get_buffer_capacity () const
 Get the buffer capacity object. More...
 
void set_buffer_capacity (uint64_t buffer_size)
 Set the buffer capacity object. More...
 
void set_fde (const Format_description_event &new_fde)
 Set the fde object. More...
 
const Format_description_eventget_fde () const
 Get the fde object. More...
 
std::tuple< bool, bool, uint64_t > shall_skip_transaction (const unsigned char *buffer)
 This function checks whether the GTID event in the buffer is to be skipped or not. More...
 
bool pin_log_files (const std::string &file)
 Locks the log files in the index that are as recent as the file provided, including the file provided. More...
 
Binlog_iterator_service_get_status open_next_file ()
 This member function opens the next file. More...
 
std::tuple< Binlog_iterator_service_get_status, uint64_t > update_cursor ()
 This member function checks if we need to move the cursor or switch to the next file. More...
 

Private Types

typedef Basic_binlog_file_reader< Binlog_ifile, Binlog_event_data_istream, Binlog_event_object_istream, Passthrough_allocatorFile_reader
 

Private Member Functions

std::pair< bool, std::string > get_next_file_to_open () const
 Get the next file to open object. More...
 

Private Attributes

std::string m_current_file_open {}
 This is the current file opened. More...
 
File_readerm_reader {nullptr}
 This is a reference to the reader of the current file. More...
 
Format_description_event m_current_fde {BINLOG_VERSION, server_version}
 This is a reference to the current format description event. More...
 
Tsid_map m_local_tsid_map {nullptr}
 The local tsid map. More...
 
Gtid_set m_excluded_gtid_set {&m_local_tsid_map}
 This is the set of gtids that are to be excluded while using this iterator. More...
 
unsigned char * m_buffer {nullptr}
 This is a reference to the buffer used to store events read. More...
 
uint64_t m_buffer_size {0}
 This a the capacity of the buffer used to store events read. More...
 
bool m_is_valid {false}
 specifies if this context was properly constructed and therefore is valid. More...
 
Log_info m_linfo {}
 The log file information to lock files from being purged, i.e., the log one is reading from. More...
 

Detailed Description

This class holds the context of the iterator.

The context of the iterator contains runtime data, such as the current file being read from, the reader instantiated, the pointer to the buffer used to store the event read, the set of transactions to be excluded, as well as the current format description event.

Note that we need to store the current format description event to be able to decode the a few events, such as the GTID and the Rotate event.

Member Typedef Documentation

◆ File_reader

Constructor & Destructor Documentation

◆ Binlog_iterator_ctx() [1/2]

Binlog_iterator_ctx::Binlog_iterator_ctx ( const Binlog_iterator_ctx rhs)
delete

◆ Binlog_iterator_ctx() [2/2]

Binlog_iterator_ctx::Binlog_iterator_ctx ( bool  verify_checksum,
const Gtid_set excluded_gtids 
)
inline

◆ ~Binlog_iterator_ctx()

Binlog_iterator_ctx::~Binlog_iterator_ctx ( )
inline

Member Function Documentation

◆ get_buffer()

unsigned char * Binlog_iterator_ctx::get_buffer ( )
inline

Get the buffer object.

Returns
unsigned char* A pointer to the buffer.

◆ get_buffer_capacity()

uint64_t Binlog_iterator_ctx::get_buffer_capacity ( ) const
inline

Get the buffer capacity object.

Returns
uint64_t The buffer capacity.

◆ get_current_file_open()

std::string Binlog_iterator_ctx::get_current_file_open ( ) const
inline

Get the current file open object.

Returns
const std::string the current file opened. If no file is opened, this returns an empty string.

◆ get_fde()

const Format_description_event & Binlog_iterator_ctx::get_fde ( ) const
inline

Get the fde object.

Returns
const Format_description_event& The format description event in use.

◆ get_next_file_to_open()

std::pair< bool, std::string > Binlog_iterator_ctx::get_next_file_to_open ( ) const
inlineprivate

Get the next file to open object.

Returns
a pair containing an boolean stating whether there was an error or not and the filename. If there was an error, the filename is empty.

◆ get_reader()

File_reader & Binlog_iterator_ctx::get_reader ( )
inline

Get the reader object.

Returns
File_reader& The current reader.

◆ is_valid()

bool Binlog_iterator_ctx::is_valid ( void  ) const
inline

Checks whether the given context is valid or not.

Returns
true if the context is valid, false otherwise.

◆ open_next_file()

Binlog_iterator_service_get_status Binlog_iterator_ctx::open_next_file ( )
inline

This member function opens the next file.

Returns
kBinlogIteratorGetEndOfChanges if there are no more files to open
kBinlogIteratorGetErrorUnspecified if failed to open the file.
kBinlogIteratorGetOk on successful open file.

◆ operator=()

Binlog_iterator_ctx & Binlog_iterator_ctx::operator= ( const Binlog_iterator_ctx rhs)
delete

◆ pin_log_files()

bool Binlog_iterator_ctx::pin_log_files ( const std::string &  file)
inline

Locks the log files in the index that are as recent as the file provided, including the file provided.

Parameters
filethe file to pin. All other subsequent and more recent are also pinned.
Returns
false if success, true otherwise.

◆ set_buffer()

void Binlog_iterator_ctx::set_buffer ( unsigned char *  buffer)
inline

Set the buffer object.

Parameters
bufferA pointer to the buffer.

◆ set_buffer_capacity()

void Binlog_iterator_ctx::set_buffer_capacity ( uint64_t  buffer_size)
inline

Set the buffer capacity object.

Parameters
buffer_sizeThe buffer capacity.

◆ set_current_file_open()

void Binlog_iterator_ctx::set_current_file_open ( const std::string &  filename)
inline

Set the current file open object.

Parameters
filenamethe name of the current file opened.

◆ set_fde()

void Binlog_iterator_ctx::set_fde ( const Format_description_event new_fde)
inline

Set the fde object.

Parameters
new_fdeThe new format description event to be copied.

◆ shall_skip_transaction()

std::tuple< bool, bool, uint64_t > Binlog_iterator_ctx::shall_skip_transaction ( const unsigned char *  buffer)
inline

This function checks whether the GTID event in the buffer is to be skipped or not.

Parameters
bufferContains the GTID event serialized.
Returns
std::tuple<bool, bool, uint64_t> A triple containing a boolean stating whether there was an error, a boolean stating whether the transaction is to be skipped or not and the size of the transaction.

◆ update_cursor()

std::tuple< Binlog_iterator_service_get_status, uint64_t > Binlog_iterator_ctx::update_cursor ( )
inline

This member function checks if we need to move the cursor or switch to the next file.

Returns
std::tuple<kBinlogIteratorGetEndOfChanges, 0> If there are no more changes to move the cursor to.
std::tuple<kBinlogIteratorGetErrorUnspecified, 0> If there was an unspecified error.
std::tuple<kBinlogIteratorGetOk, n> If the repositioning of the cursor was successful. On the second element of the tuple we return the size of the entry to be read.

Member Data Documentation

◆ m_buffer

unsigned char* Binlog_iterator_ctx::m_buffer {nullptr}
private

This is a reference to the buffer used to store events read.

◆ m_buffer_size

uint64_t Binlog_iterator_ctx::m_buffer_size {0}
private

This a the capacity of the buffer used to store events read.

◆ m_current_fde

Format_description_event Binlog_iterator_ctx::m_current_fde {BINLOG_VERSION, server_version}
private

This is a reference to the current format description event.

◆ m_current_file_open

std::string Binlog_iterator_ctx::m_current_file_open {}
private

This is the current file opened.

◆ m_excluded_gtid_set

Gtid_set Binlog_iterator_ctx::m_excluded_gtid_set {&m_local_tsid_map}
private

This is the set of gtids that are to be excluded while using this iterator.

◆ m_is_valid

bool Binlog_iterator_ctx::m_is_valid {false}
private

specifies if this context was properly constructed and therefore is valid.

◆ m_linfo

Log_info Binlog_iterator_ctx::m_linfo {}
private

The log file information to lock files from being purged, i.e., the log one is reading from.

◆ m_local_tsid_map

Tsid_map Binlog_iterator_ctx::m_local_tsid_map {nullptr}
private

The local tsid map.

◆ m_reader

File_reader* Binlog_iterator_ctx::m_reader {nullptr}
private

This is a reference to the reader of the current file.


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