mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Merge 10.4 into 10.5
This commit is contained in:
@@ -402,6 +402,20 @@ Opened_table_definitions 5
|
|||||||
Opened_tables 5
|
Opened_tables 5
|
||||||
drop function foo;
|
drop function foo;
|
||||||
drop table t2, t1;
|
drop table t2, t1;
|
||||||
|
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk)) ENGINE=InnoDB;
|
||||||
|
XA START 'xid';
|
||||||
|
INSERT INTO t1 VALUES (1,2);
|
||||||
|
CREATE TABLE x AS SELECT * FROM t1;
|
||||||
|
ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
|
||||||
|
connect con1,localhost,root,,test;
|
||||||
|
SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
|
||||||
|
ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
disconnect con1;
|
||||||
|
connection default;
|
||||||
|
XA END 'xid';
|
||||||
|
XA ROLLBACK 'xid';
|
||||||
|
DROP TABLE t1;
|
||||||
# Start of 10.2 tests
|
# Start of 10.2 tests
|
||||||
#
|
#
|
||||||
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
|
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
|
||||||
|
@@ -407,6 +407,20 @@ show status like '%opened_tab%';
|
|||||||
drop function foo;
|
drop function foo;
|
||||||
drop table t2, t1;
|
drop table t2, t1;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk)) ENGINE=InnoDB;
|
||||||
|
XA START 'xid';
|
||||||
|
INSERT INTO t1 VALUES (1,2);
|
||||||
|
--error ER_XAER_RMFAIL
|
||||||
|
CREATE TABLE x AS SELECT * FROM t1;
|
||||||
|
--connect (con1,localhost,root,,test)
|
||||||
|
SET foreign_key_checks= OFF, innodb_lock_wait_timeout= 1;
|
||||||
|
--error ER_LOCK_WAIT_TIMEOUT
|
||||||
|
ALTER TABLE t1 ADD FOREIGN KEY f (a) REFERENCES t1 (pk), LOCK=EXCLUSIVE;# Cleanup
|
||||||
|
--disconnect con1
|
||||||
|
--connection default
|
||||||
|
XA END 'xid';
|
||||||
|
XA ROLLBACK 'xid';
|
||||||
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
# End of 10.1 tests
|
# End of 10.1 tests
|
||||||
#
|
#
|
||||||
|
@@ -198,8 +198,6 @@ synchronized defragmentation. */
|
|||||||
os_event_t
|
os_event_t
|
||||||
btr_defragment_add_index(
|
btr_defragment_add_index(
|
||||||
dict_index_t* index, /*!< index to be added */
|
dict_index_t* index, /*!< index to be added */
|
||||||
bool async, /*!< whether this is an async
|
|
||||||
defragmentation */
|
|
||||||
dberr_t* err) /*!< out: error code */
|
dberr_t* err) /*!< out: error code */
|
||||||
{
|
{
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
@@ -228,10 +226,7 @@ btr_defragment_add_index(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
btr_pcur_t* pcur = btr_pcur_create_for_mysql();
|
btr_pcur_t* pcur = btr_pcur_create_for_mysql();
|
||||||
os_event_t event = NULL;
|
os_event_t event = os_event_create(0);
|
||||||
if (!async) {
|
|
||||||
event = os_event_create(0);
|
|
||||||
}
|
|
||||||
btr_pcur_open_at_index_side(true, index, BTR_SEARCH_LEAF, pcur,
|
btr_pcur_open_at_index_side(true, index, BTR_SEARCH_LEAF, pcur,
|
||||||
true, 0, &mtr);
|
true, 0, &mtr);
|
||||||
btr_pcur_move_to_next(pcur, &mtr);
|
btr_pcur_move_to_next(pcur, &mtr);
|
||||||
|
@@ -286,7 +286,6 @@ fts_cache_destroy(fts_cache_t* cache)
|
|||||||
{
|
{
|
||||||
rw_lock_free(&cache->lock);
|
rw_lock_free(&cache->lock);
|
||||||
rw_lock_free(&cache->init_lock);
|
rw_lock_free(&cache->init_lock);
|
||||||
mutex_free(&cache->optimize_lock);
|
|
||||||
mutex_free(&cache->deleted_lock);
|
mutex_free(&cache->deleted_lock);
|
||||||
mutex_free(&cache->doc_id_lock);
|
mutex_free(&cache->doc_id_lock);
|
||||||
os_event_destroy(cache->sync->event);
|
os_event_destroy(cache->sync->event);
|
||||||
@@ -622,8 +621,6 @@ fts_cache_create(
|
|||||||
|
|
||||||
mutex_create(LATCH_ID_FTS_DELETE, &cache->deleted_lock);
|
mutex_create(LATCH_ID_FTS_DELETE, &cache->deleted_lock);
|
||||||
|
|
||||||
mutex_create(LATCH_ID_FTS_OPTIMIZE, &cache->optimize_lock);
|
|
||||||
|
|
||||||
mutex_create(LATCH_ID_FTS_DOC_ID, &cache->doc_id_lock);
|
mutex_create(LATCH_ID_FTS_DOC_ID, &cache->doc_id_lock);
|
||||||
|
|
||||||
/* This is the heap used to create the cache itself. */
|
/* This is the heap used to create the cache itself. */
|
||||||
|
@@ -2622,9 +2622,13 @@ fts_optimize_remove_table(
|
|||||||
|
|
||||||
os_event_destroy(event);
|
os_event_destroy(event);
|
||||||
|
|
||||||
ut_d(mutex_enter(&fts_optimize_wq->mutex));
|
#ifdef UNIV_DEBUG
|
||||||
ut_ad(!table->fts->in_queue);
|
if (!fts_opt_start_shutdown) {
|
||||||
ut_d(mutex_exit(&fts_optimize_wq->mutex));
|
mutex_enter(&fts_optimize_wq->mutex);
|
||||||
|
ut_ad(!table->fts->in_queue);
|
||||||
|
mutex_exit(&fts_optimize_wq->mutex);
|
||||||
|
}
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Send sync fts cache for the table.
|
/** Send sync fts cache for the table.
|
||||||
|
@@ -509,7 +509,6 @@ performance schema instrumented if "UNIV_PFS_MUTEX"
|
|||||||
is defined */
|
is defined */
|
||||||
static PSI_mutex_info all_innodb_mutexes[] = {
|
static PSI_mutex_info all_innodb_mutexes[] = {
|
||||||
PSI_KEY(buf_pool_mutex),
|
PSI_KEY(buf_pool_mutex),
|
||||||
PSI_KEY(cache_last_read_mutex),
|
|
||||||
PSI_KEY(dict_foreign_err_mutex),
|
PSI_KEY(dict_foreign_err_mutex),
|
||||||
PSI_KEY(dict_sys_mutex),
|
PSI_KEY(dict_sys_mutex),
|
||||||
PSI_KEY(recalc_pool_mutex),
|
PSI_KEY(recalc_pool_mutex),
|
||||||
@@ -517,7 +516,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
|
|||||||
PSI_KEY(flush_list_mutex),
|
PSI_KEY(flush_list_mutex),
|
||||||
PSI_KEY(fts_bg_threads_mutex),
|
PSI_KEY(fts_bg_threads_mutex),
|
||||||
PSI_KEY(fts_delete_mutex),
|
PSI_KEY(fts_delete_mutex),
|
||||||
PSI_KEY(fts_optimize_mutex),
|
|
||||||
PSI_KEY(fts_doc_id_mutex),
|
PSI_KEY(fts_doc_id_mutex),
|
||||||
PSI_KEY(log_flush_order_mutex),
|
PSI_KEY(log_flush_order_mutex),
|
||||||
PSI_KEY(ibuf_bitmap_mutex),
|
PSI_KEY(ibuf_bitmap_mutex),
|
||||||
@@ -14520,25 +14518,14 @@ ha_innobase::analyze(THD*, HA_CHECK_OPT*)
|
|||||||
/*****************************************************************//**
|
/*****************************************************************//**
|
||||||
Defragment table.
|
Defragment table.
|
||||||
@return error number */
|
@return error number */
|
||||||
UNIV_INTERN
|
inline int ha_innobase::defragment_table(const char *name)
|
||||||
int
|
|
||||||
ha_innobase::defragment_table(
|
|
||||||
/*==========================*/
|
|
||||||
const char* name, /*!< in: table name */
|
|
||||||
const char* index_name, /*!< in: index name */
|
|
||||||
bool async) /*!< in: whether to wait until finish */
|
|
||||||
{
|
{
|
||||||
char norm_name[FN_REFLEN];
|
char norm_name[FN_REFLEN];
|
||||||
dict_table_t* table = NULL;
|
dict_table_t* table = NULL;
|
||||||
dict_index_t* index = NULL;
|
dict_index_t* index = NULL;
|
||||||
ibool one_index = (index_name != 0);
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
dberr_t err = DB_SUCCESS;
|
dberr_t err = DB_SUCCESS;
|
||||||
|
|
||||||
if (!srv_defragment) {
|
|
||||||
return ER_FEATURE_DISABLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
normalize_table_name(norm_name, name);
|
normalize_table_name(norm_name, name);
|
||||||
|
|
||||||
table = dict_table_open_on_name(norm_name, FALSE,
|
table = dict_table_open_on_name(norm_name, FALSE,
|
||||||
@@ -14566,10 +14553,6 @@ ha_innobase::defragment_table(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (one_index && strcasecmp(index_name, index->name) != 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (btr_defragment_find_index(index)) {
|
if (btr_defragment_find_index(index)) {
|
||||||
// We borrow this error code. When the same index is
|
// We borrow this error code. When the same index is
|
||||||
// already in the defragmentation queue, issue another
|
// already in the defragmentation queue, issue another
|
||||||
@@ -14585,7 +14568,7 @@ ha_innobase::defragment_table(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_event_t event = btr_defragment_add_index(index, async, &err);
|
os_event_t event = btr_defragment_add_index(index, &err);
|
||||||
|
|
||||||
if (err != DB_SUCCESS) {
|
if (err != DB_SUCCESS) {
|
||||||
push_warning_printf(
|
push_warning_printf(
|
||||||
@@ -14601,7 +14584,7 @@ ha_innobase::defragment_table(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!async && event) {
|
if (event) {
|
||||||
while(os_event_wait_time(event, 1000000)) {
|
while(os_event_wait_time(event, 1000000)) {
|
||||||
if (thd_killed(current_thd)) {
|
if (thd_killed(current_thd)) {
|
||||||
btr_defragment_remove_index(index);
|
btr_defragment_remove_index(index);
|
||||||
@@ -14615,19 +14598,9 @@ ha_innobase::defragment_table(
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (one_index) {
|
|
||||||
one_index = FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dict_table_close(table, FALSE, FALSE);
|
dict_table_close(table, FALSE, FALSE);
|
||||||
|
|
||||||
if (ret == 0 && one_index) {
|
|
||||||
ret = ER_NO_SUCH_INDEX;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14653,8 +14626,7 @@ ha_innobase::optimize(
|
|||||||
bool try_alter = true;
|
bool try_alter = true;
|
||||||
|
|
||||||
if (!m_prebuilt->table->is_temporary() && srv_defragment) {
|
if (!m_prebuilt->table->is_temporary() && srv_defragment) {
|
||||||
int err= defragment_table(
|
int err = defragment_table(m_prebuilt->table->name.m_name);
|
||||||
m_prebuilt->table->name.m_name, NULL, false);
|
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
try_alter = false;
|
try_alter = false;
|
||||||
|
@@ -212,8 +212,7 @@ public:
|
|||||||
int delete_table(const char *name) override;
|
int delete_table(const char *name) override;
|
||||||
|
|
||||||
int rename_table(const char* from, const char* to) override;
|
int rename_table(const char* from, const char* to) override;
|
||||||
int defragment_table(const char* name, const char* index_name,
|
inline int defragment_table(const char* name);
|
||||||
bool async);
|
|
||||||
int check(THD* thd, HA_CHECK_OPT* check_opt) override;
|
int check(THD* thd, HA_CHECK_OPT* check_opt) override;
|
||||||
char* update_table_comment(const char* comment) override;
|
char* update_table_comment(const char* comment) override;
|
||||||
|
|
||||||
|
@@ -7167,6 +7167,12 @@ err_exit:
|
|||||||
}
|
}
|
||||||
trx_commit_for_mysql(ctx->prebuilt->trx);
|
trx_commit_for_mysql(ctx->prebuilt->trx);
|
||||||
|
|
||||||
|
for (uint i = 0; i < ctx->num_to_add_fk; i++) {
|
||||||
|
if (ctx->add_fk[i]) {
|
||||||
|
dict_foreign_free(ctx->add_fk[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete ctx;
|
delete ctx;
|
||||||
ha_alter_info->handler_ctx = NULL;
|
ha_alter_info->handler_ctx = NULL;
|
||||||
|
|
||||||
|
@@ -49,8 +49,6 @@ is a synchronized defragmentation. */
|
|||||||
os_event_t
|
os_event_t
|
||||||
btr_defragment_add_index(
|
btr_defragment_add_index(
|
||||||
dict_index_t* index, /*!< index to be added */
|
dict_index_t* index, /*!< index to be added */
|
||||||
bool async, /*!< whether this is an async
|
|
||||||
defragmentation */
|
|
||||||
dberr_t* err); /*!< out: error code */
|
dberr_t* err); /*!< out: error code */
|
||||||
/******************************************************************//**
|
/******************************************************************//**
|
||||||
When table is dropped, this function is called to mark a table as removed in
|
When table is dropped, this function is called to mark a table as removed in
|
||||||
|
@@ -131,8 +131,6 @@ struct fts_cache_t {
|
|||||||
intialization, it has different
|
intialization, it has different
|
||||||
SYNC level as above cache lock */
|
SYNC level as above cache lock */
|
||||||
|
|
||||||
ib_mutex_t optimize_lock; /*!< Lock for OPTIMIZE */
|
|
||||||
|
|
||||||
ib_mutex_t deleted_lock; /*!< Lock covering deleted_doc_ids */
|
ib_mutex_t deleted_lock; /*!< Lock covering deleted_doc_ids */
|
||||||
|
|
||||||
ib_mutex_t doc_id_lock; /*!< Lock covering Doc ID */
|
ib_mutex_t doc_id_lock; /*!< Lock covering Doc ID */
|
||||||
|
@@ -578,12 +578,6 @@ struct rw_lock_t :
|
|||||||
/** number of granted SX locks. */
|
/** number of granted SX locks. */
|
||||||
volatile ulint sx_recursive;
|
volatile ulint sx_recursive;
|
||||||
|
|
||||||
/** This is TRUE if the writer field is RW_LOCK_X_WAIT; this field
|
|
||||||
is located far from the memory update hotspot fields which are at
|
|
||||||
the start of this struct, thus we can peek this field without
|
|
||||||
causing much memory bus traffic */
|
|
||||||
bool writer_is_wait_ex;
|
|
||||||
|
|
||||||
/** The value is typically set to thread id of a writer thread making
|
/** The value is typically set to thread id of a writer thread making
|
||||||
normal rw_locks recursive. In case of asynchronous IO, when a non-zero
|
normal rw_locks recursive. In case of asynchronous IO, when a non-zero
|
||||||
value of 'pass' is passed then we keep the lock non-recursive.
|
value of 'pass' is passed then we keep the lock non-recursive.
|
||||||
|
@@ -51,14 +51,12 @@ instrumentation due to their large number of instances. */
|
|||||||
#ifdef UNIV_PFS_MUTEX
|
#ifdef UNIV_PFS_MUTEX
|
||||||
/* Key defines to register InnoDB mutexes with performance schema */
|
/* Key defines to register InnoDB mutexes with performance schema */
|
||||||
extern mysql_pfs_key_t buf_pool_mutex_key;
|
extern mysql_pfs_key_t buf_pool_mutex_key;
|
||||||
extern mysql_pfs_key_t cache_last_read_mutex_key;
|
|
||||||
extern mysql_pfs_key_t dict_foreign_err_mutex_key;
|
extern mysql_pfs_key_t dict_foreign_err_mutex_key;
|
||||||
extern mysql_pfs_key_t dict_sys_mutex_key;
|
extern mysql_pfs_key_t dict_sys_mutex_key;
|
||||||
extern mysql_pfs_key_t fil_system_mutex_key;
|
extern mysql_pfs_key_t fil_system_mutex_key;
|
||||||
extern mysql_pfs_key_t flush_list_mutex_key;
|
extern mysql_pfs_key_t flush_list_mutex_key;
|
||||||
extern mysql_pfs_key_t fts_bg_threads_mutex_key;
|
extern mysql_pfs_key_t fts_bg_threads_mutex_key;
|
||||||
extern mysql_pfs_key_t fts_delete_mutex_key;
|
extern mysql_pfs_key_t fts_delete_mutex_key;
|
||||||
extern mysql_pfs_key_t fts_optimize_mutex_key;
|
|
||||||
extern mysql_pfs_key_t fts_doc_id_mutex_key;
|
extern mysql_pfs_key_t fts_doc_id_mutex_key;
|
||||||
extern mysql_pfs_key_t fts_pll_tokenize_mutex_key;
|
extern mysql_pfs_key_t fts_pll_tokenize_mutex_key;
|
||||||
extern mysql_pfs_key_t ibuf_bitmap_mutex_key;
|
extern mysql_pfs_key_t ibuf_bitmap_mutex_key;
|
||||||
|
@@ -256,8 +256,6 @@ enum latch_level_t {
|
|||||||
|
|
||||||
SYNC_DICT_OPERATION,
|
SYNC_DICT_OPERATION,
|
||||||
|
|
||||||
SYNC_TRX_I_S_LAST_READ,
|
|
||||||
|
|
||||||
SYNC_TRX_I_S_RWLOCK,
|
SYNC_TRX_I_S_RWLOCK,
|
||||||
|
|
||||||
SYNC_RECV_WRITER,
|
SYNC_RECV_WRITER,
|
||||||
@@ -280,7 +278,6 @@ up its meta-data. See sync0debug.c. */
|
|||||||
enum latch_id_t {
|
enum latch_id_t {
|
||||||
LATCH_ID_NONE = 0,
|
LATCH_ID_NONE = 0,
|
||||||
LATCH_ID_BUF_POOL,
|
LATCH_ID_BUF_POOL,
|
||||||
LATCH_ID_CACHE_LAST_READ,
|
|
||||||
LATCH_ID_DICT_FOREIGN_ERR,
|
LATCH_ID_DICT_FOREIGN_ERR,
|
||||||
LATCH_ID_DICT_SYS,
|
LATCH_ID_DICT_SYS,
|
||||||
LATCH_ID_FILE_FORMAT_MAX,
|
LATCH_ID_FILE_FORMAT_MAX,
|
||||||
@@ -288,7 +285,6 @@ enum latch_id_t {
|
|||||||
LATCH_ID_FLUSH_LIST,
|
LATCH_ID_FLUSH_LIST,
|
||||||
LATCH_ID_FTS_BG_THREADS,
|
LATCH_ID_FTS_BG_THREADS,
|
||||||
LATCH_ID_FTS_DELETE,
|
LATCH_ID_FTS_DELETE,
|
||||||
LATCH_ID_FTS_OPTIMIZE,
|
|
||||||
LATCH_ID_FTS_DOC_ID,
|
LATCH_ID_FTS_DOC_ID,
|
||||||
LATCH_ID_FTS_PLL_TOKENIZE,
|
LATCH_ID_FTS_PLL_TOKENIZE,
|
||||||
LATCH_ID_IBUF_BITMAP,
|
LATCH_ID_IBUF_BITMAP,
|
||||||
|
@@ -506,7 +506,6 @@ LatchDebug::LatchDebug()
|
|||||||
LEVEL_MAP_INSERT(SYNC_DICT);
|
LEVEL_MAP_INSERT(SYNC_DICT);
|
||||||
LEVEL_MAP_INSERT(SYNC_FTS_CACHE);
|
LEVEL_MAP_INSERT(SYNC_FTS_CACHE);
|
||||||
LEVEL_MAP_INSERT(SYNC_DICT_OPERATION);
|
LEVEL_MAP_INSERT(SYNC_DICT_OPERATION);
|
||||||
LEVEL_MAP_INSERT(SYNC_TRX_I_S_LAST_READ);
|
|
||||||
LEVEL_MAP_INSERT(SYNC_TRX_I_S_RWLOCK);
|
LEVEL_MAP_INSERT(SYNC_TRX_I_S_RWLOCK);
|
||||||
LEVEL_MAP_INSERT(SYNC_RECV_WRITER);
|
LEVEL_MAP_INSERT(SYNC_RECV_WRITER);
|
||||||
LEVEL_MAP_INSERT(SYNC_LEVEL_VARYING);
|
LEVEL_MAP_INSERT(SYNC_LEVEL_VARYING);
|
||||||
@@ -764,7 +763,6 @@ LatchDebug::check_order(
|
|||||||
case SYNC_DICT_OPERATION:
|
case SYNC_DICT_OPERATION:
|
||||||
case SYNC_DICT_HEADER:
|
case SYNC_DICT_HEADER:
|
||||||
case SYNC_TRX_I_S_RWLOCK:
|
case SYNC_TRX_I_S_RWLOCK:
|
||||||
case SYNC_TRX_I_S_LAST_READ:
|
|
||||||
case SYNC_IBUF_MUTEX:
|
case SYNC_IBUF_MUTEX:
|
||||||
case SYNC_INDEX_ONLINE_LOG:
|
case SYNC_INDEX_ONLINE_LOG:
|
||||||
case SYNC_STATS_AUTO_RECALC:
|
case SYNC_STATS_AUTO_RECALC:
|
||||||
@@ -1253,9 +1251,6 @@ sync_latch_meta_init()
|
|||||||
|
|
||||||
LATCH_ADD_MUTEX(BUF_POOL, SYNC_BUF_POOL, buf_pool_mutex_key);
|
LATCH_ADD_MUTEX(BUF_POOL, SYNC_BUF_POOL, buf_pool_mutex_key);
|
||||||
|
|
||||||
LATCH_ADD_MUTEX(CACHE_LAST_READ, SYNC_TRX_I_S_LAST_READ,
|
|
||||||
cache_last_read_mutex_key);
|
|
||||||
|
|
||||||
LATCH_ADD_MUTEX(DICT_FOREIGN_ERR, SYNC_NO_ORDER_CHECK,
|
LATCH_ADD_MUTEX(DICT_FOREIGN_ERR, SYNC_NO_ORDER_CHECK,
|
||||||
dict_foreign_err_mutex_key);
|
dict_foreign_err_mutex_key);
|
||||||
|
|
||||||
@@ -1270,9 +1265,6 @@ sync_latch_meta_init()
|
|||||||
|
|
||||||
LATCH_ADD_MUTEX(FTS_DELETE, SYNC_FTS_OPTIMIZE, fts_delete_mutex_key);
|
LATCH_ADD_MUTEX(FTS_DELETE, SYNC_FTS_OPTIMIZE, fts_delete_mutex_key);
|
||||||
|
|
||||||
LATCH_ADD_MUTEX(FTS_OPTIMIZE, SYNC_FTS_OPTIMIZE,
|
|
||||||
fts_optimize_mutex_key);
|
|
||||||
|
|
||||||
LATCH_ADD_MUTEX(FTS_DOC_ID, SYNC_FTS_OPTIMIZE, fts_doc_id_mutex_key);
|
LATCH_ADD_MUTEX(FTS_DOC_ID, SYNC_FTS_OPTIMIZE, fts_doc_id_mutex_key);
|
||||||
|
|
||||||
LATCH_ADD_MUTEX(FTS_PLL_TOKENIZE, SYNC_FTS_TOKENIZE,
|
LATCH_ADD_MUTEX(FTS_PLL_TOKENIZE, SYNC_FTS_TOKENIZE,
|
||||||
|
@@ -37,14 +37,12 @@ Created 9/5/1995 Heikki Tuuri
|
|||||||
|
|
||||||
#ifdef UNIV_PFS_MUTEX
|
#ifdef UNIV_PFS_MUTEX
|
||||||
mysql_pfs_key_t buf_pool_mutex_key;
|
mysql_pfs_key_t buf_pool_mutex_key;
|
||||||
mysql_pfs_key_t cache_last_read_mutex_key;
|
|
||||||
mysql_pfs_key_t dict_foreign_err_mutex_key;
|
mysql_pfs_key_t dict_foreign_err_mutex_key;
|
||||||
mysql_pfs_key_t dict_sys_mutex_key;
|
mysql_pfs_key_t dict_sys_mutex_key;
|
||||||
mysql_pfs_key_t fil_system_mutex_key;
|
mysql_pfs_key_t fil_system_mutex_key;
|
||||||
mysql_pfs_key_t flush_list_mutex_key;
|
mysql_pfs_key_t flush_list_mutex_key;
|
||||||
mysql_pfs_key_t fts_bg_threads_mutex_key;
|
mysql_pfs_key_t fts_bg_threads_mutex_key;
|
||||||
mysql_pfs_key_t fts_delete_mutex_key;
|
mysql_pfs_key_t fts_delete_mutex_key;
|
||||||
mysql_pfs_key_t fts_optimize_mutex_key;
|
|
||||||
mysql_pfs_key_t fts_doc_id_mutex_key;
|
mysql_pfs_key_t fts_doc_id_mutex_key;
|
||||||
mysql_pfs_key_t fts_pll_tokenize_mutex_key;
|
mysql_pfs_key_t fts_pll_tokenize_mutex_key;
|
||||||
mysql_pfs_key_t ibuf_bitmap_mutex_key;
|
mysql_pfs_key_t ibuf_bitmap_mutex_key;
|
||||||
|
@@ -141,12 +141,9 @@ struct i_s_table_cache_t {
|
|||||||
struct trx_i_s_cache_t {
|
struct trx_i_s_cache_t {
|
||||||
rw_lock_t rw_lock; /*!< read-write lock protecting
|
rw_lock_t rw_lock; /*!< read-write lock protecting
|
||||||
the rest of this structure */
|
the rest of this structure */
|
||||||
ulonglong last_read; /*!< last time the cache was read;
|
Atomic_relaxed<ulonglong> last_read;
|
||||||
|
/*!< last time the cache was read;
|
||||||
measured in nanoseconds */
|
measured in nanoseconds */
|
||||||
ib_mutex_t last_read_mutex;/*!< mutex protecting the
|
|
||||||
last_read member - it is updated
|
|
||||||
inside a shared lock of the
|
|
||||||
rw_lock member */
|
|
||||||
i_s_table_cache_t innodb_trx; /*!< innodb_trx table */
|
i_s_table_cache_t innodb_trx; /*!< innodb_trx table */
|
||||||
i_s_table_cache_t innodb_locks; /*!< innodb_locks table */
|
i_s_table_cache_t innodb_locks; /*!< innodb_locks table */
|
||||||
i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */
|
i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */
|
||||||
@@ -1136,8 +1133,7 @@ Checks if the cache can safely be updated.
|
|||||||
@return whether the cache can be updated */
|
@return whether the cache can be updated */
|
||||||
static bool can_cache_be_updated(trx_i_s_cache_t* cache)
|
static bool can_cache_be_updated(trx_i_s_cache_t* cache)
|
||||||
{
|
{
|
||||||
/* Here we read cache->last_read without acquiring its mutex
|
/* cache->last_read is only updated when a shared rw lock on the
|
||||||
because last_read is only updated when a shared rw lock on the
|
|
||||||
whole cache is being held (see trx_i_s_cache_end_read()) and
|
whole cache is being held (see trx_i_s_cache_end_read()) and
|
||||||
we are currently holding an exclusive rw lock on the cache.
|
we are currently holding an exclusive rw lock on the cache.
|
||||||
So it is not possible for last_read to be updated while we are
|
So it is not possible for last_read to be updated while we are
|
||||||
@@ -1269,8 +1265,6 @@ trx_i_s_cache_init(
|
|||||||
release lock mutex
|
release lock mutex
|
||||||
release trx_i_s_cache_t::rw_lock
|
release trx_i_s_cache_t::rw_lock
|
||||||
acquire trx_i_s_cache_t::rw_lock, S
|
acquire trx_i_s_cache_t::rw_lock, S
|
||||||
acquire trx_i_s_cache_t::last_read_mutex
|
|
||||||
release trx_i_s_cache_t::last_read_mutex
|
|
||||||
release trx_i_s_cache_t::rw_lock */
|
release trx_i_s_cache_t::rw_lock */
|
||||||
|
|
||||||
rw_lock_create(trx_i_s_cache_lock_key, &cache->rw_lock,
|
rw_lock_create(trx_i_s_cache_lock_key, &cache->rw_lock,
|
||||||
@@ -1278,8 +1272,6 @@ trx_i_s_cache_init(
|
|||||||
|
|
||||||
cache->last_read = 0;
|
cache->last_read = 0;
|
||||||
|
|
||||||
mutex_create(LATCH_ID_CACHE_LAST_READ, &cache->last_read_mutex);
|
|
||||||
|
|
||||||
table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t));
|
table_cache_init(&cache->innodb_trx, sizeof(i_s_trx_row_t));
|
||||||
table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t));
|
table_cache_init(&cache->innodb_locks, sizeof(i_s_locks_row_t));
|
||||||
table_cache_init(&cache->innodb_lock_waits,
|
table_cache_init(&cache->innodb_lock_waits,
|
||||||
@@ -1303,7 +1295,6 @@ trx_i_s_cache_free(
|
|||||||
trx_i_s_cache_t* cache) /*!< in, own: cache to free */
|
trx_i_s_cache_t* cache) /*!< in, own: cache to free */
|
||||||
{
|
{
|
||||||
rw_lock_free(&cache->rw_lock);
|
rw_lock_free(&cache->rw_lock);
|
||||||
mutex_free(&cache->last_read_mutex);
|
|
||||||
|
|
||||||
cache->locks_hash.free();
|
cache->locks_hash.free();
|
||||||
ha_storage_free(cache->storage);
|
ha_storage_free(cache->storage);
|
||||||
@@ -1329,14 +1320,7 @@ trx_i_s_cache_end_read(
|
|||||||
/*===================*/
|
/*===================*/
|
||||||
trx_i_s_cache_t* cache) /*!< in: cache */
|
trx_i_s_cache_t* cache) /*!< in: cache */
|
||||||
{
|
{
|
||||||
ut_ad(rw_lock_own(&cache->rw_lock, RW_LOCK_S));
|
cache->last_read = my_interval_timer();
|
||||||
|
|
||||||
/* update cache last read time */
|
|
||||||
const ulonglong now = my_interval_timer();
|
|
||||||
mutex_enter(&cache->last_read_mutex);
|
|
||||||
cache->last_read = now;
|
|
||||||
mutex_exit(&cache->last_read_mutex);
|
|
||||||
|
|
||||||
rw_lock_s_unlock(&cache->rw_lock);
|
rw_lock_s_unlock(&cache->rw_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user