My Project
|
Defines | |
#define | GET_LOCK_UNLOCK 1 |
#define | GET_LOCK_STORE_LOCKS 2 |
Functions | |
MYSQL_LOCK * | mysql_lock_tables (THD *thd, TABLE **tables, uint count, uint flags) |
void | mysql_unlock_tables (THD *thd, MYSQL_LOCK *sql_lock) |
void | mysql_unlock_some_tables (THD *thd, TABLE **table, uint count) |
void | mysql_unlock_read_tables (THD *thd, MYSQL_LOCK *sql_lock) |
void | mysql_lock_remove (THD *thd, MYSQL_LOCK *locked, TABLE *table) |
void | mysql_lock_abort (THD *thd, TABLE *table, bool upgrade_lock) |
bool | mysql_lock_abort_for_thread (THD *thd, TABLE *table) |
MYSQL_LOCK * | mysql_lock_merge (MYSQL_LOCK *a, MYSQL_LOCK *b) |
bool | lock_schema_name (THD *thd, const char *db) |
bool | lock_object_name (THD *thd, MDL_key::enum_mdl_namespace mdl_type, const char *db, const char *name) |
Variables | |
HASH | open_cache |
bool lock_object_name | ( | THD * | thd, |
MDL_key::enum_mdl_namespace | mdl_type, | ||
const char * | db, | ||
const char * | name | ||
) |
Obtain an exclusive metadata lock on an object name.
thd | Thread handle. |
mdl_type | Object type (currently functions, procedures and events can be name-locked). |
db | The schema the object belongs to. |
name | Object name in the schema. |
This function assumes that no metadata locks were acquired before calling it. Additionally, it cannot be called while holding LOCK_open mutex. Both these invariants are enforced by asserts in MDL_context::acquire_locks(). To avoid deadlocks, we do not try to obtain exclusive metadata locks in LOCK TABLES mode, since in this mode there may be other metadata locks already taken by the current connection, and we must not wait for MDL locks while holding locks.
FALSE | Success. |
TRUE | Failure: we're in LOCK TABLES mode, or out of memory, or this connection was killed. |
bool lock_schema_name | ( | THD * | thd, |
const char * | db | ||
) |
Obtain an exclusive metadata lock on a schema name.
thd | Thread handle. |
db | The database name. |
This function cannot be called while holding LOCK_open mutex. To avoid deadlocks, we do not try to obtain exclusive metadata locks in LOCK TABLES mode, since in this mode there may be other metadata locks already taken by the current connection, and we must not wait for MDL locks while holding locks.
FALSE | Success. |
TRUE | Failure: we're in LOCK TABLES mode, or out of memory, or this connection was killed. |
void mysql_lock_abort | ( | THD * | thd, |
TABLE * | table, | ||
bool | upgrade_lock | ||
) |
Abort all other threads waiting to get lock in table.
bool mysql_lock_abort_for_thread | ( | THD * | thd, |
TABLE * | table | ||
) |
Abort one thread / table combination.
thd | Thread handler |
table | Table that should be removed from lock queue |
0 | Table was not locked by another thread |
1 | Table was locked by at least one other thread |
void mysql_lock_remove | ( | THD * | thd, |
MYSQL_LOCK * | locked, | ||
TABLE * | table | ||
) |
Try to find the table in the list of locked tables. In case of success, unlock the table and remove it from this list. If a table has more than one lock instance, removes them all.
thd | thread context |
locked | list of locked tables |
table | the table to unlock |
MYSQL_LOCK* mysql_lock_tables | ( | THD * | thd, |
TABLE ** | tables, | ||
uint | count, | ||
uint | flags | ||
) |
Lock tables.
thd | The current thread. |
tables | An array of pointers to the tables to lock. |
count | The number of tables to lock. |
flags | Options: MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY Ignore SET GLOBAL READ_ONLY MYSQL_LOCK_IGNORE_TIMEOUT Use maximum timeout value. |
A | lock structure pointer on success. |
NULL | if an error or if wait on a lock was killed. |
void mysql_unlock_read_tables | ( | THD * | thd, |
MYSQL_LOCK * | sql_lock | ||
) |
unlock all tables locked for read.
void mysql_unlock_some_tables | ( | THD * | thd, |
TABLE ** | table, | ||
uint | count | ||
) |
Unlock some of the tables locked by mysql_lock_tables.
This will work even if get_lock_data fails (next unlock will free all)