24#ifndef BINLOG_LOG_SANITIZER_H
25#define BINLOG_LOG_SANITIZER_H
123 template <
class Type_reader>
144 template <
class Type_reader>
146 const std::list<std::string> &list_of_files,
155 template <
class Type_reader>
164 template <
class Type_reader>
Contains the classes representing events occurring in the replication stream.
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:68
A Query event is written to the binary log whenever the database is modified on the master,...
Definition: log_event.h:1296
Similar to Xid_log_event except that.
Definition: log_event.h:1832
std::map< XID, enum_ha_recover_xa_state, std::less< XID >, Xa_state_list::allocator > list
Definition: handler.h:1264
This is the subclass of Xid_event defined in libbinlogevent, An XID event is generated for a commit o...
Definition: log_event.h:1781
Class used to recover binary / relay log file.
Definition: log_sanitizer.h:62
bool m_has_valid_source_pos
Indicator on whether a valid source position has been found in the log file.
Definition: log_sanitizer.h:220
bool m_has_valid_pos
Indicator on whether a valid position has been found in the log file.
Definition: log_sanitizer.h:216
Xid_commit_list m_internal_xids
List of normal transactions fully written to the binary log.
Definition: log_sanitizer.h:206
Mem_root_allocator< my_xid > m_set_alloc
Memory pool allocator to use with the normal transaction list.
Definition: log_sanitizer.h:202
bool process_one_log(Type_reader &reader, const std::string &filename)
Reads and validates one log file.
Definition: log_sanitizer_impl.hpp:96
virtual PSI_memory_key & get_memory_key() const =0
Function used to obtain memory key for derived classes.
void process_logs(Type_reader &reader)
This function goes through the opened file and searches for a valid position in a binary log file.
Definition: log_sanitizer_impl.hpp:85
void process_start()
Invoked when a BEGIN or an ‘XA START’ is found in a Query_log_event.
Definition: log_sanitizer.cc:144
void process_xid_event(Xid_log_event const &ev)
Invoked when a Xid_log_event is read from the binary log file reader.
Definition: log_sanitizer.cc:96
bool m_fatal_error
Whether or not the binary log has a fatal error.
Definition: log_sanitizer.h:196
bool is_fatal_error() const
Checks whether the fatal error occurred during log sanitization (OOM / decompression error which we c...
Definition: log_sanitizer.cc:55
bool is_log_truncation_needed() const
Checks whether a valid sanitized log file needs truncation of the last, partially written transaction...
Definition: log_sanitizer.cc:61
bool m_validation_started
Indicates whether validation has started.
Definition: log_sanitizer.h:179
my_off_t m_last_file_size
Last opened file size.
Definition: log_sanitizer.h:223
Mem_root_allocator< std::pair< const XID, XID_STATE::xa_states > > m_map_alloc
Memory pool allocator to use with the XA transaction list.
Definition: log_sanitizer.h:204
void add_external_xid(std::string const &query, enum_ha_recover_xa_state state)
Parses the provided string for an XID and adds it to the externally coordinated transactions map,...
Definition: log_sanitizer.cc:218
MEM_ROOT m_mem_root
Memory pool to use for the XID lists.
Definition: log_sanitizer.h:200
bool is_log_malformed() const
Retrieves whether or not the log was correctly processed in full.
Definition: log_sanitizer.cc:53
std::pair< std::string, bool > get_valid_source_file() const
Retrieves the updated name of the binlog source file.
Definition: log_sanitizer.cc:48
std::string m_valid_source_file
Currently processed binlog file set in case source rotation event is encountered.
Definition: log_sanitizer.h:188
void process_atomic_ddl(Query_log_event const &ev)
Invoked when a DDL is found in a Query_log_event.
Definition: log_sanitizer.cc:171
bool m_in_transaction
Whether or not the event being processed is within a transaction.
Definition: log_sanitizer.h:192
std::pair< my_off_t, bool > get_valid_source_pos() const
Retrieves the last valid source position of an event in read from the binary log / relay log file,...
Definition: log_sanitizer.cc:44
bool m_is_log_truncation_needed
Information on whether log needs to be truncated, i.e.
Definition: log_sanitizer.h:213
bool m_is_malformed
Whether or not the binary log is malformed/corrupted or error occurred.
Definition: log_sanitizer.h:194
my_off_t m_valid_source_pos
Position of the last binlog event that ended a transaction (source position which corresponds to m_va...
Definition: log_sanitizer.h:185
void process_xa_rollback(std::string const &query)
Invoked when an XA ROLLBACK is found in a Query_log_event.
Definition: log_sanitizer.cc:202
virtual ~Log_sanitizer()=default
Dtor.
Xa_state_list::list m_external_xids
List of XA transactions and states that appear in the binary log.
Definition: log_sanitizer.h:208
void process_xa_prepare_event(XA_prepare_log_event const &ev)
Invoked when a XA_prepare_log_event is read from the binary log file reader.
Definition: log_sanitizer.cc:112
std::string get_valid_file() const
Definition: log_sanitizer.h:99
std::string m_valid_file
Last log file containing finished transaction.
Definition: log_sanitizer.h:190
void process_query_event(Query_log_event const &ev)
Invoked when a Query_log_event is read from the binary log file reader.
Definition: log_sanitizer.cc:65
my_off_t get_valid_pos() const
Retrieves the position of the last binlog/relay log event that ended a transaction or position after ...
Definition: log_sanitizer.cc:42
void process_xa_commit(std::string const &query)
Invoked when an XA COMMIT is found in a Query_log_event.
Definition: log_sanitizer.cc:186
std::string const & get_failure_message() const
Retrieves the textual representation of the encontered failure, if any.
Definition: log_sanitizer.cc:57
Log_sanitizer()
Ctor.
Definition: log_sanitizer.cc:34
my_off_t m_valid_pos
Position of the last binlog/relay log event that ended a transaction.
Definition: log_sanitizer.h:182
std::string m_failure_message
Textual representation of the encountered failure.
Definition: log_sanitizer.h:198
void process_commit()
Invoked when a COMMIT is found in a Query_log_event.
Definition: log_sanitizer.cc:153
void process_rollback()
Invoked when a ROLLBACK is found in a Query_log_event.
Definition: log_sanitizer.cc:162
Stream class that yields Log_event objects, including events contained in Transaction_payload_log_eve...
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
Binary log event definitions.
ulonglong my_off_t
Definition: my_inttypes.h:72
static char * query
Definition: myisam_ftdump.cc:47
const char * filename
Definition: pfs_example_component_population.cc:67
enum_ha_recover_xa_state
Enumeration of possible states for externally coordinated transactions (XA).
Definition: handler.h:1239
std::unordered_set< my_xid, std::hash< my_xid >, std::equal_to< my_xid >, Mem_root_allocator< my_xid > > Xid_commit_list
Single occurrence set of XIDs of internally coordinated transactions found as been committed in the t...
Definition: handler.h:1253
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83