MySQL 26.7.0
Source Code Documentation
mysql::csa::Fetchable_transaction Class Reference

Opaque for transaction, that is able to fetch itself in parts from the storage on demand. More...

#include <fetchable_transaction.h>

Public Types

using Return_status = mysql::utils::Return_status
 

Public Member Functions

 Fetchable_transaction ()
 Fetch function is supplied by a specific storage implementation. More...
 
 Fetchable_transaction (Event_set_fetchable_list &&fetch_object)
 
 Fetchable_transaction (const Fetchable_transaction &)=delete
 
 Fetchable_transaction (Fetchable_transaction &&)=delete
 
virtual ~Fetchable_transaction ()
 Destructor. More...
 
bool wait_next ()
 Fetches consecutive events from the storage, until done or error occurs. More...
 
std::optional< Managed_eventfetch_next ()
 
bool is_fetching_error () const
 Returs true when fetching failed. More...
 
bool is_fetching_done () const
 Checks current status of the object. More...
 
bool is_truncated () const
 Checks whether fetching stopped because the metadata stream was truncated. More...
 
std::size_t get_max_event_length () const
 Returns the maximum event length published for this transaction. More...
 
void reset_fetching (bool all)
 Reset the status of the Featchable job allowing it to be re-read from the storage. More...
 
std::string get_fetch_error_msg () const
 Accesses fetch error message. More...
 
bool is_trx () const
 Returns information on whether this is actual transaction (transaction starting with a GTID) More...
 
void set_success ()
 Marks that transaction committed succesfully, success callback. More...
 
Format_description_log_eventget_fde ()
 Obtains non-owning pointer to current FDE. More...
 
void set_fetching_done ()
 Mark that fetching is successfully done, even if transaction was not fully read. More...
 
void append_batch (Event_set_fetchable_ptr batch)
 Appends a new fetchable batch for this transaction. More...
 
void set_fetching_complete ()
 Seals transaction metadata stream. No more batches will be appended. More...
 
void update_max_event_length (std::size_t event_length)
 Updates the maximum event length published for this transaction. More...
 
void set_fetching_truncated ()
 Marks transaction metadata stream as truncated. More...
 

Private Member Functions

Event_set_fetchablewait_for_current_batch ()
 Waits until a current batch becomes available or fetching reaches a terminal state. More...
 
bool advance_finished_batch_unsafe (Event_set_fetchable *event_batch)
 Advances to the next batch if the current one has finished. More...
 
std::optional< Event_set_fetchable * > get_current_event_batch_unsafe ()
 Iterates over event sets, picking a correct batch. More...
 

Private Attributes

std::string m_error_message
 Detailed error message if error appears. More...
 
Return_status m_status
 Internal status of event. More...
 
bool m_is_done {false}
 True when the consumer-side fetch stream reached a terminal state. More...
 
bool m_is_complete {false}
 True when reader has finished appending batches. More...
 
std::atomic< std::size_t > m_max_event_length {0}
 Maximum event length published for this transaction. More...
 
std::atomic< bool > m_is_truncated {false}
 True when reader marked metadata stream as truncated. More...
 
std::mutex m_mutex
 Guard for concurrent producer (reader) and consumer (worker). More...
 
std::condition_variable m_cv
 Notification for appended batches / terminal state updates. More...
 
Event_set_fetchable_list m_event_set_batches
 Object used to fetch transaction events from the storage. More...
 
Event_set_fetchable_list::iterator m_current_batch_it
 Currently processed event batch iterator. More...
 

Detailed Description

Opaque for transaction, that is able to fetch itself in parts from the storage on demand.

Function to fetch an event is supplied by the specific storage implementation.

Member Typedef Documentation

◆ Return_status

Constructor & Destructor Documentation

◆ Fetchable_transaction() [1/4]

mysql::csa::Fetchable_transaction::Fetchable_transaction ( )

Fetch function is supplied by a specific storage implementation.

◆ Fetchable_transaction() [2/4]

mysql::csa::Fetchable_transaction::Fetchable_transaction ( Event_set_fetchable_list &&  fetch_object)

◆ Fetchable_transaction() [3/4]

mysql::csa::Fetchable_transaction::Fetchable_transaction ( const Fetchable_transaction )
delete

◆ Fetchable_transaction() [4/4]

mysql::csa::Fetchable_transaction::Fetchable_transaction ( Fetchable_transaction &&  )
delete

◆ ~Fetchable_transaction()

mysql::csa::Fetchable_transaction::~Fetchable_transaction ( )
virtual

Destructor.

Member Function Documentation

◆ advance_finished_batch_unsafe()

bool mysql::csa::Fetchable_transaction::advance_finished_batch_unsafe ( Event_set_fetchable event_batch)
private

Advances to the next batch if the current one has finished.

Parameters
event_batchCurrent batch being processed.
Return values
trueThe whole transaction finished.
falseThere may still be more events or batches to fetch.

