MySQL 8.0.40
Source Code Documentation
|
#include "sql/transaction.h"
#include <stddef.h>
#include "lex_string.h"
#include "m_ctype.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_loglevel.h"
#include "my_psi_config.h"
#include "my_sys.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/psi/mysql_transaction.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "sql/auth/auth_common.h"
#include "sql/dd/cache/dictionary_client.h"
#include "sql/debug_sync.h"
#include "sql/handler.h"
#include "sql/log.h"
#include "sql/mdl.h"
#include "sql/mysqld.h"
#include "sql/query_options.h"
#include "sql/rpl_context.h"
#include "sql/rpl_gtid.h"
#include "sql/rpl_rli.h"
#include "sql/rpl_transaction_write_set_ctx.h"
#include "sql/session_tracker.h"
#include "sql/sql_class.h"
#include "sql/sql_lex.h"
#include "sql/system_variables.h"
#include "sql/tc_log.h"
#include "sql/transaction_info.h"
#include "sql/xa.h"
Functions | |
void | trans_track_end_trx (THD *thd) |
Helper: Tell tracker (if any) that transaction ended. More... | |
void | trans_reset_one_shot_chistics (THD *thd) |
Helper: transaction ended, SET TRANSACTION one-shot variables revert to session values. More... | |
bool | trans_check_state (THD *thd) |
Check if we have a condition where the transaction state must not be changed (committed or rolled back). More... | |
bool | trans_begin (THD *thd, uint flags) |
Begin a new transaction. More... | |
bool | trans_commit (THD *thd, bool ignore_global_read_lock) |
Commit the current transaction, making its changes permanent. More... | |
bool | trans_commit_implicit (THD *thd, bool ignore_global_read_lock) |
Implicitly commit the current transaction. More... | |
bool | trans_rollback (THD *thd) |
Rollback the current transaction, canceling its changes. More... | |
bool | trans_rollback_implicit (THD *thd) |
Implicitly rollback the current transaction, typically after deadlock was discovered. More... | |
bool | trans_commit_stmt (THD *thd, bool ignore_global_read_lock) |
Commit the single statement transaction. More... | |
bool | trans_rollback_stmt (THD *thd) |
Rollback the single statement transaction. More... | |
bool | trans_commit_attachable (THD *thd) |
Commit the attachable transaction. More... | |
static SAVEPOINT ** | find_savepoint (THD *thd, LEX_STRING name) |
bool | trans_savepoint (THD *thd, LEX_STRING name) |
Set a named transaction savepoint. More... | |
bool | trans_rollback_to_savepoint (THD *thd, LEX_STRING name) |
Rollback a transaction to the named savepoint. More... | |
bool | trans_release_savepoint (THD *thd, LEX_STRING name) |
Remove the named savepoint from the set of savepoints of the current transaction. More... | |
|
static |
Begin a new transaction.
thd | Current thread |
flags | Transaction flags |
false | Success |
true | Failure |
bool trans_check_state | ( | THD * | thd | ) |
Check if we have a condition where the transaction state must not be changed (committed or rolled back).
Currently we check that we are not executing a stored program and that we don't have an active XA transaction.
bool trans_commit | ( | THD * | thd, |
bool | ignore_global_read_lock | ||
) |
Commit the current transaction, making its changes permanent.
[in] | thd | Current thread |
[in] | ignore_global_read_lock | Allow commit to complete even if a global read lock is active. This can be used to allow changes to internal tables (e.g. slave status tables, analyze table). |
false | Success |
true | Failure |
bool trans_commit_attachable | ( | THD * | thd | ) |
Commit the attachable transaction.
thd | Current thread |
False | - Success |
True | - Failure |
bool trans_commit_implicit | ( | THD * | thd, |
bool | ignore_global_read_lock | ||
) |
Implicitly commit the current transaction.
[in] | thd | Current thread |
[in] | ignore_global_read_lock | Allow commit to complete even if a global read lock is active. This can be used to allow changes to internal tables (e.g. slave status tables, analyze table). |
false | Success |
true | Failure |
bool trans_commit_stmt | ( | THD * | thd, |
bool | ignore_global_read_lock | ||
) |
Commit the single statement transaction.
[in] | thd | Current thread |
[in] | ignore_global_read_lock | Allow commit to complete even if a global read lock is active. This can be used to allow changes to internal tables (e.g. slave status tables, analyze table). |
false | Success |
true | Failure |
bool trans_release_savepoint | ( | THD * | thd, |
LEX_STRING | name | ||
) |
Remove the named savepoint from the set of savepoints of the current transaction.
thd | Current thread |
name | Savepoint name |
false | Success |
true | Failure |
void trans_reset_one_shot_chistics | ( | THD * | thd | ) |
Helper: transaction ended, SET TRANSACTION one-shot variables revert to session values.
Let the transaction state tracker know.
bool trans_rollback | ( | THD * | thd | ) |
Rollback the current transaction, canceling its changes.
thd | Current thread |
false | Success |
true | Failure |
bool trans_rollback_implicit | ( | THD * | thd | ) |
Implicitly rollback the current transaction, typically after deadlock was discovered.
thd | Current thread |
False | Success |
True | Failure |
bool trans_rollback_stmt | ( | THD * | thd | ) |
Rollback the single statement transaction.
thd | Current thread |
false | Success |
true | Failure |
bool trans_rollback_to_savepoint | ( | THD * | thd, |
LEX_STRING | name | ||
) |
Rollback a transaction to the named savepoint.
thd | Current thread |
name | Savepoint name |
false | Success |
true | Failure |
Checking whether it is safe to release metadata locks acquired after savepoint, if rollback to savepoint is successful.
Whether it is safe to release MDL after rollback to savepoint depends on storage engines participating in transaction:
bool trans_savepoint | ( | THD * | thd, |
LEX_STRING | name | ||
) |
Set a named transaction savepoint.
thd | Current thread |
name | Savepoint name |
false | Success |
true | Failure |
void trans_track_end_trx | ( | THD * | thd | ) |
Helper: Tell tracker (if any) that transaction ended.