summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/innobase/dict/dict0crea.cc4
-rw-r--r--storage/innobase/dict/dict0defrag_bg.cc10
-rw-r--r--storage/innobase/dict/dict0dict.cc32
-rw-r--r--storage/innobase/dict/dict0load.cc10
-rw-r--r--storage/innobase/dict/dict0stats.cc42
-rw-r--r--storage/innobase/fil/fil0fil.cc2
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/handler/handler0alter.cc16
-rw-r--r--storage/innobase/handler/i_s.cc34
-rw-r--r--storage/innobase/include/dict0dict.h2
-rw-r--r--storage/innobase/include/sync0rw.h22
-rw-r--r--storage/innobase/row/row0import.cc8
-rw-r--r--storage/innobase/row/row0ins.cc2
-rw-r--r--storage/innobase/row/row0log.cc4
-rw-r--r--storage/innobase/row/row0merge.cc6
-rw-r--r--storage/innobase/row/row0mysql.cc14
-rw-r--r--storage/innobase/row/row0purge.cc14
-rw-r--r--storage/innobase/row/row0trunc.cc2
-rw-r--r--storage/innobase/row/row0umod.cc4
-rw-r--r--storage/innobase/srv/srv0srv.cc4
-rw-r--r--storage/innobase/sync/sync0rw.cc12
-rw-r--r--storage/innobase/trx/trx0i_s.cc30
-rw-r--r--storage/innobase/trx/trx0purge.cc4
23 files changed, 115 insertions, 165 deletions
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 342bafab92c..86038a3710a 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2471,7 +2471,7 @@ dict_delete_tablespace_and_datafiles(
{
dberr_t err = DB_SUCCESS;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(srv_sys_tablespaces_open);
diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc
index 25175c7deb5..f1ea8ae30d2 100644
--- a/storage/innobase/dict/dict0defrag_bg.cc
+++ b/storage/innobase/dict/dict0defrag_bg.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2016, 2018, MariaDB Corporation.
+Copyright (c) 2016, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -244,7 +244,7 @@ dict_stats_save_defrag_summary(
return DB_SUCCESS;
}
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
ret = dict_stats_save_index_stat(index, now, "n_pages_freed",
@@ -255,7 +255,7 @@ dict_stats_save_defrag_summary(
NULL);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
return (ret);
}
@@ -295,7 +295,7 @@ dict_stats_save_defrag_stats(
return DB_SUCCESS;
}
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
ret = dict_stats_save_index_stat(index, now, "n_page_split",
@@ -328,7 +328,7 @@ dict_stats_save_defrag_stats(
end:
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
return (ret);
}
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 0919b212c5b..51d3db39e16 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -95,7 +95,7 @@ in S-mode; we cannot trust that MySQL protects implicit or background
operations a table drop since MySQL does not know of them; therefore
we need this; NOTE: a transaction which reserves this must keep book
on the mode in trx_t::dict_operation_lock_mode */
-rw_lock_t* dict_operation_lock;
+rw_lock_t dict_operation_lock;
/** Percentage of compression failures that are allowed in a single
round */
@@ -554,7 +554,7 @@ dict_table_close_and_drop(
dberr_t err = DB_SUCCESS;
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(trx->dict_operation != TRX_DICT_OP_NONE);
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
@@ -1081,9 +1081,6 @@ void
dict_init(void)
/*===========*/
{
- dict_operation_lock = static_cast<rw_lock_t*>(
- ut_zalloc_nokey(sizeof(*dict_operation_lock)));
-
dict_sys = static_cast<dict_sys_t*>(ut_zalloc_nokey(sizeof(*dict_sys)));
UT_LIST_INIT(dict_sys->table_LRU, &dict_table_t::table_LRU);
@@ -1100,7 +1097,7 @@ dict_init(void)
/ (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE));
rw_lock_create(dict_operation_lock_key,
- dict_operation_lock, SYNC_DICT_OPERATION);
+ &dict_operation_lock, SYNC_DICT_OPERATION);
if (!srv_read_only_mode) {
dict_foreign_err_file = os_file_create_tmpfile(NULL);
@@ -1349,7 +1346,7 @@ dict_table_can_be_evicted(
dict_table_t* table) /*!< in: table to test */
{
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_a(table->can_be_evicted);
ut_a(table->foreign_set.empty());
@@ -1417,7 +1414,7 @@ dict_make_room_in_cache(
ut_a(pct_check > 0);
ut_a(pct_check <= 100);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(dict_lru_validate());
i = len = UT_LIST_GET_LEN(dict_sys->table_LRU);
@@ -2076,7 +2073,7 @@ dict_table_remove_from_cache_low(
trx_t* trx = trx_allocate_for_background();
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
/* Mimic row_mysql_lock_data_dictionary(). */
trx->dict_operation_lock_mode = RW_X_LATCH;
@@ -6068,7 +6065,7 @@ dict_index_set_merge_threshold(
ut_ad(!dict_table_is_comp(dict_sys->sys_tables));
ut_ad(!dict_table_is_comp(dict_sys->sys_indexes));
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&(dict_sys->mutex));
heap = mem_heap_create(sizeof(dtuple_t) + 2 * (sizeof(dfield_t)
@@ -6118,7 +6115,7 @@ dict_index_set_merge_threshold(
mem_heap_free(heap);
mutex_exit(&(dict_sys->mutex));
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
}
#ifdef UNIV_DEBUG
@@ -6713,10 +6710,7 @@ dict_close(void)
mutex_free(&dict_sys->mutex);
- rw_lock_free(dict_operation_lock);
-
- ut_free(dict_operation_lock);
- dict_operation_lock = NULL;
+ rw_lock_free(&dict_operation_lock);
mutex_free(&dict_foreign_err_mutex);
@@ -7122,7 +7116,7 @@ dict_space_is_empty(
mtr_t mtr;
bool found = false;
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
@@ -7145,7 +7139,7 @@ dict_space_is_empty(
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
return(!found);
}
@@ -7163,7 +7157,7 @@ dict_space_get_id(
ulint name_len = strlen(name);
ulint id = ULINT_UNDEFINED;
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
@@ -7194,7 +7188,7 @@ dict_space_get_id(
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
return(id);
}
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index ca0ee95dbf3..ae5bbac9118 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -903,7 +903,7 @@ dict_update_filepath(
dberr_t err = DB_SUCCESS;
trx_t* trx;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
trx = trx_allocate_for_background();
@@ -971,7 +971,7 @@ dict_replace_tablespace_and_filepath(
DBUG_EXECUTE_IF("innodb_fail_to_update_tablespace_dict",
return(DB_INTERRUPTED););
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(filepath);
@@ -1371,7 +1371,7 @@ static ulint dict_check_sys_tables()
DBUG_ENTER("dict_check_sys_tables");
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
mtr_start(&mtr);
@@ -1516,7 +1516,7 @@ void dict_check_tablespaces_and_store_max_id()
DBUG_ENTER("dict_check_tablespaces_and_store_max_id");
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
/* Initialize the max space_id from sys header */
@@ -1535,7 +1535,7 @@ void dict_check_tablespaces_and_store_max_id()
fil_set_max_space_id_if_bigger(max_space_id);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
DBUG_VOID_RETURN;
}
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index 3f9e981f5f7..1df016d9301 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -283,7 +283,7 @@ dict_stats_exec_sql(
dberr_t err;
bool trx_started = false;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
if (!dict_stats_persistent_storage_check(true)) {
@@ -2311,7 +2311,7 @@ dict_stats_save_index_stat(
char table_utf8[MAX_TABLE_UTF8_LEN];
ut_ad(!trx || trx->internal || trx->in_mysql_trx_list);
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
dict_fs2utf8(index->table->name.m_name, db_utf8, sizeof(db_utf8),
@@ -2447,7 +2447,7 @@ dict_stats_save(
table_utf8, sizeof(table_utf8));
now = ut_time();
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
pinfo = pars_info_create();
@@ -2488,7 +2488,7 @@ dict_stats_save(
<< table->name << ": " << ut_strerr(ret);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
dict_stats_snapshot_free(table);
@@ -2595,7 +2595,7 @@ end:
trx_free_for_background(trx);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
dict_stats_snapshot_free(table);
@@ -3406,7 +3406,7 @@ dict_stats_drop_index(
pars_info_add_str_literal(pinfo, "index_name", iname);
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
ret = dict_stats_exec_sql(
@@ -3420,7 +3420,7 @@ dict_stats_drop_index(
"END;\n", NULL);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
if (ret == DB_STATS_DO_NOT_EXIST) {
ret = DB_SUCCESS;
@@ -3468,7 +3468,7 @@ dict_stats_delete_from_table_stats(
pars_info_t* pinfo;
dberr_t ret;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create();
@@ -3504,7 +3504,7 @@ dict_stats_delete_from_index_stats(
pars_info_t* pinfo;
dberr_t ret;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create();
@@ -3541,7 +3541,7 @@ dict_stats_drop_table(
char table_utf8[MAX_TABLE_UTF8_LEN];
dberr_t ret;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
/* skip tables that do not contain a database name
@@ -3617,7 +3617,7 @@ dict_stats_rename_table_in_table_stats(
pars_info_t* pinfo;
dberr_t ret;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create();
@@ -3661,7 +3661,7 @@ dict_stats_rename_table_in_index_stats(
pars_info_t* pinfo;
dberr_t ret;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create();
@@ -3705,7 +3705,7 @@ dict_stats_rename_table(
char new_table_utf8[MAX_TABLE_UTF8_LEN];
dberr_t ret;
- ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(!rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(!mutex_own(&dict_sys->mutex));
/* skip innodb_table_stats and innodb_index_stats themselves */
@@ -3723,7 +3723,7 @@ dict_stats_rename_table(
dict_fs2utf8(new_name, new_db_utf8, sizeof(new_db_utf8),
new_table_utf8, sizeof(new_table_utf8));
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
ulint n_attempts = 0;
@@ -3745,9 +3745,9 @@ dict_stats_rename_table(
if (ret != DB_SUCCESS) {
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
os_thread_sleep(200000 /* 0.2 sec */);
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
}
} while ((ret == DB_DEADLOCK
@@ -3777,7 +3777,7 @@ dict_stats_rename_table(
new_db_utf8, new_table_utf8,
old_db_utf8, old_table_utf8);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
return(ret);
}
/* else */
@@ -3801,9 +3801,9 @@ dict_stats_rename_table(
if (ret != DB_SUCCESS) {
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
os_thread_sleep(200000 /* 0.2 sec */);
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
}
} while ((ret == DB_DEADLOCK
@@ -3812,7 +3812,7 @@ dict_stats_rename_table(
&& n_attempts < 5);
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
if (ret != DB_SUCCESS) {
snprintf(errstr, errstr_sz,
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 39921c9a67c..595f9c3e729 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -3821,7 +3821,7 @@ fil_ibd_open(
ulint tablespaces_found = 0;
ulint valid_tablespaces_found = 0;
- ut_ad(!fix_dict || rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(!fix_dict || rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(!fix_dict || mutex_own(&dict_sys->mutex));
ut_ad(!fix_dict || !srv_read_only_mode);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index a5a6b274049..f55fa6c4fc5 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -21566,7 +21566,7 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
/* Purge thread acquires dict_operation_lock while
processing undo log record. Release the dict_operation_lock
before acquiring MDL on the table. */
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
return innodb_acquire_mdl(thd, table);
} else {
if (table->vc_templ->mysql_table_query_id
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index af41e517dc5..c0c002e3042 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -3440,7 +3440,7 @@ innobase_update_gis_column_type(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
info = pars_info_create();
@@ -4970,7 +4970,7 @@ op_ok:
#endif /* UNIV_DEBUG */
ut_ad(ctx->trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
DICT_TF2_FLAG_SET(ctx->new_table, DICT_TF2_FTS);
if (new_clustered) {
@@ -6157,8 +6157,8 @@ ha_innobase::inplace_alter_table(
DBUG_ASSERT(!srv_read_only_mode);
ut_ad(!sync_check_iterate(sync_check()));
- ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_X));
- ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_S));
+ ut_ad(!rw_lock_own_flagged(&dict_operation_lock,
+ RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
DEBUG_SYNC(m_user_thd, "innodb_inplace_alter_table_enter");
@@ -6369,7 +6369,7 @@ innobase_online_rebuild_log_free(
dict_index_t* clust_index = dict_table_get_first_index(table);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
rw_lock_x_lock(&clust_index->lock);
@@ -6643,7 +6643,7 @@ innobase_drop_foreign_try(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
/* Drop the constraint from the data dictionary. */
static const char sql[] =
@@ -6706,7 +6706,7 @@ innobase_rename_column_try(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
if (new_clustered) {
goto rename_foreign;
@@ -6988,7 +6988,7 @@ innobase_enlarge_column_try(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
if (is_v) {
v_col = dict_table_get_nth_v_col(user_table, nth_col);
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 9a15c44aa1f..1cc9857c42e 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -2890,20 +2890,17 @@ i_s_fts_deleted_generic_fill(
}
/* Prevent DDL to drop fts aux tables. */
- rw_lock_s_lock(dict_operation_lock);
+ rw_lock_s_lock(&dict_operation_lock);
user_table = dict_table_open_on_name(
fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
if (!user_table) {
- rw_lock_s_unlock(dict_operation_lock);
-
+ rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0);
} else if (!dict_table_has_fts_index(user_table)) {
dict_table_close(user_table, FALSE, FALSE);
-
- rw_lock_s_unlock(dict_operation_lock);
-
+ rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0);
}
@@ -2938,7 +2935,7 @@ i_s_fts_deleted_generic_fill(
dict_table_close(user_table, FALSE, FALSE);
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(ret);
}
@@ -3751,14 +3748,13 @@ i_s_fts_index_table_fill(
}
/* Prevent DDL to drop fts aux tables. */
- rw_lock_s_lock(dict_operation_lock);
+ rw_lock_s_lock(&dict_operation_lock);
user_table = dict_table_open_on_name(
fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
if (!user_table) {
- rw_lock_s_unlock(dict_operation_lock);
-
+ rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0);
}
@@ -3778,7 +3774,7 @@ i_s_fts_index_table_fill(
dict_table_close(user_table, FALSE, FALSE);
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
ut_free(conv_str.f_str);
@@ -3920,19 +3916,19 @@ i_s_fts_config_fill(
fields = table->field;
/* Prevent DDL to drop fts aux tables. */
- rw_lock_s_lock(dict_operation_lock);
+ rw_lock_s_lock(&dict_operation_lock);
user_table = dict_table_open_on_name(
fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE);
if (!user_table) {
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0);
} else if (!dict_table_has_fts_index(user_table)) {
dict_table_close(user_table, FALSE, FALSE);
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0);
}
@@ -3992,7 +3988,7 @@ i_s_fts_config_fill(
dict_table_close(user_table, FALSE, FALSE);
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(ret);
}
@@ -6388,7 +6384,7 @@ i_s_sys_tables_fill_table_stats(
}
heap = mem_heap_create(1000);
- rw_lock_s_lock(dict_operation_lock);
+ rw_lock_s_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
@@ -6423,11 +6419,11 @@ i_s_sys_tables_fill_table_stats(
err_msg);
}
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
mem_heap_empty(heap);
/* Get the next record */
- rw_lock_s_lock(dict_operation_lock);
+ rw_lock_s_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex);
mtr_start(&mtr);
@@ -6436,7 +6432,7 @@ i_s_sys_tables_fill_table_stats(
mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex);
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
mem_heap_free(heap);
DBUG_RETURN(0);
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 4acdae31ee8..cdcdef75917 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -1676,7 +1676,7 @@ extern ib_mutex_t dict_foreign_err_mutex; /* mutex protecting the
/** the dictionary system */
extern dict_sys_t* dict_sys;
/** the data dictionary rw-latch protecting dict_sys */
-extern rw_lock_t* dict_operation_lock;
+extern rw_lock_t dict_operation_lock;
/* Dictionary system struct */
struct dict_sys_t{
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index 7ced4a0e9e0..e0451d66de1 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -631,34 +631,14 @@ struct rw_lock_t
#endif /* UNIV_PFS_RWLOCK */
#ifdef UNIV_DEBUG
-/** Value of rw_lock_t::magic_n */
-# define RW_LOCK_MAGIC_N 22643
-
- /** Constructor */
- rw_lock_t()
- {
- magic_n = RW_LOCK_MAGIC_N;
- }
-
- /** Destructor */
- virtual ~rw_lock_t()
- {
- ut_ad(magic_n == RW_LOCK_MAGIC_N);
- magic_n = 0;
- }
-
virtual std::string to_string() const;
virtual std::string locked_from() const;
- /** For checking memory corruption. */
- ulint magic_n;
-
/** In the debug version: pointer to the debug info list of the lock */
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
/** Level in the global latching order. */
latch_level_t level;
-
#endif /* UNIV_DEBUG */
};
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 16694d751a1..036b657e36c 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -3819,7 +3819,7 @@ row_import_for_mysql(
/* Prevent DDL operations while we are checking. */
- rw_lock_s_lock_func(dict_operation_lock, 0, __FILE__, __LINE__);
+ rw_lock_s_lock_func(&dict_operation_lock, 0, __FILE__, __LINE__);
row_import cfg;
@@ -3844,14 +3844,14 @@ row_import_for_mysql(
autoinc = cfg.m_autoinc;
}
- rw_lock_s_unlock_gen(dict_operation_lock, 0);
+ rw_lock_s_unlock_gen(&dict_operation_lock, 0);
DBUG_EXECUTE_IF("ib_import_set_index_root_failure",
err = DB_TOO_MANY_CONCURRENT_TRXS;);
} else if (cfg.m_missing) {
- rw_lock_s_unlock_gen(dict_operation_lock, 0);
+ rw_lock_s_unlock_gen(&dict_operation_lock, 0);
/* We don't have a schema file, we will have to discover
the index root pages from the .ibd file and skip the schema
@@ -3883,7 +3883,7 @@ row_import_for_mysql(
space_flags = fetchIndexRootPages.get_space_flags();
} else {
- rw_lock_s_unlock_gen(dict_operation_lock, 0);
+ rw_lock_s_unlock_gen(&dict_operation_lock, 0);
}
if (err != DB_SUCCESS) {
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index f3e6cf093a0..b081f15b279 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1574,7 +1574,7 @@ row_ins_check_foreign_constraint(
upd_node= NULL;
#endif /* WITH_WSREP */
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_S));
err = DB_SUCCESS;
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 262beeb37c2..0013fabd98e 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2902,7 +2902,7 @@ row_log_table_apply(
stage->begin_phase_log_table();
- ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_S));
+ ut_ad(!rw_lock_own(&dict_operation_lock, RW_LOCK_S));
clust_index = dict_table_get_first_index(old_table);
rw_lock_x_lock(dict_index_get_lock(clust_index));
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index dc4c8b72785..3dd7ba233b2 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -3614,7 +3614,7 @@ row_merge_drop_index_dict(
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
info = pars_info_create();
pars_info_add_ull_literal(info, "indexid", index_id);
@@ -3677,7 +3677,7 @@ row_merge_drop_indexes_dict(
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
/* It is possible that table->n_ref_count > 1 when
locked=TRUE. In this case, all code that should have an open
@@ -3727,7 +3727,7 @@ row_merge_drop_indexes(
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
index = dict_table_get_first_index(table);
ut_ad(dict_index_is_clust(index));
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 6d5c79859b8..b8e5a7e9c65 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2062,7 +2062,7 @@ row_mysql_freeze_data_dictionary_func(
{
ut_a(trx->dict_operation_lock_mode == 0);
- rw_lock_s_lock_inline(dict_operation_lock, 0, file, line);
+ rw_lock_s_lock_inline(&dict_operation_lock, 0, file, line);
trx->dict_operation_lock_mode = RW_S_LATCH;
}
@@ -2078,7 +2078,7 @@ row_mysql_unfreeze_data_dictionary(
ut_a(trx->dict_operation_lock_mode == RW_S_LATCH);
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
trx->dict_operation_lock_mode = 0;
}
@@ -2183,7 +2183,7 @@ row_mysql_lock_data_dictionary_func(
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks or lock waits can occur then in these operations */
- rw_lock_x_lock_inline(dict_operation_lock, 0, file, line);
+ rw_lock_x_lock_inline(&dict_operation_lock, 0, file, line);
trx->dict_operation_lock_mode = RW_X_LATCH;
mutex_enter(&dict_sys->mutex);
@@ -2204,7 +2204,7 @@ row_mysql_unlock_data_dictionary(
no deadlocks can occur then in these operations */
mutex_exit(&dict_sys->mutex);
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
trx->dict_operation_lock_mode = 0;
}
@@ -2228,7 +2228,7 @@ row_create_table_for_mysql(
que_thr_t* thr;
dberr_t err;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
@@ -2392,7 +2392,7 @@ row_create_index_for_mysql(
is_fts = (index->type == DICT_FTS);
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
table = dict_table_open_on_name(table_name, TRUE, TRUE,
@@ -3300,7 +3300,7 @@ row_drop_table_for_mysql(
}
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
table = dict_table_open_on_name(
name, TRUE, FALSE,
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index b039834748d..560315af499 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -111,7 +111,7 @@ row_purge_remove_clust_if_poss_low(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S)
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_S)
|| node->vcol_info.is_used());
index = dict_table_get_first_index(node->table);
@@ -796,7 +796,7 @@ row_purge_upd_exist_or_extern_func(
{
mem_heap_t* heap;
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_S)
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_S)
|| node->vcol_info.is_used());
ut_ad(!node->table->skip_alter_undo);
@@ -979,7 +979,7 @@ skip:
for this row */
try_again:
- rw_lock_s_lock_inline(dict_operation_lock, 0, __FILE__, __LINE__);
+ rw_lock_s_lock_inline(&dict_operation_lock, 0, __FILE__, __LINE__);
node->table = dict_table_open_on_id(
table_id, FALSE, DICT_TABLE_OP_NORMAL);
@@ -1003,7 +1003,7 @@ try_again:
if (!mysqld_server_started) {
dict_table_close(node->table, FALSE, FALSE);
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
return(false);
}
@@ -1033,7 +1033,7 @@ close_exit:
dict_table_close(node->table, FALSE, FALSE);
node->table = NULL;
err_exit:
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
if (table_id) {
node->skip(table_id, trx_id);
}
@@ -1162,10 +1162,10 @@ row_purge(
node, undo_rec, thr, updated_extern);
if (!node->vcol_info.is_used()) {
- rw_lock_s_unlock(dict_operation_lock);
+ rw_lock_s_unlock(&dict_operation_lock);
}
- ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_S));
+ ut_ad(!rw_lock_own(&dict_operation_lock, RW_LOCK_S));
if (purged
|| srv_shutdown_state != SRV_SHUTDOWN_NONE
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 934295f501e..50f88cc857e 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1788,7 +1788,7 @@ dberr_t row_truncate_table_for_mysql(dict_table_t* table, trx_t* trx)
ut_a(trx->dict_operation_lock_mode == 0);
row_mysql_lock_data_dictionary(trx);
ut_ad(mutex_own(&dict_sys->mutex));
- ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_X));
/* Step-4: Stop all the background process associated with table. */
dict_stats_wait_bg_to_stop_using_table(table, trx);
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 7d56b0cee3f..3d4065cbab6 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -263,7 +263,7 @@ row_undo_mod_clust(
ut_ad(thr_get_trx(thr) == node->trx);
ut_ad(node->trx->dict_operation_lock_mode);
ut_ad(node->trx->in_rollback);
- ut_ad(rw_lock_own_flagged(dict_operation_lock,
+ ut_ad(rw_lock_own_flagged(&dict_operation_lock,
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
log_free_check();
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 3d7e3e3814c..a6ada6067fd 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -2066,7 +2066,7 @@ srv_master_evict_from_table_cache(
{
ulint n_tables_evicted = 0;
- rw_lock_x_lock(dict_operation_lock);
+ rw_lock_x_lock(&dict_operation_lock);
dict_mutex_enter_for_mysql();
@@ -2075,7 +2075,7 @@ srv_master_evict_from_table_cache(
dict_mutex_exit_for_mysql();
- rw_lock_x_unlock(dict_operation_lock);
+ rw_lock_x_unlock(&dict_operation_lock);
return(n_tables_evicted);
}
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index acfddff4b6b..2c3407ba56a 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -241,9 +241,6 @@ rw_lock_create_func(
mutex_enter(&rw_lock_list_mutex);
- ut_ad(UT_LIST_GET_FIRST(rw_lock_list) == NULL
- || UT_LIST_GET_FIRST(rw_lock_list)->magic_n == RW_LOCK_MAGIC_N);
-
UT_LIST_ADD_FIRST(rw_lock_list, lock);
mutex_exit(&rw_lock_list_mutex);
@@ -270,12 +267,6 @@ rw_lock_free_func(
UT_LIST_REMOVE(rw_lock_list, lock);
mutex_exit(&rw_lock_list_mutex);
-
- /* We did an in-place new in rw_lock_create_func() */
- ut_d(lock->~rw_lock_t());
- /* Sometimes (maybe when compiled with GCC -O3) the above call
- to rw_lock_t::~rw_lock_t() will not actually assign magic_n=0. */
- ut_d(lock->magic_n = 0);
}
/******************************************************************//**
@@ -870,7 +861,6 @@ rw_lock_validate(
lock_word = lock->lock_word;
- ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
ut_ad(lock->waiters < 2);
ut_ad(lock_word > -(2 * X_LOCK_DECR));
ut_ad(lock_word <= X_LOCK_DECR);
diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc
index e37aecde9ee..3c23ed91a33 100644
--- a/storage/innobase/trx/trx0i_s.cc
+++ b/storage/innobase/trx/trx0i_s.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -138,7 +138,7 @@ struct i_s_table_cache_t {
/** This structure describes the intermediate buffer */
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 */
uintmax_t last_read; /*!< last time the cache was read;
measured in microseconds since
@@ -1206,7 +1206,7 @@ can_cache_be_updated(
So it is not possible for last_read to be updated while we are
reading it. */
- ut_ad(rw_lock_own(cache->rw_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&cache->rw_lock, RW_LOCK_X));
now = ut_time_us(NULL);
if (now - cache->last_read > CACHE_MIN_IDLE_TIME_US) {
@@ -1393,10 +1393,7 @@ trx_i_s_cache_init(
release trx_i_s_cache_t::last_read_mutex
release trx_i_s_cache_t::rw_lock */
- cache->rw_lock = static_cast<rw_lock_t*>(
- ut_malloc_nokey(sizeof(*cache->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,
SYNC_TRX_I_S_RWLOCK);
cache->last_read = 0;
@@ -1425,10 +1422,7 @@ trx_i_s_cache_free(
/*===============*/
trx_i_s_cache_t* cache) /*!< in, own: cache to free */
{
- rw_lock_free(cache->rw_lock);
- ut_free(cache->rw_lock);
- cache->rw_lock = NULL;
-
+ rw_lock_free(&cache->rw_lock);
mutex_free(&cache->last_read_mutex);
hash_table_free(cache->locks_hash);
@@ -1445,7 +1439,7 @@ trx_i_s_cache_start_read(
/*=====================*/
trx_i_s_cache_t* cache) /*!< in: cache */
{
- rw_lock_s_lock(cache->rw_lock);
+ rw_lock_s_lock(&cache->rw_lock);
}
/*******************************************************************//**
@@ -1457,7 +1451,7 @@ trx_i_s_cache_end_read(
{
uintmax_t now;
- ut_ad(rw_lock_own(cache->rw_lock, RW_LOCK_S));
+ ut_ad(rw_lock_own(&cache->rw_lock, RW_LOCK_S));
/* update cache last read time */
now = ut_time_us(NULL);
@@ -1465,7 +1459,7 @@ trx_i_s_cache_end_read(
cache->last_read = now;
mutex_exit(&cache->last_read_mutex);
- rw_lock_s_unlock(cache->rw_lock);
+ rw_lock_s_unlock(&cache->rw_lock);
}
/*******************************************************************//**
@@ -1475,7 +1469,7 @@ trx_i_s_cache_start_write(
/*======================*/
trx_i_s_cache_t* cache) /*!< in: cache */
{
- rw_lock_x_lock(cache->rw_lock);
+ rw_lock_x_lock(&cache->rw_lock);
}
/*******************************************************************//**
@@ -1485,9 +1479,9 @@ trx_i_s_cache_end_write(
/*====================*/
trx_i_s_cache_t* cache) /*!< in: cache */
{
- ut_ad(rw_lock_own(cache->rw_lock, RW_LOCK_X));
+ ut_ad(rw_lock_own(&cache->rw_lock, RW_LOCK_X));
- rw_lock_x_unlock(cache->rw_lock);
+ rw_lock_x_unlock(&cache->rw_lock);
}
/*******************************************************************//**
@@ -1500,7 +1494,7 @@ cache_select_table(
trx_i_s_cache_t* cache, /*!< in: whole cache */
enum i_s_table table) /*!< in: which table */
{
- ut_ad(rw_lock_own_flagged(cache->rw_lock,
+ ut_ad(rw_lock_own_flagged(&cache->rw_lock,
RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
switch (table) {
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index d2e286be81f..2b57b5ef15f 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -221,10 +221,6 @@ purge_sys_t::~purge_sys_t()
trx_free_for_background(trx);
view.close();
rw_lock_free(&latch);
- /* rw_lock_free() already called latch.~rw_lock_t(); tame the
- debug assertions when the destructor will be called once more. */
- ut_ad(latch.magic_n == 0);
- ut_d(latch.magic_n = RW_LOCK_MAGIC_N);
mutex_free(&pq_mutex);
os_event_destroy(event);
}