1#ifndef BINLOG_H_INCLUDED
25#define BINLOG_H_INCLUDED
67class Transaction_boundary_parser;
81#define MAX_LOG_UNIQUE_FN_EXT 0x7FFFFFFF
87#define MAX_ALLOWED_FN_EXT_RESET_BIN_LOGS 2000000000
99#define LOG_INFO_EOF -1
100#define LOG_INFO_IO -2
101#define LOG_INFO_INVALID -3
102#define LOG_INFO_SEEK -4
103#define LOG_INFO_MEM -6
104#define LOG_INFO_FATAL -7
105#define LOG_INFO_IN_USE -8
106#define LOG_INFO_EMFILE -9
107#define LOG_INFO_BACKUP_LOCK -10
108#define LOG_INFO_NOT_IN_USE -11
111#define LOG_CLOSE_INDEX 1
112#define LOG_CLOSE_TO_BE_OPENED 2
113#define LOG_CLOSE_STOP_EVENT 4
296 const char *new_name,
uint32 new_index_number);
300 uint32 new_index_number = 0);
318 const char *
generate_name(
const char *log_name,
const char *suffix,
422 bool find_first_log(std::string &binlog_file_name, std::string &errmsg);
438 Gtid *first_gtid, std::string &errmsg);
600 const bool check_and_skip_flush_logs =
false);
689 const char *message);
696 void close()
override;
701#if defined(MYSQL_SERVER)
705 bool is_transactional);
772 bool open_binlog(
const char *log_name,
const char *new_name,
773 ulong max_size_arg,
bool null_created_arg,
774 bool need_lock_index,
bool need_tsid_lock,
776 uint32 new_index_number = 0);
777 bool open_index_file(
const char *index_file_name_arg,
const char *log_name,
778 bool need_lock_index);
795 bool parallelization_barrier);
897 bool need_update_threads,
907 const std::string &
last);
908 int rotate(
bool force_rotate,
bool *check_purge);
943 int purge_logs(
const char *to_log,
bool included,
bool need_lock_index,
944 bool need_update_threads,
ulonglong *decrease_log_space,
951 bool need_lock_index);
961 bool need_lock_index);
963 void close(uint exiting,
bool need_lock_log,
bool need_lock_index);
984 bool need_lock_index =
true);
1018 std::string &errmsg);
1041 const Gtid_set *slave_executed_gtid_set,
1042 std::string &errmsg);
int destroy(azio_stream *s)
Definition: azio.cc:371
int64 query_id_t
Definition: binlog.h:72
MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log
Contains the classes representing events occurring in the replication stream.
It owns an allocator, a byte stream, an event_data stream and an event object stream.
Definition: binlog_reader.h:295
Byte container that provides a storage for serializing session binlog events.
Definition: binlog_ostream.h:174
Auxiliary class to copy serialized events to the binary log and correct some of the fields that are n...
Definition: binlog.cc:1415
StageID
Constants for queues for different stages.
Definition: rpl_commit_stage_manager.h:166
Stores information to monitor a transaction during the different replication stages.
Definition: rpl_gtid.h:1412
Represents a set of GTIDs.
Definition: rpl_gtid.h:1556
Container to hold and allow iteration over a set of Ha_trx_info objects.
Definition: transaction_info.h:503
Either statement transaction or normal transaction - related thread-specific storage engine data.
Definition: transaction_info.h:403
This is the abstract base class for binary log events.
Definition: log_event.h:538
Logical binlog file which wraps and hides the detail of lower layer storage implementation.
Definition: binlog.cc:380
mysql_mutex_t * get_binlog_end_pos_lock()
Definition: binlog.h:1052
const char * get_name() const
Definition: binlog.h:987
mysql_cond_t m_prep_xids_cond
Definition: binlog.h:252
mysql_mutex_t * get_commit_lock()
Definition: binlog.h:990
mysql_mutex_t LOCK_binlog_end_pos
Definition: binlog.h:208
std::atomic< my_off_t > atomic_binlog_end_pos
Definition: binlog.h:212
void unlock_binlog_end_pos()
Definition: binlog.h:1054
PSI_mutex_key m_key_LOCK_xids
The instrumentation key to use for @ LOCK_xids.
Definition: binlog.h:185
mysql_mutex_t LOCK_commit
Definition: binlog.h:205
char db[NAME_LEN+1]
Definition: binlog.h:150
void set_previous_gtid_set_relaylog(Gtid_set *previous_gtid_set_param)
Definition: binlog.h:471
IO_CACHE crash_safe_index_file
Definition: binlog.h:220
void reset_bytes_written()
Definition: binlog.h:709
void lock_binlog_end_pos()
Definition: binlog.h:1053
enum_log_state
Definition: binlog.h:144
@ LOG_OPENED
Definition: binlog.h:144
@ LOG_CLOSED
Definition: binlog.h:144
@ LOG_TO_BE_OPENED
Definition: binlog.h:144
mysql_mutex_t LOCK_index
Definition: binlog.h:204
PSI_mutex_key m_key_COND_done
The PFS instrumentation key for @ COND_done.
Definition: binlog.h:175
mysql_mutex_t LOCK_sync
Definition: binlog.h:207
PSI_mutex_key m_key_LOCK_after_commit
The instrumentation key to use for @ LOCK_after_commit.
Definition: binlog.h:181
PSI_mutex_key m_key_LOCK_commit_queue
The PFS instrumentation key for @ LOCK_commit_queue.
Definition: binlog.h:163
mysql_mutex_t LOCK_after_commit
Definition: binlog.h:206
Binlog_ofile * get_binlog_file()
Definition: binlog.h:993
mysql_mutex_t LOCK_log_info
Definition: binlog.h:1112
int open(const char *opt_name) override
Initialize and open the coordinator log.
Definition: binlog.h:529
mysql_mutex_t * get_log_lock()
Definition: binlog.h:988
bool is_open() const
Definition: binlog.h:320
IO_CACHE purge_index_file
Definition: binlog.h:228
PSI_cond_key m_key_prep_xids_cond
The instrumentation key to use for @ prep_xids_cond.
Definition: binlog.h:191
my_off_t get_binlog_end_pos() const
Definition: binlog.h:1048
void lock_index()
Definition: binlog.h:995
PSI_mutex_key m_key_LOCK_flush_queue
The PFS instrumentation key for @ LOCK_flush_queue.
Definition: binlog.h:169
PSI_mutex_key m_key_LOCK_after_commit_queue
The PFS instrumentation key for @ LOCK_after_commit_queue.
Definition: binlog.h:165
int32 get_prep_xids()
Definition: binlog.h:267
std::atomic< enum_log_state > atomic_log_state
Definition: binlog.h:524
Gtid_set * previous_gtid_set_relaylog
Definition: binlog.h:527
PSI_cond_key m_key_update_cond
The instrumentation key to use for @ update_cond.
Definition: binlog.h:189
void set_psi_keys(PSI_mutex_key key_LOCK_index, PSI_mutex_key key_LOCK_commit, PSI_mutex_key key_LOCK_commit_queue, PSI_mutex_key key_LOCK_after_commit, PSI_mutex_key key_LOCK_after_commit_queue, PSI_mutex_key key_LOCK_done, PSI_mutex_key key_LOCK_flush_queue, PSI_mutex_key key_LOCK_log, PSI_mutex_key key_LOCK_binlog_end_pos, PSI_mutex_key key_LOCK_sync, PSI_mutex_key key_LOCK_sync_queue, PSI_mutex_key key_LOCK_xids, PSI_mutex_key key_LOCK_log_info, PSI_mutex_key key_LOCK_wait_for_group_turn, PSI_cond_key key_COND_done, PSI_cond_key key_COND_flush_queue, PSI_cond_key key_update_cond, PSI_cond_key key_prep_xids_cond, PSI_cond_key key_COND_wait_for_group_turn, PSI_file_key key_file_log, PSI_file_key key_file_log_index, PSI_file_key key_file_log_cache, PSI_file_key key_file_log_index_cache)
Definition: binlog.h:368
char * get_index_fname()
Definition: binlog.h:985
bool write_error
Definition: binlog.h:151
uint * sync_period_ptr
Definition: binlog.h:249
mysql_mutex_t * get_after_commit_lock()
Definition: binlog.h:991
PSI_mutex_key m_key_LOCK_done
The PFS instrumentation key for @ LOCK_done.
Definition: binlog.h:167
std::set< LOG_INFO * > log_info_set
Definition: binlog.h:1115
std::atomic< int32 > m_atomic_prep_xids
Definition: binlog.h:253
Binlog_ofile * m_binlog_file
Definition: binlog.h:152
PSI_mutex_key m_key_LOCK_sync
The instrumentation key to use for @ LOCK_sync.
Definition: binlog.h:183
void add_bytes_written(ulonglong inc)
Definition: binlog.h:708
bool inited
Definition: binlog.h:151
PSI_file_key m_key_file_log_index_cache
The instrumentation key to use for opening a log index cache file.
Definition: binlog.h:201
mysql_mutex_t * get_index_lock()
Definition: binlog.h:989
PSI_mutex_key m_key_LOCK_binlog_end_pos
The instrumentation key to use for @ LOCK_binlog_end_pos.
Definition: binlog.h:161
char index_file_name[FN_REFLEN]
Definition: binlog.h:215
IO_CACHE * get_index_file()
Definition: binlog.h:997
mysql_cond_t * get_log_cond()
Definition: binlog.h:992
mysql_mutex_t LOCK_log
Definition: binlog.h:147
ulong max_size
Definition: binlog.h:240
bool is_relay_log
Definition: binlog.h:327
PSI_mutex_key m_key_LOCK_index
The instrumentation key to use for @ LOCK_index.
Definition: binlog.h:159
uint get_sync_period()
Definition: binlog.h:269
PSI_cond_key m_key_COND_wait_for_group_turn
The PFS instrumentation key for @ COND_wait_for_group_turn.
Definition: binlog.h:193
PSI_mutex_key m_key_LOCK_log
The instrumentation key to use for @ LOCK_log.
Definition: binlog.h:157
PSI_mutex_key m_key_COND_flush_queue
The PFS instrumentation key for @ COND_flush_queue.
Definition: binlog.h:177
uint file_id
Definition: binlog.h:243
ulonglong bytes_written
Definition: binlog.h:213
mysql_cond_t update_cond
Definition: binlog.h:210
PSI_mutex_key m_key_LOCK_commit
The instrumentation key to use for @ LOCK_commit.
Definition: binlog.h:179
PSI_mutex_key m_key_LOCK_wait_for_group_turn
The PFS instrumentation key for @ LOCK_wait_for_group_turn.
Definition: binlog.h:173
void unlock_index()
Definition: binlog.h:996
PSI_file_key m_key_file_log
The instrumentation key to use for opening the log file.
Definition: binlog.h:195
PSI_mutex_key m_key_LOCK_sync_queue
The PFS instrumentation key for @ LOCK_sync_queue.
Definition: binlog.h:171
char * get_log_fname()
Definition: binlog.h:986
char purge_index_file_name[FN_REFLEN]
Definition: binlog.h:229
mysql::binlog::event::enum_binlog_checksum_alg relay_log_checksum_alg
Definition: binlog.h:363
Transaction_dependency_tracker m_dependency_tracker
Manage the MTS dependency tracking.
Definition: binlog.h:412
IO_CACHE index_file
Definition: binlog.h:214
mysql_mutex_t LOCK_xids
Definition: binlog.h:209
PSI_file_key m_key_file_log_cache
The instrumentation key to use for opening a log cache file.
Definition: binlog.h:199
uint sync_counter
Definition: binlog.h:250
PSI_file_key m_log_file_key
Instrumentation key to use for file io in log_file.
Definition: binlog.h:155
char * name
Definition: binlog.h:148
char log_file_name[FN_REFLEN]
Definition: binlog.h:149
uint8 checksum_alg_reset
Definition: binlog.h:329
PSI_mutex_key m_key_LOCK_log_info
The instrumentation key to use for @ m_key_LOCK_log_info.
Definition: binlog.h:187
char crash_safe_index_file_name[FN_REFLEN]
Definition: binlog.h:221
static const int MAX_RETRIES_FOR_DELETE_RENAME_FAILURE
Definition: binlog.h:1043
PSI_file_key m_key_file_log_index
The instrumentation key to use for opening the log index file.
Definition: binlog.h:197
Definition: rpl_rli.h:203
Common base class for all row-containing log events.
Definition: log_event.h:2764
Transaction Coordinator Log.
Definition: tc_log.h:144
enum_result
Definition: tc_log.h:160
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
enum_trx_scope
Definition: transaction_info.h:56
Dependency tracker is a container singleton that dispatches between the three methods associated with...
Definition: rpl_trx_tracking.h:185
Represents a bidirectional map between TSID and SIDNO.
Definition: rpl_gtid.h:749
Caches for non-transactional and transactional data before writing it to the binary log.
Definition: binlog.cc:701
This is the base class for verifying transaction boundaries.
Definition: trx_boundary_parser.h:50
Error representation used internally in case final error code is unknown and error situation handling...
Definition: error.h:45
Definition: item_func.h:3021
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
void harvest_bytes_written(Relay_log_info *rli, bool need_log_space_lock)
Adds bytes written in the current relay log into the variable handling the total number of bytes acqu...
Definition: binlog.cc:7823
bool mysql_show_binlog_events(THD *thd)
Execute a SHOW BINLOG EVENTS statement.
Definition: binlog.cc:3637
bool stmt_cannot_safely_rollback(const THD *thd)
This function checks if current statement cannot be rollded back safely.
Definition: binlog.cc:3319
bool normalize_binlog_name(char *to, const char *from, bool is_relay_log)
Turns a relative log binary log path into a full path, based on the opt_bin_logname or opt_relay_logn...
Definition: binlog.cc:245
int write_xa_to_cache(THD *thd)
Logging XA commit/rollback of a prepared transaction.
Definition: binlog.cc:2603
std::pair< int, std::list< std::string > > get_log_index(bool need_lock_index=true)
Retrieves the contents of the index file associated with this log object into an std::list<std::strin...
Definition: binlog.cc:5723
int close_purge_index_file()
Definition: binlog.cc:6240
std::pair< std::list< std::string >, mysql::utils::Error > get_filename_list()
Obtains the list of logs from the index file.
Definition: binlog.cc:1955
void set_max_size(ulong max_size_arg)
Definition: binlog.cc:7842
ulong rpl_read_size
Definition: binlog.cc:188
int flush_cache_to_file(my_off_t *flush_end_pos)
Flush the I/O cache to file.
Definition: binlog.cc:8685
void report_cache_write_error(THD *thd, bool is_transactional)
Definition: binlog.cc:5519
bool is_transaction_empty(THD *thd)
Check if the the transaction is empty.
Definition: binlog.cc:3210
int log_loaded_block(IO_CACHE *file)
Load data's io cache specific hook to be executed before a chunk of data is being read into the cache...
Definition: binlog.cc:3474
bool trans_cannot_safely_rollback(const THD *thd)
This function checks if a transaction cannot be rolled back safely.
Definition: binlog.cc:3306
THD * fetch_and_process_flush_stage_queue(const bool check_and_skip_flush_logs=false)
Fetch and empty BINLOG_FLUSH_STAGE and COMMIT_ORDER_FLUSH_STAGE flush queues and flush transactions t...
Definition: binlog.cc:8455
int rotate(bool force_rotate, bool *check_purge)
The method executes rotation when LOCK_log is already acquired by the caller.
Definition: binlog.cc:7320
void update_thd_next_event_pos(THD *thd)
Definition: binlog.cc:7100
int find_log_pos(LOG_INFO *linfo, const char *log_name, bool need_lock_index)
Find the position in the log-index-file for the given log name.
Definition: binlog.cc:5568
bool trans_has_updated_trans_table(const THD *thd)
This function checks if a transactional table was updated by the current transaction.
Definition: binlog.cc:3248
void close() override
This is called on shutdown, after ha_panic.
Definition: binlog.cc:8049
int new_file_without_locking(Format_description_log_event *extra_description_event)
Definition: binlog.cc:6627
void report_missing_purged_gtids(const Gtid_set *slave_executed_gtid_set, std::string &errmsg)
Function to report the missing GTIDs.
Definition: binlog.cc:9204
uint next_file_id()
Definition: binlog.cc:7442
void cleanup()
Definition: binlog.cc:3685
bool do_write_cache(Binlog_cache_storage *cache, class Binlog_event_writer *writer)
Write the contents of the given IO_CACHE to the binary log.
Definition: binlog.cc:7548
int rollback(THD *thd, bool all) override
Write a rollback record of the transaction to the binary log.
Definition: binlog.cc:2774
void init_pthread_objects()
Definition: binlog.cc:3710
bool reencrypt_logs()
Re-encrypt previous existent binary/relay logs as below.
Definition: binlog.cc:1978
void unregister_log_info(LOG_INFO *log_info)
Unregister LOG_INFO when it is no longer needed.
Definition: binlog.cc:7479
int log_in_use(const char *log_name)
Check if any threads use log name.
Definition: binlog.cc:7485
const char * log_bin_index
Definition: binlog.cc:184
int open_binlog(const char *opt_name)
Definition: binlog.cc:7888
~MYSQL_BIN_LOG() override
Definition: binlog.cc:3681
bool binlog_enabled()
Check whether binlog_hton has valid slot and enabled.
Definition: binlog.cc:1367
bool is_empty_transaction_in_binlog_cache(const THD *thd)
Check if at least one of transacaction and statement binlog caches contains an empty transaction,...
Definition: binlog.cc:3229
int register_purge_index_entry(const char *entry)
Definition: binlog.cc:6271
int sync_purge_index_file()
Definition: binlog.cc:6260
int get_gtid_executed(Tsid_map *tsid_map, Gtid_set *gtid_set)
Deep copy global_tsid_map and gtid_executed.
Definition: binlog.cc:7450
int gtid_end_transaction(THD *thd)
If the thread owns a GTID, this function generates an empty transaction and releases ownership of the...
Definition: binlog.cc:1833
void register_log_info(LOG_INFO *log_info)
Register LOG_INFO so that log_in_use and adjust_linfo_offsets can operate on all logs.
Definition: binlog.cc:7473
int set_purge_index_file_name(const char *base_file_name)
Definition: binlog.cc:6205
void process_commit_stage_queue(THD *thd, THD *queue)
Commit a sequence of sessions.
Definition: binlog.cc:8553
bool open(PSI_file_key log_file_key, const char *log_name, const char *new_name, uint32 new_index_number)
Open the logfile and init IO_CACHE.
Definition: binlog.cc:3940
bool write_buffer(const char *buf, uint len, Master_info *mi)
Definition: binlog.cc:7041
int open_purge_index_file(bool destroy)
Definition: binlog.cc:6217
int set_crash_safe_index_file_name(const char *base_file_name)
Set the name of crash safe index file.
Definition: binlog.cc:5932
const char * log_bin_basename
Definition: binlog.cc:185
int purge_logs(const char *to_log, bool included, bool need_lock_index, bool need_update_threads, ulonglong *decrease_log_space, bool auto_purge)
Remove all logs before the given log from disk and from the index file.
Definition: binlog.cc:6083
bool truncate_update_log_file(const char *log_name, my_off_t valid_pos, my_off_t binlog_size, bool update)
Truncte log file and clear LOG_EVENT_BINLOG_IN_USE_F when update is set.
Definition: binlog.cc:6982
bool truncate_relaylog_file(Master_info *mi, my_off_t valid_pos)
Truncate the active relay log file in the specified position.
Definition: binlog.cc:8010
void check_binlog_cache_size(THD *thd)
Checks if the BINLOG_CACHE_SIZE's value is greater than MAX_BINLOG_CACHE_SIZE.
Definition: binlog.cc:1328
bool is_current_stmt_binlog_enabled_and_caches_empty(const THD *thd) const
Checks whether binlog caches are disabled (binlog does not cache data) or empty in case binloggging i...
Definition: binlog.cc:3070
bool write_event_to_binlog_and_sync(Log_event *ev)
Definition: binlog.cc:7619
bool read_binlog_in_use_flag(Binlog_file_reader &binlog_file_reader)
Read binary log stream header and Format_desc event from binlog_file_reader.
Definition: binlog.cc:7858
bool is_active(const char *log_file_name) const
Check if we are writing/reading to the given log file.
Definition: binlog.cc:6579
void check_binlog_stmt_cache_size(THD *thd)
Checks if the BINLOG_STMT_CACHE_SIZE's value is greater than MAX_BINLOG_STMT_CACHE_SIZE.
Definition: binlog.cc:1348
std::pair< bool, bool > sync_binlog_file(bool force)
Call fsync() to sync the file to disk.
Definition: binlog.cc:8698
int find_next_relay_log(char log_name[FN_REFLEN+1])
Find the relay log name following the given name from relay log index file.
Definition: binlog.cc:5702
int generate_new_name(char *new_name, const char *log_name, uint32 new_index_number=0)
Definition: binlog.cc:3874
int flush_and_set_pending_rows_event(THD *thd, Rows_log_event *event, bool is_transactional)
Definition: binlog.cc:7116
int finish_commit(THD *thd)
Helper function executed when leaving ordered_commit.
Definition: binlog.cc:8741
bool write_stmt_directly(THD *thd, const char *stmt, size_t stmt_len, enum enum_sql_command sql_command)
Write a dml into statement cache and then flush it into binlog.
Definition: binlog.cc:7574
bool ending_single_stmt_trans(THD *thd, const bool all)
This function checks if a single statement transaction is about to commit or not.
Definition: binlog.cc:3295
int raw_get_current_log(LOG_INFO *linfo)
Definition: binlog.cc:5492
enum_result commit(THD *thd, bool all) override
Commit the transaction in the transaction coordinator.
Definition: binlog.cc:8114
bool check_write_error(const THD *thd)
Definition: binlog.cc:5500
bool purge_source_logs_to_file(THD *thd, const char *to_log)
Purges the binary log files up to the file name passed as a paramenter.
Definition: binlog.cc:3334
int process_flush_stage_queue(my_off_t *total_bytes_var, THD **out_queue_var)
Execute the flush stage.
Definition: binlog.cc:8497
int find_next_log(LOG_INFO *linfo, bool need_lock_index)
Find the position in the log-index-file for the given log name.
Definition: binlog.cc:5656
int wait_for_update()
Wait until we get a signal that the binary log has been updated.
Definition: binlog.cc:7706
void make_log_name(char *buf, const char *log_ident)
Create a new log file name.
Definition: binlog.cc:6568
bool change_stage(THD *thd, Commit_stage_manager::StageID stage, THD *queue, mysql_mutex_t *leave_mutex, mysql_mutex_t *enter_mutex)
Enter a stage of the ordered commit procedure.
Definition: binlog.cc:8654
bool find_first_log(std::string &binlog_file_name, std::string &errmsg)
Find the oldest binary log referenced by the index file.
Definition: binlog.cc:4585
bool write_cache(THD *thd, class binlog_cache_data *cache_data, class Binlog_event_writer *writer)
Write the contents of the statement or transaction cache to the binary log.
Definition: binlog.cc:7656
int remove_logs_outside_range_from_index(LOG_INFO *start_log_info, bool need_update_threads, LOG_INFO *last_log_info=nullptr)
Remove logs from index file, except files between 'start' and 'last'.
Definition: binlog.cc:6016
bool write_event(Log_event *event_info)
Write an event to the binary log cache.
Definition: binlog.cc:7157
void update_binlog_end_pos(bool need_lock=true)
Definition: binlog.cc:9335
int rotate_and_purge(THD *thd, bool force_rotate)
Execute a FLUSH LOGS statement.
Definition: binlog.cc:7410
int get_current_log(LOG_INFO *linfo, bool need_lock_log=true)
Definition: binlog.cc:5484
bool is_query_in_union(THD *thd, query_id_t query_id_param)
Definition: binlog.cc:7091
int new_file_impl(bool need_lock, Format_description_log_event *extra_description_event)
Start writing to a new log file or reopen the old file.
Definition: binlog.cc:6647
bool write_event_to_binlog(Log_event *ev)
Definition: binlog.cc:7598
bool reset_logs(THD *thd, bool delete_only=false)
Removes files, as part of a RESET BINARY LOGS AND GTIDS or RESET REPLICA statement,...
Definition: binlog.cc:5766
bool purge_source_logs_before_date(THD *thd, time_t purge_time)
Execute a PURGE BINARY LOGS BEFORE <date> command.
Definition: binlog.cc:3374
bool stmt_has_updated_trans_table(Ha_trx_info_list const &ha_list)
This function checks if a transactional table was updated by the current statement.
Definition: binlog.cc:3262
bool ending_trans(THD *thd, const bool all)
This function checks if a transaction, either a multi-statement or a single statement transaction is ...
Definition: binlog.cc:3280
int query_error_code(const THD *thd, bool not_killed)
Definition: binlog.cc:3402
void process_after_commit_stage_queue(THD *thd, THD *first)
Process after commit for a sequence of sessions.
Definition: binlog.cc:8626
std::pair< int, my_off_t > flush_thread_caches(THD *thd)
Flush caches for session.
Definition: binlog.cc:8403
bool write_transaction(THD *thd, binlog_cache_data *cache_data, Binlog_event_writer *writer, bool parallelization_barrier)
Write the Gtid_log_event to the binary log (prior to writing the statement or transaction cache).
Definition: binlog.cc:1675
int move_crash_safe_index_file_to_index_file(bool need_lock_index)
Move crash safe index file to index file.
Definition: binlog.cc:5283
void report_missing_gtids(const Gtid_set *previous_gtid_set, const Gtid_set *slave_executed_gtid_set, std::string &errmsg)
Function to report the missing GTIDs.
Definition: binlog.cc:9268
int purge_index_entry(THD *thd, ulonglong *decrease_log_space, bool need_lock_index)
Definition: binlog.cc:6288
bool init_and_set_log_file_name(const char *log_name, const char *new_name, uint32 new_index_number)
Definition: binlog.cc:3914
const char * generate_name(const char *log_name, const char *suffix, char *buff)
Definition: binlog.cc:3895
int purge_logs_before_date(time_t purge_time, bool auto_purge)
Remove all logs before the given file date from disk and from the index file.
Definition: binlog.cc:6452
bool opt_binlog_order_commits
Definition: binlog.cc:182
void init_thd_variables(THD *thd, bool all, bool skip_commit)
Set thread variables used while flushing a transaction.
Definition: binlog.cc:8420
int open_crash_safe_index_file()
Open a (new) crash safe index file.
Definition: binlog.cc:5956
void start_union_events(THD *thd, query_id_t query_id_param)
Definition: binlog.cc:7078
bool is_inited_purge_index_file()
Definition: binlog.cc:6255
bool init_gtid_sets(Gtid_set *all_gtids, Gtid_set *lost_gtids, bool verify_checksum, bool need_lock, mysql::binlog::event::Transaction_boundary_parser *trx_parser, Gtid_monitoring_info *partial_trx, bool is_server_starting=false)
Reads the set of all GTIDs in the binary/relay log, and the set of all lost GTIDs in the binary log,...
Definition: binlog.cc:4698
bool open_index_file(const char *index_file_name_arg, const char *log_name, bool need_lock_index)
Definition: binlog.cc:3993
bool assign_automatic_gtids_to_flush_group(THD *first_seen)
Assign automatic generated GTIDs for all commit group threads in the flush stage having gtid_next....
Definition: binlog.cc:1610
int register_create_index_entry(const char *entry)
Definition: binlog.cc:6283
int close_crash_safe_index_file()
Close the crash safe index file.
Definition: binlog.cc:5988
void auto_purge()
This function runs automatic purge if the conditions to meet automatic purge are met.
Definition: binlog.cc:7350
int prepare(THD *thd, bool all) override
Log a prepare record of the transaction to the storage engines.
Definition: binlog.cc:8061
void handle_binlog_flush_or_sync_error(THD *thd, bool need_lock_log, const char *message)
Helper function to handle flush or sync stage errors.
Definition: binlog.cc:8845
int ordered_commit(THD *thd, bool all, bool skip_commit=false)
Flush and commit the transaction.
Definition: binlog.cc:8893
int add_log_to_index(uchar *log_file_name, size_t name_len, bool need_lock_index)
Append log file name to index file.
Definition: binlog.cc:5441
void adjust_linfo_offsets(my_off_t purge_offset)
Adjust the position pointer in the binary log file for all running replicas.
Definition: binlog.cc:7511
MYSQL_BIN_LOG(uint *sync_period, bool relay_log=false)
Definition: binlog.cc:3658
bool flush_and_sync(const bool force=false)
Flush binlog cache and synchronize to disk.
Definition: binlog.cc:7068
int new_file(Format_description_log_event *extra_description_event)
Definition: binlog.cc:6618
bool show_binlog_events(THD *thd, MYSQL_BIN_LOG *binary_log)
Definition: binlog.cc:3509
void inc_prep_xids(THD *thd)
Increment the prepared XID counter.
Definition: binlog.cc:6583
void dec_prep_xids(THD *thd)
Decrement the prepared XID counter.
Definition: binlog.cc:6594
void stop_union_events(THD *thd)
Definition: binlog.cc:7086
bool flush()
Definition: binlog.cc:7064
void signal_update()
Notifies waiting threads that binary log has been updated.
Definition: binlog.cc:9327
int check_trx_rw_engines(THD *thd, Transaction_ctx::enum_trx_scope trx_scope)
Check if the transaction has no rw flag set for any of the storage engines.
Definition: binlog.cc:3217
bool find_first_log_not_in_gtid_set(char *binlog_file_name, const Gtid_set *gtid_set, Gtid *first_gtid, std::string &errmsg)
Find the oldest binary log that contains any GTID that is not in the given gtid set.
Definition: binlog.cc:4600
void report_binlog_write_error()
Definition: binlog.cc:7698
bool after_write_to_relay_log(Master_info *mi)
Called after an event has been written to the relay log by the IO thread.
Definition: binlog.cc:6886
void auto_purge_at_server_startup()
This member function is to be called at server startup.
Definition: binlog.cc:7338
bool write_incident_commit(THD *thd, std::string_view incident_message)
Write an incident and call commit.
Definition: binlog.cc:2631
#define log_info(...)
Definition: log_client.h:153
unsigned int PSI_cond_key
Instrumented cond key.
Definition: psi_cond_bits.h:44
unsigned int PSI_file_key
Instrumented file key.
Definition: psi_file_bits.h:48
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
#define mysql_mutex_assert_not_owner(M)
Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes.
Definition: mysql_mutex.h:126
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
uint8_t uint8
Definition: my_inttypes.h:63
ulonglong my_off_t
Definition: my_inttypes.h:72
unsigned char uchar
Definition: my_inttypes.h:52
int64_t int64
Definition: my_inttypes.h:68
int32_t int32
Definition: my_inttypes.h:66
uint32_t uint32
Definition: my_inttypes.h:67
Common #defines and includes for file and socket I/O.
#define FN_REFLEN
Definition: my_io.h:83
Functions related to handling of plugins and other dynamically loaded libraries.
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:71
enum_sql_command
Definition: my_sqlcommand.h:46
Common header for many mysys elements.
uint32 my_thread_id
Definition: my_thread_local.h:34
static int not_killed
Definition: myisamchk.cc:1619
static uint update
Definition: myisamlog.cc:94
static QUEUE queue
Definition: myisampack.cc:210
Common definition between mysql server & client.
#define NAME_LEN
Definition: mysql_com.h:67
Instrumentation helpers for conditions.
ABI for instrumented mutexes.
Type inc(Shards< COUNT > &shards, size_t id)
Increment the counter of a shard by 1.
Definition: ut0counter.h:293
Definition: buf0block_hint.cc:30
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:498
enum_binlog_checksum_alg
Enumeration spcifying checksum algorithm used to encode a binary log event.
Definition: binlog_event.h:462
Instrumentation helpers for conditions.
Instrumentation helpers for mutexes.
Performance schema instrumentation interface.
Performance schema instrumentation interface.
Instrumentation helpers for mutexes.
required string event
Definition: replication_group_member_actions.proto:32
Item_result type
Definition: binlog.h:93
ulong length
Definition: binlog.h:92
char * value
Definition: binlog.h:91
bool unsigned_flag
Definition: binlog.h:95
user_var_entry * user_var_event
Definition: binlog.h:90
uint charset_number
Definition: binlog.h:94
TODO: Move this structure to mysql/binlog/event/control_events.h when we start using C++11.
Definition: rpl_gtid.h:1100
Definition: binlog.h:1118
bool log_delayed
Definition: binlog.h:1121
my_off_t last_pos_in_file
Definition: binlog.h:1120
bool logged_data_file
Definition: binlog.h:1121
THD * thd
Definition: binlog.h:1119
my_thread_id thread_id
Definition: binlog.h:122
my_off_t pos
Definition: binlog.h:118
my_off_t index_file_start_offset
Definition: binlog.h:117
LOG_INFO()
Definition: binlog.h:123
bool fatal
Definition: binlog.h:119
char log_file_name[FN_REFLEN]
Definition: binlog.h:116
my_off_t index_file_offset
Definition: binlog.h:117
int entry_index
Definition: binlog.h:120
int encrypted_header_size
Definition: binlog.h:121
Definition: completion_hash.h:35
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
MySQL mutex implementation.
Include file for Sun RPC to compile out of the box.
Transaction boundary parser definitions.
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
static int all(site_def const *s, node_no node)
Definition: xcom_transport.cc:884