◆ append_batch()

void mysql::csa::Fetchable_transaction::append_batch ( Event_set_fetchable_ptr  batch)

Appends a new fetchable batch for this transaction.

◆ fetch_next()

std::optional< Managed_event > mysql::csa::Fetchable_transaction::fetch_next ( )

◆ get_current_event_batch_unsafe()

std::optional< Event_set_fetchable * > mysql::csa::Fetchable_transaction::get_current_event_batch_unsafe ( )
private

Iterates over event sets, picking a correct batch.

◆ get_fde()

Format_description_log_event * mysql::csa::Fetchable_transaction::get_fde ( )

Obtains non-owning pointer to current FDE.

Returns
Non-owning pointer to current FDE

◆ get_fetch_error_msg()

std::string mysql::csa::Fetchable_transaction::get_fetch_error_msg ( ) const

Accesses fetch error message.

Returns
Fetch error information

◆ get_max_event_length()

std::size_t mysql::csa::Fetchable_transaction::get_max_event_length ( ) const

Returns the maximum event length published for this transaction.

◆ is_fetching_done()

bool mysql::csa::Fetchable_transaction::is_fetching_done ( ) const

Checks current status of the object.

Returns
True when fetching is completed, false otherwise

◆ is_fetching_error()

bool mysql::csa::Fetchable_transaction::is_fetching_error ( ) const

Returs true when fetching failed.

Returns
True when fetching failed, false otherwise

◆ is_truncated()

bool mysql::csa::Fetchable_transaction::is_truncated ( ) const

Checks whether fetching stopped because the metadata stream was truncated.

Returns
True when fetching stopped on truncation, false otherwise

◆ is_trx()

bool mysql::csa::Fetchable_transaction::is_trx ( ) const

Returns information on whether this is actual transaction (transaction starting with a GTID)

◆ reset_fetching()

void mysql::csa::Fetchable_transaction::reset_fetching ( bool  all)

Reset the status of the Featchable job allowing it to be re-read from the storage.

Parameters
allWhen true, internal object states must be reset

◆ set_fetching_complete()

void mysql::csa::Fetchable_transaction::set_fetching_complete ( )

Seals transaction metadata stream. No more batches will be appended.

◆ set_fetching_done()

void mysql::csa::Fetchable_transaction::set_fetching_done ( )

Mark that fetching is successfully done, even if transaction was not fully read.

◆ set_fetching_truncated()

void mysql::csa::Fetchable_transaction::set_fetching_truncated ( )

Marks transaction metadata stream as truncated.

◆ set_success()

void mysql::csa::Fetchable_transaction::set_success ( )

Marks that transaction committed succesfully, success callback.

◆ update_max_event_length()

void mysql::csa::Fetchable_transaction::update_max_event_length ( std::size_t  event_length)

Updates the maximum event length published for this transaction.

◆ wait_for_current_batch()

Event_set_fetchable * mysql::csa::Fetchable_transaction::wait_for_current_batch ( )
private

Waits until a current batch becomes available or fetching reaches a terminal state.

Returns
Current batch pointer or nullptr in terminal state.

◆ wait_next()

bool mysql::csa::Fetchable_transaction::wait_next ( )

Fetches consecutive events from the storage, until done or error occurs.

Returns
Managed event object in case it was successfully fetched from the storage, empty object in case stream is done or error occurred

Member Data Documentation

◆ m_current_batch_it

Event_set_fetchable_list::iterator mysql::csa::Fetchable_transaction::m_current_batch_it
private

Currently processed event batch iterator.

◆ m_cv

std::condition_variable mysql::csa::Fetchable_transaction::m_cv
private

Notification for appended batches / terminal state updates.

◆ m_error_message

std::string mysql::csa::Fetchable_transaction::m_error_message
private

Detailed error message if error appears.

◆ m_event_set_batches

Event_set_fetchable_list mysql::csa::Fetchable_transaction::m_event_set_batches
private

Object used to fetch transaction events from the storage.

◆ m_is_complete

bool mysql::csa::Fetchable_transaction::m_is_complete {false}
private

True when reader has finished appending batches.

◆ m_is_done

bool mysql::csa::Fetchable_transaction::m_is_done {false}
private

True when the consumer-side fetch stream reached a terminal state.

◆ m_is_truncated

std::atomic<bool> mysql::csa::Fetchable_transaction::m_is_truncated {false}
private

True when reader marked metadata stream as truncated.

◆ m_max_event_length

std::atomic<std::size_t> mysql::csa::Fetchable_transaction::m_max_event_length {0}
private

Maximum event length published for this transaction.

◆ m_mutex

std::mutex mysql::csa::Fetchable_transaction::m_mutex
mutableprivate

Guard for concurrent producer (reader) and consumer (worker).

◆ m_status

Return_status mysql::csa::Fetchable_transaction::m_status
private

Internal status of event.


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