My Project
|
Classes | |
class | Mutex_sentry |
class | Thread_excursion |
class | binlog_cache_data |
class | binlog_stmt_cache_data |
class | binlog_trx_cache_data |
class | binlog_cache_mngr |
class | Row_data_memory |
Enumerations | |
enum | enum_read_gtids_from_binlog_status { GOT_GTIDS, GOT_PREVIOUS_GTIDS, NO_GTIDS, ERROR, TRUNCATED } |
Functions | |
void | check_binlog_cache_size (THD *thd) |
void | check_binlog_stmt_cache_size (THD *thd) |
bool | binlog_enabled () |
int | gtid_empty_group_log_and_cleanup (THD *thd) |
int | check_binlog_magic (IO_CACHE *log, const char **errmsg) |
File | open_binlog_file (IO_CACHE *log, const char *log_file_name, const char **errmsg) |
bool | trans_has_updated_trans_table (const THD *thd) |
bool | stmt_has_updated_trans_table (const THD *thd) |
bool | ending_trans (THD *thd, const bool all) |
bool | ending_single_stmt_trans (THD *thd, const bool all) |
bool | trans_cannot_safely_rollback (const THD *thd) |
bool | stmt_cannot_safely_rollback (const THD *thd) |
bool | purge_master_logs (THD *thd, const char *to_log) |
bool | purge_master_logs_before_date (THD *thd, time_t purge_time) |
int | query_error_code (THD *thd, bool not_killed) |
int | log_loaded_block (IO_CACHE *file) |
bool | show_binlog_events (THD *thd, MYSQL_BIN_LOG *binary_log) |
bool | mysql_show_binlog_events (THD *thd) |
void | register_binlog_handler (THD *thd, bool trx) |
int | binlog_stmt_cache_data::finalize (THD *thd) |
int | binlog_cache_data::write_event (THD *thd, Log_event *event) |
int | binlog_cache_data::finalize (THD *thd, Log_event *end_event) |
int | binlog_cache_data::flush (THD *thd, my_off_t *bytes, bool *wrote_xid) |
int | binlog_trx_cache_data::truncate (THD *thd, bool all) |
bool | Stage_manager::Mutex_queue::append (THD *first) |
std::pair< bool, THD * > | Stage_manager::Mutex_queue::pop_front () |
bool | Stage_manager::enroll_for (StageID stage, THD *first, mysql_mutex_t *stage_mutex) |
THD * | Stage_manager::Mutex_queue::fetch_and_empty () |
void | Stage_manager::clear_preempt_status (THD *head) |
int | MYSQL_BIN_LOG::rollback (THD *thd, bool all) |
MYSQL_BIN_LOG::MYSQL_BIN_LOG (uint *sync_period) | |
void | MYSQL_BIN_LOG::cleanup () |
void | MYSQL_BIN_LOG::init_pthread_objects () |
bool | MYSQL_BIN_LOG::open_index_file (const char *index_file_name_arg, const char *log_name, bool need_lock_index) |
bool | MYSQL_BIN_LOG::find_first_log_not_in_gtid_set (char *binlog_file_name, const Gtid_set *gtid_set, Gtid *first_gtid, const char **errmsg) |
bool | MYSQL_BIN_LOG::init_gtid_sets (Gtid_set *gtid_set, Gtid_set *lost_groups, Gtid *last_gtid, bool verify_checksum, bool need_lock, bool is_server_starting=false) |
bool | MYSQL_BIN_LOG::open_binlog (const char *log_name, const char *new_name, enum cache_type io_cache_type_arg, ulong max_size, bool null_created, bool need_lock_index, bool need_sid_lock, Format_description_log_event *extra_description_event) |
int | MYSQL_BIN_LOG::move_crash_safe_index_file_to_index_file (bool need_lock_index) |
int | MYSQL_BIN_LOG::add_log_to_index (uchar *log_file_name, int name_len, bool need_lock_index) |
int | MYSQL_BIN_LOG::get_current_log (LOG_INFO *linfo) |
int | MYSQL_BIN_LOG::raw_get_current_log (LOG_INFO *linfo) |
bool | MYSQL_BIN_LOG::check_write_error (THD *thd) |
void | MYSQL_BIN_LOG::set_write_error (THD *thd, bool is_transactional) |
int | MYSQL_BIN_LOG::find_log_pos (LOG_INFO *linfo, const char *log_name, bool need_lock_index) |
int | MYSQL_BIN_LOG::find_next_log (LOG_INFO *linfo, bool need_lock_index) |
bool | MYSQL_BIN_LOG::reset_logs (THD *thd) |
int | MYSQL_BIN_LOG::set_crash_safe_index_file_name (const char *base_file_name) |
int | MYSQL_BIN_LOG::open_crash_safe_index_file () |
int | MYSQL_BIN_LOG::close_crash_safe_index_file () |
int | MYSQL_BIN_LOG::purge_first_log (Relay_log_info *rli, bool included) |
int | MYSQL_BIN_LOG::remove_logs_from_index (LOG_INFO *linfo, bool need_update_threads) |
int | MYSQL_BIN_LOG::purge_logs (const char *to_log, bool included, bool need_lock_index, bool need_update_threads, ulonglong *decrease_log_space, bool auto_purge) |
int | MYSQL_BIN_LOG::set_purge_index_file_name (const char *base_file_name) |
int | MYSQL_BIN_LOG::open_purge_index_file (bool destroy) |
int | MYSQL_BIN_LOG::close_purge_index_file () |
bool | MYSQL_BIN_LOG::is_inited_purge_index_file () |
int | MYSQL_BIN_LOG::sync_purge_index_file () |
int | MYSQL_BIN_LOG::register_purge_index_entry (const char *entry) |
int | MYSQL_BIN_LOG::register_create_index_entry (const char *entry) |
int | MYSQL_BIN_LOG::purge_index_entry (THD *thd, ulonglong *decrease_log_space, bool need_lock_index) |
int | MYSQL_BIN_LOG::purge_logs_before_date (time_t purge_time, bool auto_purge) |
void | MYSQL_BIN_LOG::make_log_name (char *buf, const char *log_ident) |
bool | MYSQL_BIN_LOG::is_active (const char *log_file_name) |
int | MYSQL_BIN_LOG::new_file (Format_description_log_event *extra_description_event) |
bool | MYSQL_BIN_LOG::flush_and_sync (const bool force=false) |
void | MYSQL_BIN_LOG::start_union_events (THD *thd, query_id_t query_id_param) |
void | MYSQL_BIN_LOG::stop_union_events (THD *thd) |
bool | MYSQL_BIN_LOG::is_query_in_union (THD *thd, query_id_t query_id_param) |
void | MYSQL_BIN_LOG::update_thd_next_event_pos (THD *thd) |
int | MYSQL_BIN_LOG::flush_and_set_pending_rows_event (THD *thd, Rows_log_event *event, bool is_transactional) |
bool | MYSQL_BIN_LOG::write_event (Log_event *event_info) |
int | MYSQL_BIN_LOG::rotate (bool force_rotate, bool *check_purge) |
void | MYSQL_BIN_LOG::purge () |
int | MYSQL_BIN_LOG::rotate_and_purge (THD *thd, bool force_rotate) |
uint | MYSQL_BIN_LOG::next_file_id () |
int | MYSQL_BIN_LOG::do_write_cache (IO_CACHE *cache) |
bool | MYSQL_BIN_LOG::write_incident (Incident_log_event *ev, bool need_lock_log, bool do_flush_and_sync=true) |
bool | MYSQL_BIN_LOG::write_incident (THD *thd, bool need_lock_log, bool do_flush_and_sync=true) |
bool | MYSQL_BIN_LOG::write_cache (THD *thd, class binlog_cache_data *binlog_cache_data) |
int | MYSQL_BIN_LOG::wait_for_update_relay_log (THD *thd, const struct timespec *timeout) |
int | MYSQL_BIN_LOG::wait_for_update_bin_log (THD *thd, const struct timespec *timeout) |
void | MYSQL_BIN_LOG::close (uint exiting) |
void | MYSQL_BIN_LOG::set_max_size (ulong max_size_arg) |
void | MYSQL_BIN_LOG::signal_update () |
int | MYSQL_BIN_LOG::open_binlog (const char *opt_name) |
void | MYSQL_BIN_LOG::close () |
int | MYSQL_BIN_LOG::prepare (THD *thd, bool all) |
enum_result | MYSQL_BIN_LOG::commit (THD *thd, bool all) |
int | MYSQL_BIN_LOG::recover (IO_CACHE *log, Format_description_log_event *fdle, my_off_t *valid_pos) |
Variables | |
bool | opt_binlog_order_commits = true |
const char * | log_bin_index = 0 |
const char * | log_bin_basename = 0 |
MYSQL_BIN_LOG mysql_bin_log & | sync_binlog_period |
struct st_mysql_storage_engine | binlog_storage_engine |
Reads GTIDs from the given binlog file.
filename | File to read from. |
all_gtids | If not NULL, then the GTIDs from the Previous_gtids_log_event and from all Gtid_log_events are stored in this object. |
prev_gtids | If not NULL, then the GTIDs from the Previous_gtids_log_events are stored in this object. |
first_gtid | If not NULL, then the first GTID information from the file will be stored in this object. |
last_gtid | If not NULL, then the last GTID information from the file will be stored in this object. |
sid_map | The sid_map object to use in the rpl_sidno generation of the Gtid_log_event. If lock is needed in the sid_map, the caller must hold it. |
verify_checksum | Set to true to verify event checksums. |
GOT_GTIDS | The file was successfully read and it contains both Gtid_log_events and Previous_gtids_log_events. |
GOT_PREVIOUS_GTIDS | The file was successfully read and it contains Previous_gtids_log_events but no Gtid_log_events. |
NO_GTIDS | The file was successfully read and it does not contain GTID events. |
ERROR | Out of memory, or the file contains GTID events when GTID_MODE = OFF, or the file is malformed (e.g., contains Gtid_log_events but no Previous_gtids_log_event). |
TRUNCATED | The file was truncated before the end of the first Previous_gtids_log_event. |
int MYSQL_BIN_LOG::add_log_to_index | ( | uchar * | log_name, |
int | log_name_len, | ||
bool | need_lock_index | ||
) |
Append log file name to index file.
0 | ok |
-1 | error |
bool Stage_manager::Mutex_queue::append | ( | THD * | first | ) |
Append a linked list of threads to the queue
bool binlog_enabled | ( | ) |
Check whether binlog_hton has valid slot and enabled
void check_binlog_cache_size | ( | THD * | thd | ) |
Checks if the BINLOG_CACHE_SIZE's value is greater than MAX_BINLOG_CACHE_SIZE. If this happens, the BINLOG_CACHE_SIZE is set to MAX_BINLOG_CACHE_SIZE.
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. If this happens, the BINLOG_STMT_CACHE_SIZE is set to MAX_BINLOG_STMT_CACHE_SIZE.
void MYSQL_BIN_LOG::cleanup | ( | ) |
This is called only once.
Reimplemented from MYSQL_LOG.
void Stage_manager::clear_preempt_status | ( | THD * | head | ) |
The method ensures the follower's execution path can be preempted by the leader's thread. Preempt status of head
follower is checked to engange the leader into waiting when set.
head | THD* of a follower thread |
void MYSQL_BIN_LOG::close | ( | ) | [virtual] |
This is called on shutdown, after ha_panic.
Implements TC_LOG.
void MYSQL_BIN_LOG::close | ( | uint | exiting | ) |
Close the log file.
exiting | Bitmask for one or more of the following bits:
|
Reimplemented from MYSQL_LOG.
Close the crash safe index file.
0 | ok |
1 | error |
TC_LOG::enum_result MYSQL_BIN_LOG::commit | ( | THD * | thd, |
bool | all | ||
) | [virtual] |
Commit the transaction in the transaction coordinator.
This function will commit the sessions transaction in the binary log and in the storage engines (by calling ha_commit_low
). If the transaction was successfully logged (or not successfully unlogged) but the commit in the engines did not succed, there is a risk of inconsistency between the engines and the binary log.
For binary log group commit, the commit is separated into three parts:
1. First part consists of filling the necessary caches and finalizing them (if they need to be finalized). After this, nothing is added to any of the caches.
2. Second part execute an ordered flush and commit. This will be done using the group commit functionality in ordered_commit.
3. Third part checks any errors resulting from the ordered commit and handles them appropriately.
0 | success |
1 | error, transaction was neither logged nor committed |
2 | error, transaction was logged but not committed |
Implements TC_LOG.
bool ending_single_stmt_trans | ( | THD * | thd, |
const bool | all | ||
) |
This function checks if a single statement transaction is about to commit or not.
thd | The client thread that executed the current statement. |
all | Committing a transaction (i.e. TRUE) or a statement (i.e. FALSE). |
true
if committing a single statement transaction, otherwise false
. bool ending_trans | ( | THD * | thd, |
const bool | all | ||
) |
This function checks if a transaction, either a multi-statement or a single statement transaction is about to commit or not.
thd | The client thread that executed the current statement. |
all | Committing a transaction (i.e. TRUE) or a statement (i.e. FALSE). |
true
if committing a transaction, otherwise false
. bool Stage_manager::enroll_for | ( | StageID | stage, |
THD * | first, | ||
mysql_mutex_t * | stage_mutex | ||
) |
Enroll a set of sessions for a stage.
This will queue the session thread for writing and flushing.
If the thread being queued is assigned as stage leader, it will return immediately.
If wait_if_follower is true the thread is not the stage leader, the thread will be wait for the queue to be processed by the leader before it returns. In DBUG-ON version the follower marks is preempt status as ready.
stage | Stage identifier for the queue to append to. |
first | Queue to append. |
stage_mutex | Pointer to the currently held stage mutex, or NULL if we're not in a stage. |
true | Thread is stage leader. |
false | Thread was not stage leader and processing has been done. |
Fetch the entire queue for a stage.
This will fetch the entire queue in one go.
int binlog_cache_data::finalize | ( | THD * | thd, |
Log_event * | end_event | ||
) |
This function finalizes the cache preparing for commit or rollback.
The function just writes all the necessary events to the cache but does not flush the data to the binary log file. That is the role of the binlog_cache_data::flush function.
thd | The thread whose transaction should be flushed |
cache_data | Pointer to the cache |
end_ev | The end event either commit/rollback |
bool MYSQL_BIN_LOG::find_first_log_not_in_gtid_set | ( | char * | binlog_file_name, |
const Gtid_set * | gtid_set, | ||
Gtid * | first_gtid, | ||
const char ** | errmsg | ||
) |
Find the oldest binary log that contains any GTID that is not in the given gtid set.
[out] | binlog_file_name,the | file name of oldest binary log found |
[in] | gtid_set,the | given gtid set |
[out] | first_gtid,the | first GTID information from the binary log file returned at binlog_file_name |
[out] | errmsg,the | error message outputted, which is left untouched if the function returns false |
int MYSQL_BIN_LOG::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.
[out] | linfo | The found log file name will be stored here, along with the byte offset of the next log file name in the index file. |
log_name | Filename to find in the index file, or NULL if we want to read the first entry. | |
need_lock_index | If false, this function acquires LOCK_index; otherwise the lock should already be held by the caller. |
0 | ok |
LOG_INFO_EOF | End of log-index-file found |
LOG_INFO_IO | Got IO error while reading file |
int MYSQL_BIN_LOG::find_next_log | ( | LOG_INFO * | linfo, |
bool | need_lock_index | ||
) |
Find the position in the log-index-file for the given log name.
[out] | linfo | The filename will be stored here, along with the byte offset of the next filename in the index file. |
need_lock_index | If true, LOCK_index will be acquired; otherwise it should already be held by the caller. |
0 | ok |
LOG_INFO_EOF | End of log-index-file found |
LOG_INFO_IO | Got IO error while reading file |
int binlog_cache_data::flush | ( | THD * | thd, |
my_off_t * | bytes_written, | ||
bool * | wrote_xid | ||
) |
Flush caches to the binary log.
If the cache is finalized, the cache will be flushed to the binary log file. If the cache is not finalized, nothing will be done.
If flushing fails for any reason, an error will be reported and the cache will be reset. Flushing can fail in two circumstances:
bool MYSQL_BIN_LOG::flush_and_sync | ( | const bool | force = false | ) |
Flush binlog cache and synchronize to disk.
This function flushes events in binlog cache to binary log file, it will do synchronizing according to the setting of system variable 'sync_binlog'. If file is synchronized, synced
will be set to 1, otherwise 0.
[out] | synced | if not NULL, set to 1 if file is synchronized, otherwise 0 |
[in] | force | if TRUE, ignores the 'sync_binlog' and synchronizes the file. |
0 | Success |
other | Failure |
int gtid_empty_group_log_and_cleanup | ( | THD * | thd | ) |
The function logs an empty group with GTID and performs cleanup. Its logic wrt GTID is equivalent to one of binlog_commit(). It's called at the end of statement execution in case binlog_commit() was skipped. Such cases are due ineffective binlogging incl an empty group re-execution.
thd | The thread handle |
bool MYSQL_BIN_LOG::init_gtid_sets | ( | Gtid_set * | gtid_set, |
Gtid_set * | lost_groups, | ||
Gtid * | last_gtid, | ||
bool | verify_checksum, | ||
bool | need_lock, | ||
bool | is_server_starting = false |
||
) |
Reads the set of all GTIDs in the binary log, and the set of all lost GTIDs in the binary log, and stores each set in respective argument.
gtid_set | Will be filled with all GTIDs in this binary log. |
lost_groups | Will be filled with all GTIDs in the Previous_gtids_log_event of the first binary log that has a Previous_gtids_log_event. |
last_gtid | Will be filled with the last availble GTID information in the binary/relay log files. |
verify_checksum | If true, checksums will be checked. |
need_lock | If true, LOCK_log, LOCK_index, and global_sid_lock->wrlock are acquired; otherwise they are asserted to be taken already. |
is_server_starting | True if the server is starting. |
bool MYSQL_BIN_LOG::is_active | ( | const char * | log_file_name_arg | ) |
Check if we are writing/reading to the given log file.
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's buffer The fuction instantianates and writes into the binlog replication events along LOAD DATA processing.
file | pointer to io-cache |
0 | success |
1 | failure |
void MYSQL_BIN_LOG::make_log_name | ( | char * | buf, |
const char * | log_ident | ||
) |
Create a new log file name.
buf | buf of at least FN_REFLEN where new name is stored |
int MYSQL_BIN_LOG::move_crash_safe_index_file_to_index_file | ( | bool | need_lock_index | ) |
Move crash safe index file to index file.
need_lock_index | If true, LOCK_index will be acquired; otherwise it should already be held. |
0 | ok |
-1 | error |
bool mysql_show_binlog_events | ( | THD * | thd | ) |
Execute a SHOW BINLOG EVENTS statement.
thd | Pointer to THD object for the client thread executing the statement. |
FALSE | success |
TRUE | failure |
int MYSQL_BIN_LOG::open_binlog | ( | const char * | opt_name | ) |
bool MYSQL_BIN_LOG::open_binlog | ( | const char * | log_name, |
const char * | new_name, | ||
enum cache_type | io_cache_type_arg, | ||
ulong | max_size_arg, | ||
bool | null_created_arg, | ||
bool | need_lock_index, | ||
bool | need_sid_lock, | ||
Format_description_log_event * | extra_description_event | ||
) |
Create a new binary log.
log_name | Name of binlog |
new_name | Name of binlog, too. todo: what's the difference between new_name and log_name? |
io_cache_type_arg | Specifies how the IO cache is opened: read-only or read-write. |
max_size | The size at which this binlog will be rotated. |
null_created | If false, and a Format_description_log_event is written, then the Format_description_log_event will have the timestamp 0. Otherwise, it the timestamp will be the time when the event was written to the log. |
need_lock_index | If true, LOCK_index is acquired; otherwise LOCK_index must be taken by the caller. |
need_sid_lock | If true, the read lock on global_sid_lock will be acquired. Otherwise, the caller must hold the read lock on global_sid_lock. |
Open a (new) binlog file.
0 | ok |
1 | error |
Perhaps we might need the code below in MYSQL_LOG_BIN::cleanup for "real life" purposes as well?
File open_binlog_file | ( | IO_CACHE * | log, |
const char * | log_file_name, | ||
const char ** | errmsg | ||
) |
Open a single binary log file for reading.
Open a (new) crash safe index file.
0 | ok |
1 | error |
int MYSQL_BIN_LOG::prepare | ( | THD * | thd, |
bool | all | ||
) | [virtual] |
Log a prepare record of the transaction to the storage engines.
thd | Session to log transaction record for. |
all | true if an explicit commit or an implicit commit for a statement, false if an internal commit of the statement. |
Implements TC_LOG.
void MYSQL_BIN_LOG::purge | ( | ) |
The method executes logs purging routine.
nonzero | - error in rotating routine. |
int MYSQL_BIN_LOG::purge_first_log | ( | Relay_log_info * | rli, |
bool | included | ||
) |
Delete relay log files prior to rli->group_relay_log_name (i.e. all logs which are not involved in a non-finished group (transaction)), remove them from the index file and start on next relay log.
IMPLEMENTATION
rli | Relay log information |
included | If false, all relay logs that are strictly before rli->group_relay_log_name are deleted ; if true, the latter is deleted too (i.e. all relay logs read by the SQL slave thread are deleted). |
0 | ok |
LOG_INFO_EOF | End of log-index-file found |
LOG_INFO_SEEK | Could not allocate IO cache |
LOG_INFO_IO | Got IO error while reading file |
int MYSQL_BIN_LOG::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.
to_log | Delete all log file name before this file. |
included | If true, to_log is deleted too. |
need_lock_index | |
need_update_threads | If we want to update the log coordinates of all threads. False for relay logs, true otherwise. |
freed_log_space | If not null, decrement this variable of the amount of log space freed |
auto_purge | True if this is an automatic purge. |
0 | ok |
LOG_INFO_EOF | to_log not found LOG_INFO_EMFILE too many files opened LOG_INFO_FATAL if any other than ENOENT error from mysql_file_stat() or mysql_file_delete() |
int MYSQL_BIN_LOG::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.
thd | Thread pointer |
purge_time | Delete all log files before given date. |
auto_purge | True if this is an automatic purge. |
0 | ok |
LOG_INFO_PURGE_NO_ROTATE | Binary file that can't be rotated LOG_INFO_FATAL if any other than ENOENT error from mysql_file_stat() or mysql_file_delete() |
bool purge_master_logs | ( | THD * | thd, |
const char * | to_log | ||
) |
Execute a PURGE BINARY LOGS TO <log> command.
thd | Pointer to THD object for the client thread executing the statement. |
to_log | Name of the last log to purge. |
FALSE | success |
TRUE | failure |
bool purge_master_logs_before_date | ( | THD * | thd, |
time_t | purge_time | ||
) |
Execute a PURGE BINARY LOGS BEFORE <date> command.
thd | Pointer to THD object for the client thread executing the statement. |
purge_time | Date before which logs should be purged. |
FALSE | success |
TRUE | failure |
int MYSQL_BIN_LOG::recover | ( | IO_CACHE * | log, |
Format_description_log_event * | fdle, | ||
my_off_t * | valid_pos | ||
) |
MYSQLD server recovers from last crashed binlog.
log | IO_CACHE of the crashed binlog. |
fdle | Format_description_log_event of the crashed binlog. |
valid_pos | The position of the last valid transaction or event(non-transaction) of the crashed binlog. |
0 | ok |
1 | error |
int MYSQL_BIN_LOG::remove_logs_from_index | ( | LOG_INFO * | log_info, |
bool | need_update_threads | ||
) |
Remove logs from index file.
linfo | Store here the found log file name and position to the NEXT log file name in the index file. |
need_update_threads | If we want to update the log coordinates of all threads. False for relay logs, true otherwise. |
0 | ok |
LOG_INFO_IO | Got IO error while reading/writing file |
bool MYSQL_BIN_LOG::reset_logs | ( | THD * | thd | ) |
Removes files, as part of a RESET MASTER or RESET SLAVE statement, by deleting all logs refered to in the index file. Then, it starts writing to a new log file.
The new index file will only contain this file.
thd | Thread |
0 | ok |
1 | error |
int MYSQL_BIN_LOG::rollback | ( | THD * | thd, |
bool | all | ||
) | [virtual] |
Write a rollback record of the transaction to the binary log.
For binary log group commit, the rollback is separated into three parts:
1. First part consists of filling the necessary caches and finalizing them (if they need to be finalized). After a cache is finalized, nothing can be added to the cache.
2. Second part execute an ordered flush and commit. This will be done using the group commit functionality in ordered_commit
.
Since we roll back the transaction early, we call ordered_commit
with the skip_commit
flag set. The ha_commit_low
call inside ordered_commit
will then not be called.
3. Third part checks any errors resulting from the flush and handles them appropriately.
thd | Session to commit |
all | This is true if this is a real transaction rollback, and otherwise. |
Implements TC_LOG.
int MYSQL_BIN_LOG::rotate | ( | bool | force_rotate, |
bool * | check_purge | ||
) |
The method executes rotation when LOCK_log is already acquired by the caller.
force_rotate | caller can request the log rotation |
check_purge | is set to true if rotation took place |
nonzero | - error in rotating routine. |
Be conservative... There are possible lost events (eg, failing to log the Execute_load_query_log_event on a LOAD DATA while using a non-transactional table)!
We give it a shot and try to write an incident event anyway to the current log.
int MYSQL_BIN_LOG::rotate_and_purge | ( | THD * | thd, |
bool | force_rotate | ||
) |
int MYSQL_BIN_LOG::set_crash_safe_index_file_name | ( | const char * | base_file_name | ) |
Set the name of crash safe index file.
0 | ok |
1 | error |
bool stmt_cannot_safely_rollback | ( | const THD * | thd | ) |
This function checks if current statement cannot be rollded back safely.
thd | The client thread that executed the current statement. |
true
if cannot be safely rolled back, false
otherwise. bool stmt_has_updated_trans_table | ( | const THD * | thd | ) |
This function checks if a transactional table was updated by the current statement.
thd | The client thread that executed the current statement. |
true
if a transactional table was updated, false
otherwise. bool trans_cannot_safely_rollback | ( | const THD * | thd | ) |
This function checks if a transaction cannot be rolled back safely.
thd | The client thread that executed the current statement. |
true
if cannot be safely rolled back, false
otherwise. bool trans_has_updated_trans_table | ( | const THD * | thd | ) |
This function checks if a transactional table was updated by the current transaction.
thd | The client thread that executed the current statement. |
true
if a transactional table was updated, false
otherwise. int binlog_trx_cache_data::truncate | ( | THD * | thd, |
bool | all | ||
) |
This function truncates the transactional cache upon committing or rolling back either a transaction or a statement.
thd | The thread whose transaction should be flushed |
cache_mngr | Pointer to the cache data to be flushed |
all | true means truncate the transaction, otherwise the statement must be truncated. |
int MYSQL_BIN_LOG::wait_for_update_bin_log | ( | THD * | thd, |
const struct timespec * | timeout | ||
) |
Wait until we get a signal that the binary log has been updated. Applies to master only.
NOTES
[in] | thd | a THD struct |
[in] | timeout | a pointer to a timespec; NULL means to wait w/o timeout. |
0 | if got signalled on update |
non-0 | if wait timeout elapsed |
int MYSQL_BIN_LOG::wait_for_update_relay_log | ( | THD * | thd, |
const struct timespec * | timeout | ||
) |
Wait until we get a signal that the relay log has been updated.
[in] | thd | Thread variable |
[in] | timeout | a pointer to a timespec; NULL means to wait w/o timeout. |
0 | if got signalled on update |
non-0 | if wait timeout elapsed |
bool MYSQL_BIN_LOG::write_cache | ( | THD * | thd, |
class binlog_cache_data * | binlog_cache_data | ||
) |
Write a cached log entry to the binary log.
thd | Thread variable |
cache | The cache to copy to the binlog |
incident | Defines if an incident event should be created to notify that some non-transactional changes did not get into the binlog. |
prepared | Defines if a transaction is part of a 2-PC. |
bool MYSQL_BIN_LOG::write_event | ( | Log_event * | event_info | ) |
Write an event to the binary log.
bool MYSQL_BIN_LOG::write_incident | ( | THD * | thd, |
bool | need_lock_log, | ||
bool | do_flush_and_sync = true |
||
) |
Creates an incident event and writes it to the binary log.
thd | Thread variable |
ev | Incident event to be written |
lock | If the binary lock should be locked or not |
0 | error |
1 | success |
bool MYSQL_BIN_LOG::write_incident | ( | Incident_log_event * | ev, |
bool | need_lock_log, | ||
bool | do_flush_and_sync = true |
||
) |
Writes an incident event to the binary log.
ev | Incident event to be written |
need_lock_log | If true, will acquire LOCK_log; otherwise the caller should already have acquired LOCK_log. If true, will call flush_and_sync(), rotate() and purge(). |
false | error |
true | success |
struct st_mysql_storage_engine binlog_storage_engine |
{ MYSQL_HANDLERTON_INTERFACE_VERSION }