mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 14:32:34 +01:00
71a4f691b2
Active transactions must not switch table or index definitions on the fly, for several reasons, including the following: * copied indexes do not carry any history or locking information; that is, rollbacks, read views, and record locking would be broken * huge potential for race conditions, inconsistent reads and writes, loss of data, and corruption Instead of trying to track down if the table was changed during a transaction, acquire appropriate locks that protect the creation and dropping of indexes. innodb-index.test: Test the locking of CREATE INDEX and DROP INDEX. Test that consistent reads work across dropped indexes. lock_rec_insert_check_and_lock(): Relax the lock_table_has() assertion. When inserting a record into an index, the table must be at least IX-locked. However, when an index is being created, an IS-lock on the table is sufficient. row_merge_lock_table(): Add the parameter enum lock_mode mode, which must be LOCK_X or LOCK_S. row_merge_drop_table(): Assert that n_mysql_handles_opened == 0. Unconditionally drop the table. ha_innobase::add_index(): Acquire an X or S lock on the table, as appropriate. After acquiring an X lock, assert that n_mysql_handles_opened == 1. Remove the comments about dropping tables in the background. ha_innobase::final_drop_index(): Acquire an X lock on the table. dict_table_t: Remove version_number, to_be_dropped, and prebuilts. ins_node_t: Remove table_version_number. enum lock_mode: Move the definition from lock0lock.h to lock0types.h. ROW_PREBUILT_OBSOLETE, row_update_prebuilt(), row_prebuilt_table_obsolete(): Remove. row_prebuilt_t: Remove the declaration from row0types.h. row_drop_table_for_mysql_no_commit(): Always print a warning if a table was added to the background drop queue.
28 lines
725 B
C
28 lines
725 B
C
/******************************************************
|
|
The transaction lock system global types
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
Created 5/7/1996 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef lock0types_h
|
|
#define lock0types_h
|
|
|
|
#define lock_t ib_lock_t
|
|
typedef struct lock_struct lock_t;
|
|
typedef struct lock_sys_struct lock_sys_t;
|
|
|
|
/* Basic lock modes */
|
|
enum lock_mode {
|
|
LOCK_IS = 0, /* intention shared */
|
|
LOCK_IX, /* intention exclusive */
|
|
LOCK_S, /* shared */
|
|
LOCK_X, /* exclusive */
|
|
LOCK_AUTO_INC, /* locks the auto-inc counter of a table
|
|
in an exclusive mode */
|
|
LOCK_NONE, /* this is used elsewhere to note consistent read */
|
|
LOCK_NUM = LOCK_NONE/* number of lock modes */
|
|
};
|
|
|
|
#endif
|