My Project
|
#include "sql_priv.h"
#include "debug_sync.h"
#include "unireg.h"
#include "lock.h"
#include "sql_base.h"
#include "sql_parse.h"
#include "sql_acl.h"
#include <hash.h>
#include <assert.h>
#include "my_atomic.h"
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 |
Locking functions for mysql.
Because of the new concurrent inserts, we must first get external locks before getting internal locks. If we do it in the other order, the status information is not up to date when called from the lock handler.
GENERAL DESCRIPTION OF LOCKING
When not using LOCK TABLES:
When using LOCK TABLES:
The tables used can only be tables used in LOCK TABLES or a temporary table.
If table_handler->external_lock(thd, locktype) fails, we call table_handler->external_lock(thd, F_UNLCK) for each table that was locked, excluding one that caused failure. That means handler must cleanup itself in case external_lock() fails.