24#ifndef MYSQL_CSA_FETCHABLE_TRANSACTION_H
25#define MYSQL_CSA_FETCHABLE_TRANSACTION_H
28#include <condition_variable>
Represents metadata of a set of events, capable of being fetched from a storage.
Definition: event_set_fetchable.h:55
Opaque for transaction, that is able to fetch itself in parts from the storage on demand.
Definition: fetchable_transaction.h:44
std::size_t get_max_event_length() const
Returns the maximum event length published for this transaction.
Definition: fetchable_transaction.cpp:159
bool is_fetching_error() const
Returs true when fetching failed.
Definition: fetchable_transaction.cpp:144
Fetchable_transaction(Fetchable_transaction &&)=delete
Fetchable_transaction()
Fetch function is supplied by a specific storage implementation.
Definition: fetchable_transaction.cpp:28
std::mutex m_mutex
Guard for concurrent producer (reader) and consumer (worker).
Definition: fetchable_transaction.h:138
std::atomic< bool > m_is_truncated
True when reader marked metadata stream as truncated.
Definition: fetchable_transaction.h:136
Event_set_fetchable_list m_event_set_batches
Object used to fetch transaction events from the storage.
Definition: fetchable_transaction.h:142
void set_fetching_truncated()
Marks transaction metadata stream as truncated.
Definition: fetchable_transaction.cpp:202
std::string get_fetch_error_msg() const
Accesses fetch error message.
Definition: fetchable_transaction.cpp:211
std::optional< Managed_event > fetch_next()
Definition: fetchable_transaction.cpp:87
virtual ~Fetchable_transaction()
Destructor.
Definition: fetchable_transaction.cpp:49
bool m_is_complete
True when reader has finished appending batches.
Definition: fetchable_transaction.h:132
void update_max_event_length(std::size_t event_length)
Updates the maximum event length published for this transaction.
Definition: fetchable_transaction.cpp:193
void reset_fetching(bool all)
Reset the status of the Featchable job allowing it to be re-read from the storage.
Definition: fetchable_transaction.cpp:51
bool advance_finished_batch_unsafe(Event_set_fetchable *event_batch)
Advances to the next batch if the current one has finished.
Definition: fetchable_transaction.cpp:241
bool is_truncated() const
Checks whether fetching stopped because the metadata stream was truncated.
Definition: fetchable_transaction.cpp:155
void set_success()
Marks that transaction committed succesfully, success callback.
Definition: fetchable_transaction.cpp:40
Event_set_fetchable_list::iterator m_current_batch_it
Currently processed event batch iterator.
Definition: fetchable_transaction.h:144
Format_description_log_event * get_fde()
Obtains non-owning pointer to current FDE.
Definition: fetchable_transaction.cpp:63
std::string m_error_message
Detailed error message if error appears.
Definition: fetchable_transaction.h:126
bool is_fetching_done() const
Checks current status of the object.
Definition: fetchable_transaction.cpp:150
std::optional< Event_set_fetchable * > get_current_event_batch_unsafe()
Iterates over event sets, picking a correct batch.
Definition: fetchable_transaction.cpp:256
void append_batch(Event_set_fetchable_ptr batch)
Appends a new fetchable batch for this transaction.
Definition: fetchable_transaction.cpp:171
void set_fetching_complete()
Seals transaction metadata stream. No more batches will be appended.
Definition: fetchable_transaction.cpp:182
Return_status m_status
Internal status of event.
Definition: fetchable_transaction.h:128
Event_set_fetchable * wait_for_current_batch()
Waits until a current batch becomes available or fetching reaches a terminal state.
Definition: fetchable_transaction.cpp:216
std::atomic< std::size_t > m_max_event_length
Maximum event length published for this transaction.
Definition: fetchable_transaction.h:134
bool is_trx() const
Returns information on whether this is actual transaction (transaction starting with a GTID)
Definition: fetchable_transaction.cpp:78
void set_fetching_done()
Mark that fetching is successfully done, even if transaction was not fully read.
Definition: fetchable_transaction.cpp:163
Fetchable_transaction(const Fetchable_transaction &)=delete
bool m_is_done
True when the consumer-side fetch stream reached a terminal state.
Definition: fetchable_transaction.h:130
bool wait_next()
Fetches consecutive events from the storage, until done or error occurs.
Definition: fetchable_transaction.cpp:119
std::condition_variable m_cv
Notification for appended batches / terminal state updates.
Definition: fetchable_transaction.h:140
Definition: channel.cpp:28
std::unique_ptr< Event_set_fetchable > Event_set_fetchable_ptr
Unique pointer to a specific implementation of Event_set_fetchable (no need to share).
Definition: event_set_fetchable.h:39
std::list< Event_set_fetchable_ptr > Event_set_fetchable_list
List of Event_set_fetchable pointers, each able to fetch a whole transaction from the storage.
Definition: event_set_fetchable.h:43
Return_status
Simple, strongly-typed enumeration to indicate internal status: ok, error.
Definition: return_status.h:40