![]() |
MySQL 26.7.0
Source Code Documentation
|
Implementation of Event_set_fetchable that fetches events from the relay log. More...
#include <event_set_fetchable_relay_log.h>
Public Types | |
| using | Log_event_ptr = std::shared_ptr< Log_event > |
| Shared pointer to a Log_event. More... | |
| using | Return_status = mysql::utils::Return_status |
| Type alias for return status. More... | |
| using | Stream_type = ::binlog::Decompressing_event_object_istream |
| Type alias for the decompressing event stream. More... | |
| using | Stream_ptr = std::unique_ptr< Stream_type > |
| Unique pointer to the decompressing stream. More... | |
Public Types inherited from mysql::csa::Event_set_fetchable | |
| using | Fde_type = Format_description_log_event |
| using | Fde_ptr = Fde_type * |
| using | Log_event_ptr = std::shared_ptr< Log_event > |
Public Member Functions | |
| Event_set_fetchable_relay_log (std::string filename, std::size_t start_file_pos, std::size_t end_file_pos, Relay_log_deleter_handle deleter, bool checksum_validation, bool is_trx, Log_event_ptr fde, bool streaming_open=false) | |
| Constructs an Event_set_fetchable_relay_log with relay log coordinates. More... | |
| bool | wait_next () override |
| Fetches the next event from the initialized internal stream. More... | |
| std::optional< Managed_event > | fetch_next () override |
| Fetches the next event if possible. More... | |
| const std::string & | get_error_str () const override |
| Retrieves the error message if any error occurred. More... | |
| bool | is_done () const override |
| Checks if the fetchable stream has finished without error. More... | |
| bool | is_error () const override |
| Checks if an error occurred in the fetchable stream. More... | |
| bool | is_trx () const override |
| Checks if this event set represents a transaction. More... | |
| void | reset (bool reset_events) override |
| Resets the state to allow fetching again, clearing error state. More... | |
| void | set_success () override |
| Callback notifying that task was executed successfully. More... | |
| virtual | ~Event_set_fetchable_relay_log () override |
| Destructor. More... | |
| std::string | to_string () const |
| Returns a string representation of this batch's information. More... | |
| Fde_ptr | get_fde () override |
| Obtains non-owning pointer to current transaction FDE. More... | |
| void | append_event_end (std::size_t end_file_pos, bool seal_after=false) |
| Appends one published event boundary for stream-open batch. More... | |
| void | seal_stream () |
| Seals stream-open batch. No more events will be appended. More... | |
| void | set_stream_truncated () |
| Marks stream-open batch as truncated and wakes blocked readers. More... | |
Public Member Functions inherited from mysql::csa::Event_set_fetchable | |
| virtual | ~Event_set_fetchable ()=default |
| Sets the end of the stream if needed. More... | |
Private Member Functions | |
| bool | decompressing () const |
| Checks if currently decompressing the internal stream (TPLE). More... | |
| std::optional< Managed_event > | fetch_from_stream () |
| Fetches the next event from the stream. More... | |
| bool | wait_for_event_availability () |
| Waits until stream has at least one more event available. More... | |
| void | safe_close_reader () |
| Safely closes the reader if it is open. More... | |
| void | safe_open_reader () |
| Safely opens the reader (closes if already open and reopens). More... | |
| void | start_reading () |
| Starts reading from the file by opening it and creating the input stream. More... | |
Private Attributes | |
| bool | m_is_initialized = false |
| Flag indicating if the reader is open. More... | |
| bool | m_is_done = false |
| Flag indicating if processing is done (finished or error). More... | |
| std::string | m_file_name {""} |
| Name of the relay log file to read from. More... | |
| std::size_t | m_start_file_pos {0} |
| Starting file position for reading. More... | |
| std::string | m_failure_msg {""} |
| Detailed error message if any. More... | |
| Return_status | m_status |
| Status of the object. More... | |
| Relay_log_deleter_handle | m_delete_file_handle |
| Handle to the relay log deleter. More... | |
| Stream_ptr | m_input_stream |
| Decompressing stream object for handling compressed events. More... | |
| Relaylog_file_reader | m_reader |
| Relay log file reader used by the decompressing stream. More... | |
| bool | m_is_trx {false} |
| Flag indicating if this is a transaction. More... | |
| bool | m_decompressing {false} |
| Flag indicating if currently decompressing an internal event (TPLE). More... | |
| Log_event_ptr | m_fde_base {} |
| owning pointer to FDE. More... | |
| Fde_ptr | m_fde {} |
| non-owning pointer to FDE. More... | |
| std::mutex | m_stream_mutex |
| Stream synchronization state. More... | |
| std::condition_variable | m_stream_cv |
| std::size_t | m_published_end_file_pos {0} |
| bool | m_stream_open {false} |
| bool | m_stream_sealed {true} |
| bool | m_stream_truncated {false} |
Implementation of Event_set_fetchable that fetches events from the relay log.
If the stream is compressed, the fetching function will perform decompression. Objects of this class are created by the relay log reader and used to fetch consecutive parts of a transaction (relay log events). Typically, a transaction will contain as many event sets as the number of files it spans.
| using mysql::csa::Event_set_fetchable_relay_log::Log_event_ptr = std::shared_ptr<Log_event> |
Shared pointer to a Log_event.
Type alias for return status.
| using mysql::csa::Event_set_fetchable_relay_log::Stream_ptr = std::unique_ptr<Stream_type> |
Unique pointer to the decompressing stream.
| using mysql::csa::Event_set_fetchable_relay_log::Stream_type = ::binlog::Decompressing_event_object_istream |
Type alias for the decompressing event stream.
| mysql::csa::Event_set_fetchable_relay_log::Event_set_fetchable_relay_log | ( | std::string | filename, |
| std::size_t | start_file_pos, | ||
| std::size_t | end_file_pos, | ||
| Relay_log_deleter_handle | deleter, | ||
| bool | checksum_validation, | ||
| bool | is_trx, | ||
| Event_set_fetchable::Log_event_ptr | fde, | ||
| bool | streaming_open = false |
||
| ) |
Constructs an Event_set_fetchable_relay_log with relay log coordinates.
The coordinates must remain valid until the transaction is applied or deemed non-appliable. Uses a relay log deleter handler to ensure the file is not deleted while in use.
| filename | The name of the relay log file. |
| start_file_pos | The starting position in the file. |
| end_file_pos | The "end" position for this event set. |
| deleter | Handle to the relay log deleter. |
| checksum_validation | Flag to enable checksum validation. |
| is_trx | Flag indicating if this set represents a transaction. |
| fde | Shared pointer to FDE for this event set. |
| streaming_open | If true, this set is stream-open and accepts incremental end position updates. |
|
overridevirtual |
Destructor.
| void mysql::csa::Event_set_fetchable_relay_log::append_event_end | ( | std::size_t | end_file_pos, |
| bool | seal_after = false |
||
| ) |
Appends one published event boundary for stream-open batch.
| end_file_pos | End position (exclusive) for the next available event. |
| seal_after | When true, the batch is sealed together with publish. |
|
private |
Checks if currently decompressing the internal stream (TPLE).
|
private |
Fetches the next event from the stream.
|
overridevirtual |
Fetches the next event if possible.
Callers are expected to wait for availability with wait_next() first when the underlying implementation supports streaming updates.
Implements mysql::csa::Event_set_fetchable.
|
overridevirtual |
Retrieves the error message if any error occurred.
Implements mysql::csa::Event_set_fetchable.
|
overridevirtual |
Obtains non-owning pointer to current transaction FDE.
Implements mysql::csa::Event_set_fetchable.
|
overridevirtual |
Checks if the fetchable stream has finished without error.
Implements mysql::csa::Event_set_fetchable.
|
overridevirtual |
Checks if an error occurred in the fetchable stream.
Implements mysql::csa::Event_set_fetchable.
|
overridevirtual |
Checks if this event set represents a transaction.
Implements mysql::csa::Event_set_fetchable.
|
overridevirtual |
Resets the state to allow fetching again, clearing error state.
Leaves the reader closed to conserve file descriptors.
| reset_events | When true events states need to be reset |
Implements mysql::csa::Event_set_fetchable.
|
private |
Safely closes the reader if it is open.
|
private |
Safely opens the reader (closes if already open and reopens).
| void mysql::csa::Event_set_fetchable_relay_log::seal_stream | ( | ) |
Seals stream-open batch. No more events will be appended.
| void mysql::csa::Event_set_fetchable_relay_log::set_stream_truncated | ( | ) |
Marks stream-open batch as truncated and wakes blocked readers.
|
overridevirtual |
Callback notifying that task was executed successfully.
Reimplemented from mysql::csa::Event_set_fetchable.
|
private |
Starts reading from the file by opening it and creating the input stream.
| std::string mysql::csa::Event_set_fetchable_relay_log::to_string | ( | ) | const |
Returns a string representation of this batch's information.
|
private |
Waits until stream has at least one more event available.
| true | At least one more event can be fetched. |
| false | Stream is sealed/truncated/error and no more fetch is possible. |
|
overridevirtual |
Fetches the next event from the initialized internal stream.
Implements mysql::csa::Event_set_fetchable.
|
private |
Flag indicating if currently decompressing an internal event (TPLE).
|
private |
Handle to the relay log deleter.
|
private |
Detailed error message if any.
|
private |
non-owning pointer to FDE.
|
private |
owning pointer to FDE.
|
private |
Name of the relay log file to read from.
|
private |
Decompressing stream object for handling compressed events.
|
private |
Flag indicating if processing is done (finished or error).
|
private |
Flag indicating if the reader is open.
|
private |
Flag indicating if this is a transaction.
|
private |
|
private |
Relay log file reader used by the decompressing stream.
|
private |
Starting file position for reading.
|
private |
Status of the object.
|
private |
|
mutableprivate |
Stream synchronization state.
|
private |
|
private |
|
private |