MySQL 9.0.0
Source Code Documentation
|
#include <string.h>
#include <sys/types.h>
#include <atomic>
#include "lex_string.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_psi_config.h"
#include "my_sqlcommand.h"
#include "my_sys.h"
#include "mysql/psi/mysql_transaction.h"
#include "mysql/thread_type.h"
#include "mysqld_error.h"
#include "sql/mysqld.h"
#include "sql/rpl_gtid.h"
#include "sql/rpl_rli.h"
#include "sql/sql_class.h"
#include "sql/sql_lex.h"
#include "sql/sql_parse.h"
#include "sql/system_variables.h"
Functions | |
bool | set_gtid_next (THD *thd, const Gtid_specification &spec) |
Acquire ownership of the given Gtid_specification. More... | |
bool | is_already_logged_transaction (const THD *thd) |
Acquire ownership of all gtids in a Gtid_set. More... | |
static void | skip_statement (THD *thd) |
Debug code executed when a transaction is skipped. More... | |
bool | gtid_reacquire_ownership_if_anonymous (THD *thd) |
If gtid_next=ANONYMOUS or NOT_YET_DETERMINED, but the thread does not hold anonymous ownership, acquire anonymous ownership. More... | |
static bool | is_stmt_taking_table_wr_locks (const THD *thd) |
Checks whether or not the statement held by the THD object is taking table write-locks. More... | |
static bool | is_stmt_innocent (const THD *thd) |
Return true if the statement does not invoke any stored function, and is one of the following: More... | |
enum_gtid_statement_status | gtid_pre_statement_checks (THD *thd) |
Perform GTID-related checks before executing a statement: More... | |
bool | gtid_pre_statement_post_implicit_commit_checks (THD *thd) |
Perform GTID-related checks before executing a statement, but after executing an implicit commit before the statement, if any: More... | |
void | gtid_set_performance_schema_values (const THD *thd) |
enum_gtid_statement_status gtid_pre_statement_checks | ( | THD * | thd | ) |
Perform GTID-related checks before executing a statement:
thd | THD object for the session. |
GTID_STATEMENT_EXECUTE | The normal case: the checks succeeded, and statement can execute. |
GTID_STATEMENT_CANCEL | The checks failed; an error has be generated and the statement must stop. |
GTID_STATEMENT_SKIP | The checks succeeded, but the GTID has already been executed (exists in GTID_EXECUTED). So the statement must not execute; however, if there are implicit commits, then the implicit commits must execute. |
bool gtid_pre_statement_post_implicit_commit_checks | ( | THD * | thd | ) |
Perform GTID-related checks before executing a statement, but after executing an implicit commit before the statement, if any:
If gtid_next=anonymous, but the thread does not hold anonymous ownership, then acquire anonymous ownership. (Do this only if this is not an 'innocent' statement, i.e., SET/SHOW/DO/SELECT that does not invoke a stored function.)
It is important that this is done after the implicit commit, because the implicit commit may release anonymous ownership.
thd | THD object for the session |
false | Success. |
true | Error. Error can happen if GTID_MODE=ON. The error has been reported by (a function called by) this function. |
bool gtid_reacquire_ownership_if_anonymous | ( | THD * | thd | ) |
If gtid_next=ANONYMOUS or NOT_YET_DETERMINED, but the thread does not hold anonymous ownership, acquire anonymous ownership.
thd | Thread. |
true | Error (can happen if gtid_mode=ON and gtid_next=anonymous). The error has already been reported using my_error. |
false | Success. |
void gtid_set_performance_schema_values | ( | const THD * | thd | ) |
bool is_already_logged_transaction | ( | const THD * | thd | ) |
Acquire ownership of all gtids in a Gtid_set.
Check if current transaction should be skipped, that is, if GTID_NEXT was already logged.
This is used to begin a commit-sequence when @SESSION.GTID_NEXT_LIST != NULL.
|
static |
Return true if the statement does not invoke any stored function, and is one of the following:
|
static |
Checks whether or not the statement held by the THD
object is taking table write-locks.
thd | the THD object holding the statement to examine |
bool set_gtid_next | ( | THD * | thd, |
const Gtid_specification & | spec | ||
) |
Acquire ownership of the given Gtid_specification.
The Gtid_specification must be of type ASSIGNED_GTID or ANONYMOUS_GTID.
The caller must hold global_tsid_lock (normally the rdlock). The lock may be temporarily released and acquired again. In the end, the lock will be released, so the caller should not release the lock.
The function will try to acquire ownership of the GTID and update both THD::gtid_next, Gtid_state::owned_gtids, and THD::owned_gtid / THD::owned_sid.
thd | The thread that acquires ownership. |
spec | The Gtid_specification. |
false | Success: either we have acquired ownership of the GTID, or it is already included in GTID_EXECUTED and will be skipped. |
true | Failure; the thread was killed or an error occurred. The error has been reported using my_error. |
|
inlinestatic |
Debug code executed when a transaction is skipped.
thd | The calling thread. |