1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä
2019-05-14 17:25:25 +03:00
31 changed files with 383 additions and 337 deletions

View File

@@ -328,14 +328,24 @@ the
www www
select * from information_schema.innodb_ft_deleted; select * from information_schema.innodb_ft_deleted;
DOC_ID DOC_ID
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_deleted but the InnoDB storage engine is not installed
select * from information_schema.innodb_ft_being_deleted; select * from information_schema.innodb_ft_being_deleted;
DOC_ID DOC_ID
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_being_deleted but the InnoDB storage engine is not installed
select * from information_schema.innodb_ft_index_cache; select * from information_schema.innodb_ft_index_cache;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_index_cache but the InnoDB storage engine is not installed
select * from information_schema.innodb_ft_index_table; select * from information_schema.innodb_ft_index_table;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_index_table but the InnoDB storage engine is not installed
select * from information_schema.innodb_ft_config; select * from information_schema.innodb_ft_config;
KEY VALUE KEY VALUE
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_ft_config but the InnoDB storage engine is not installed
select * from information_schema.innodb_buffer_page; select * from information_schema.innodb_buffer_page;
POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK
Warnings: Warnings:

View File

@@ -0,0 +1,121 @@
CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB;
insert into t1 VALUES('First record'),('Second record'),('Third record');
SET @save_ft_aux_table = @@GLOBAL.innodb_ft_aux_table;
connect con1,localhost,root,,;
SET GLOBAL innodb_ft_aux_table = 'test/t0';
ERROR 42000: Variable 'innodb_ft_aux_table' can't be set to the value of 'test/t0'
connection default;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
value
a
about
an
are
as
at
be
by
com
de
en
for
from
how
i
in
is
it
la
of
on
or
that
the
this
to
was
what
when
where
who
will
with
und
the
www
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
KEY VALUE
connection con1;
SET GLOBAL innodb_ft_aux_table = 'test/t1';
disconnect con1;
connection default;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
first 1 1 1 1 0
record 1 3 3 1 6
record 1 3 3 2 7
record 1 3 3 3 6
second 2 2 1 2 0
third 3 3 1 3 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
KEY VALUE
optimize_checkpoint_limit 180
synced_doc_id 0
stopword_table_name
use_stopword 1
SELECT @@GLOBAL.innodb_ft_aux_table;
@@GLOBAL.innodb_ft_aux_table
test/t1
RENAME TABLE t1 TO t2;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
first 1 1 1 1 0
record 1 3 3 1 6
record 1 3 3 2 7
record 1 3 3 3 6
second 2 2 1 2 0
third 3 3 1 3 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
KEY VALUE
optimize_checkpoint_limit 180
synced_doc_id 0
stopword_table_name
use_stopword 1
SELECT @@GLOBAL.innodb_ft_aux_table;
@@GLOBAL.innodb_ft_aux_table
test/t1
DROP TABLE t2;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
DOC_ID
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
KEY VALUE
SELECT @@GLOBAL.innodb_ft_aux_table;
@@GLOBAL.innodb_ft_aux_table
test/t1
SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table;

View File

@@ -0,0 +1,6 @@
--innodb_ft_default_stopword
--innodb_ft_deleted
--innodb_ft_being_deleted
--innodb_ft_index_cache
--innodb_ft_index_table
--innodb_ft_config

View File

@@ -0,0 +1,43 @@
--source include/have_innodb.inc
CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB;
insert into t1 VALUES('First record'),('Second record'),('Third record');
SET @save_ft_aux_table = @@GLOBAL.innodb_ft_aux_table;
connect (con1,localhost,root,,);
--error ER_WRONG_VALUE_FOR_VAR
SET GLOBAL innodb_ft_aux_table = 'test/t0';
connection default;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
connection con1;
SET GLOBAL innodb_ft_aux_table = 'test/t1';
disconnect con1;
connection default;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
SELECT @@GLOBAL.innodb_ft_aux_table;
RENAME TABLE t1 TO t2;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
SELECT @@GLOBAL.innodb_ft_aux_table;
DROP TABLE t2;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
SELECT @@GLOBAL.innodb_ft_aux_table;
SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table;

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
@@ -2353,7 +2353,7 @@ dict_delete_tablespace_and_datafiles(
{ {
dberr_t err = DB_SUCCESS; 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(mutex_own(&dict_sys->mutex));
ut_ad(srv_sys_tablespaces_open); ut_ad(srv_sys_tablespaces_open);

View File

@@ -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 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 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; return DB_SUCCESS;
} }
rw_lock_x_lock(dict_operation_lock); rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
ret = dict_stats_save_index_stat(index, now, "n_pages_freed", ret = dict_stats_save_index_stat(index, now, "n_pages_freed",
@@ -255,7 +255,7 @@ dict_stats_save_defrag_summary(
NULL); NULL);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
return (ret); return (ret);
} }
@@ -295,7 +295,7 @@ dict_stats_save_defrag_stats(
return DB_SUCCESS; return DB_SUCCESS;
} }
rw_lock_x_lock(dict_operation_lock); rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
ret = dict_stats_save_index_stat(index, now, "n_page_split", ret = dict_stats_save_index_stat(index, now, "n_page_split",
@@ -328,7 +328,7 @@ dict_stats_save_defrag_stats(
end: end:
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
return (ret); return (ret);
} }

View File

@@ -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 operations a table drop since MySQL does not know of them; therefore
we need this; NOTE: a transaction which reserves this must keep book we need this; NOTE: a transaction which reserves this must keep book
on the mode in trx_t::dict_operation_lock_mode */ 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 /** Percentage of compression failures that are allowed in a single
round */ round */
@@ -549,7 +549,7 @@ dict_table_close_and_drop(
dberr_t err = DB_SUCCESS; dberr_t err = DB_SUCCESS;
ut_ad(mutex_own(&dict_sys->mutex)); 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->dict_operation != TRX_DICT_OP_NONE);
ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE));
@@ -1078,9 +1078,6 @@ void
dict_init(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))); 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); UT_LIST_INIT(dict_sys->table_LRU, &dict_table_t::table_LRU);
@@ -1097,7 +1094,7 @@ dict_init(void)
/ (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE)); / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE));
rw_lock_create(dict_operation_lock_key, rw_lock_create(dict_operation_lock_key,
dict_operation_lock, SYNC_DICT_OPERATION); &dict_operation_lock, SYNC_DICT_OPERATION);
if (!srv_read_only_mode) { if (!srv_read_only_mode) {
dict_foreign_err_file = os_file_create_tmpfile(); dict_foreign_err_file = os_file_create_tmpfile();
@@ -1325,7 +1322,7 @@ dict_table_can_be_evicted(
dict_table_t* table) /*!< in: table to test */ dict_table_t* table) /*!< in: table to test */
{ {
ut_ad(mutex_own(&dict_sys->mutex)); 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->can_be_evicted);
ut_a(table->foreign_set.empty()); ut_a(table->foreign_set.empty());
@@ -1393,7 +1390,7 @@ dict_make_room_in_cache(
ut_a(pct_check > 0); ut_a(pct_check > 0);
ut_a(pct_check <= 100); ut_a(pct_check <= 100);
ut_ad(mutex_own(&dict_sys->mutex)); 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()); ut_ad(dict_lru_validate());
i = len = UT_LIST_GET_LEN(dict_sys->table_LRU); i = len = UT_LIST_GET_LEN(dict_sys->table_LRU);
@@ -2030,7 +2027,7 @@ dict_table_remove_from_cache_low(
trx_t* trx = trx_create(); trx_t* trx = trx_create();
ut_ad(mutex_own(&dict_sys->mutex)); 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(). */ /* Mimic row_mysql_lock_data_dictionary(). */
trx->dict_operation_lock_mode = RW_X_LATCH; trx->dict_operation_lock_mode = RW_X_LATCH;
@@ -5956,7 +5953,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_tables));
ut_ad(!dict_table_is_comp(dict_sys->sys_indexes)); 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)); mutex_enter(&(dict_sys->mutex));
heap = mem_heap_create(sizeof(dtuple_t) + 2 * (sizeof(dfield_t) heap = mem_heap_create(sizeof(dtuple_t) + 2 * (sizeof(dfield_t)
@@ -6006,7 +6003,7 @@ dict_index_set_merge_threshold(
mem_heap_free(heap); mem_heap_free(heap);
mutex_exit(&(dict_sys->mutex)); mutex_exit(&(dict_sys->mutex));
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
} }
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
@@ -6600,10 +6597,7 @@ dict_close(void)
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
mutex_free(&dict_sys->mutex); mutex_free(&dict_sys->mutex);
rw_lock_free(dict_operation_lock); rw_lock_free(&dict_operation_lock);
ut_free(dict_operation_lock);
dict_operation_lock = NULL;
mutex_free(&dict_foreign_err_mutex); mutex_free(&dict_foreign_err_mutex);
@@ -7014,7 +7008,7 @@ dict_space_is_empty(
mtr_t mtr; mtr_t mtr;
bool found = false; bool found = false;
rw_lock_x_lock(dict_operation_lock); rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
mtr_start(&mtr); mtr_start(&mtr);
@@ -7037,7 +7031,7 @@ dict_space_is_empty(
mtr_commit(&mtr); mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
return(!found); return(!found);
} }
@@ -7055,7 +7049,7 @@ dict_space_get_id(
ulint name_len = strlen(name); ulint name_len = strlen(name);
ulint id = ULINT_UNDEFINED; ulint id = ULINT_UNDEFINED;
rw_lock_x_lock(dict_operation_lock); rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
mtr_start(&mtr); mtr_start(&mtr);
@@ -7086,7 +7080,7 @@ dict_space_get_id(
mtr_commit(&mtr); mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
return(id); return(id);
} }

View File

@@ -882,7 +882,7 @@ dict_update_filepath(
dberr_t err = DB_SUCCESS; dberr_t err = DB_SUCCESS;
trx_t* trx; 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)); ut_ad(mutex_own(&dict_sys->mutex));
trx = trx_create(); trx = trx_create();
@@ -950,7 +950,7 @@ dict_replace_tablespace_and_filepath(
DBUG_EXECUTE_IF("innodb_fail_to_update_tablespace_dict", DBUG_EXECUTE_IF("innodb_fail_to_update_tablespace_dict",
return(DB_INTERRUPTED);); 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(mutex_own(&dict_sys->mutex));
ut_ad(filepath); ut_ad(filepath);
@@ -1348,7 +1348,7 @@ static ulint dict_check_sys_tables()
DBUG_ENTER("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)); ut_ad(mutex_own(&dict_sys->mutex));
mtr_start(&mtr); mtr_start(&mtr);
@@ -1485,7 +1485,7 @@ void dict_check_tablespaces_and_store_max_id()
DBUG_ENTER("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); mutex_enter(&dict_sys->mutex);
/* Initialize the max space_id from sys header */ /* Initialize the max space_id from sys header */
@@ -1504,7 +1504,7 @@ void dict_check_tablespaces_and_store_max_id()
fil_set_max_space_id_if_bigger(max_space_id); fil_set_max_space_id_if_bigger(max_space_id);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved. 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 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 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; dberr_t err;
bool trx_started = false; 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)); ut_ad(mutex_own(&dict_sys->mutex));
if (!dict_stats_persistent_storage_check(true)) { if (!dict_stats_persistent_storage_check(true)) {
@@ -2313,7 +2313,7 @@ dict_stats_save_index_stat(
char table_utf8[MAX_TABLE_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN];
ut_ad(!trx || trx->internal || trx->mysql_thd); ut_ad(!trx || trx->internal || trx->mysql_thd);
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(mutex_own(&dict_sys->mutex));
dict_fs2utf8(index->table->name.m_name, db_utf8, sizeof(db_utf8), dict_fs2utf8(index->table->name.m_name, db_utf8, sizeof(db_utf8),
@@ -2449,7 +2449,7 @@ dict_stats_save(
table_utf8, sizeof(table_utf8)); table_utf8, sizeof(table_utf8));
now = ut_time(); now = ut_time();
rw_lock_x_lock(dict_operation_lock); rw_lock_x_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
pinfo = pars_info_create(); pinfo = pars_info_create();
@@ -2490,7 +2490,7 @@ dict_stats_save(
<< table->name << ": " << ut_strerr(ret); << table->name << ": " << ut_strerr(ret);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
dict_stats_snapshot_free(table); dict_stats_snapshot_free(table);
@@ -2597,7 +2597,7 @@ end:
trx_free(trx); trx_free(trx);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
dict_stats_snapshot_free(table); dict_stats_snapshot_free(table);
@@ -3408,7 +3408,7 @@ dict_stats_drop_index(
pars_info_add_str_literal(pinfo, "index_name", iname); 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); mutex_enter(&dict_sys->mutex);
ret = dict_stats_exec_sql( ret = dict_stats_exec_sql(
@@ -3422,7 +3422,7 @@ dict_stats_drop_index(
"END;\n", NULL); "END;\n", NULL);
mutex_exit(&dict_sys->mutex); 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) { if (ret == DB_STATS_DO_NOT_EXIST) {
ret = DB_SUCCESS; ret = DB_SUCCESS;
@@ -3470,7 +3470,7 @@ dict_stats_delete_from_table_stats(
pars_info_t* pinfo; pars_info_t* pinfo;
dberr_t ret; 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)); ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create(); pinfo = pars_info_create();
@@ -3506,7 +3506,7 @@ dict_stats_delete_from_index_stats(
pars_info_t* pinfo; pars_info_t* pinfo;
dberr_t ret; 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)); ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create(); pinfo = pars_info_create();
@@ -3543,7 +3543,7 @@ dict_stats_drop_table(
char table_utf8[MAX_TABLE_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN];
dberr_t ret; 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)); ut_ad(mutex_own(&dict_sys->mutex));
/* skip tables that do not contain a database name /* skip tables that do not contain a database name
@@ -3619,7 +3619,7 @@ dict_stats_rename_table_in_table_stats(
pars_info_t* pinfo; pars_info_t* pinfo;
dberr_t ret; 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)); ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create(); pinfo = pars_info_create();
@@ -3663,7 +3663,7 @@ dict_stats_rename_table_in_index_stats(
pars_info_t* pinfo; pars_info_t* pinfo;
dberr_t ret; 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)); ut_ad(mutex_own(&dict_sys->mutex));
pinfo = pars_info_create(); pinfo = pars_info_create();
@@ -3707,7 +3707,7 @@ dict_stats_rename_table(
char new_table_utf8[MAX_TABLE_UTF8_LEN]; char new_table_utf8[MAX_TABLE_UTF8_LEN];
dberr_t ret; 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)); ut_ad(!mutex_own(&dict_sys->mutex));
/* skip innodb_table_stats and innodb_index_stats themselves */ /* skip innodb_table_stats and innodb_index_stats themselves */
@@ -3725,7 +3725,7 @@ dict_stats_rename_table(
dict_fs2utf8(new_name, new_db_utf8, sizeof(new_db_utf8), dict_fs2utf8(new_name, new_db_utf8, sizeof(new_db_utf8),
new_table_utf8, sizeof(new_table_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); mutex_enter(&dict_sys->mutex);
ulint n_attempts = 0; ulint n_attempts = 0;
@@ -3747,9 +3747,9 @@ dict_stats_rename_table(
if (ret != DB_SUCCESS) { if (ret != DB_SUCCESS) {
mutex_exit(&dict_sys->mutex); 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 */); 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); mutex_enter(&dict_sys->mutex);
} }
} while ((ret == DB_DEADLOCK } while ((ret == DB_DEADLOCK
@@ -3779,7 +3779,7 @@ dict_stats_rename_table(
new_db_utf8, new_table_utf8, new_db_utf8, new_table_utf8,
old_db_utf8, old_table_utf8); old_db_utf8, old_table_utf8);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
return(ret); return(ret);
} }
/* else */ /* else */
@@ -3803,9 +3803,9 @@ dict_stats_rename_table(
if (ret != DB_SUCCESS) { if (ret != DB_SUCCESS) {
mutex_exit(&dict_sys->mutex); 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 */); 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); mutex_enter(&dict_sys->mutex);
} }
} while ((ret == DB_DEADLOCK } while ((ret == DB_DEADLOCK
@@ -3814,7 +3814,7 @@ dict_stats_rename_table(
&& n_attempts < 5); && n_attempts < 5);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
if (ret != DB_SUCCESS) { if (ret != DB_SUCCESS) {
snprintf(errstr, errstr_sz, snprintf(errstr, errstr_sz,

View File

@@ -3238,7 +3238,7 @@ fil_ibd_open(
ulint tablespaces_found = 0; ulint tablespaces_found = 0;
ulint valid_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 || mutex_own(&dict_sys->mutex));
ut_ad(!fix_dict || !srv_read_only_mode); ut_ad(!fix_dict || !srv_read_only_mode);

View File

@@ -88,11 +88,6 @@ static const ulint FTS_CACHE_SIZE_UPPER_LIMIT_IN_MB = 1024;
/** Time to sleep after DEADLOCK error before retrying operation. */ /** Time to sleep after DEADLOCK error before retrying operation. */
static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000; static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
/** variable to record innodb_fts_internal_tbl_name for information
schema table INNODB_FTS_INSERTED etc. */
char* fts_internal_tbl_name = NULL;
char* fts_internal_tbl_name2 = NULL;
/** InnoDB default stopword list: /** InnoDB default stopword list:
There are different versions of stopwords, the stop words listed There are different versions of stopwords, the stop words listed
below comes from "Google Stopword" list. Reference: below comes from "Google Stopword" list. Reference:
@@ -2838,21 +2833,6 @@ fts_doc_ids_create(void)
return(fts_doc_ids); return(fts_doc_ids);
} }
/*********************************************************************//**
Free a fts_doc_ids_t. */
void
fts_doc_ids_free(
/*=============*/
fts_doc_ids_t* fts_doc_ids)
{
mem_heap_t* heap = static_cast<mem_heap_t*>(
fts_doc_ids->self_heap->arg);
memset(fts_doc_ids, 0, sizeof(*fts_doc_ids));
mem_heap_free(heap);
}
/*********************************************************************//** /*********************************************************************//**
Do commit-phase steps necessary for the insertion of a new row. */ Do commit-phase steps necessary for the insertion of a new row. */
void void

View File

@@ -1778,8 +1778,6 @@ fts_optimize_words(
fetch.read_arg = optim->words; fetch.read_arg = optim->words;
fetch.read_record = fts_optimize_index_fetch_node; fetch.read_record = fts_optimize_index_fetch_node;
ib::info().write(word->f_str, word->f_len);
while (!optim->done) { while (!optim->done) {
dberr_t error; dberr_t error;
trx_t* trx = optim->trx; trx_t* trx = optim->trx;

View File

@@ -13820,7 +13820,7 @@ innodb_rec_per_key(
} }
/* If the number of NULL values is the same as or /* If the number of NULL values is the same as or
large than that of the distinct values, we could larger than that of the distinct values, we could
consider that the table consists mostly of NULL value. consider that the table consists mostly of NULL value.
Set rec_per_key to 1. */ Set rec_per_key to 1. */
if (n_diff <= n_null) { if (n_diff <= n_null) {
@@ -17319,86 +17319,36 @@ innodb_buffer_pool_size_update(THD*,st_mysql_sys_var*,void*, const void* save)
<< " (new size: " << in_val << " bytes)"; << " (new size: " << in_val << " bytes)";
} }
/*************************************************************//** /** The latest assigned innodb_ft_aux_table name */
Check whether valid argument given to "innodb_fts_internal_tbl_name" static char* innodb_ft_aux_table;
This function is registered as a callback with MySQL.
@return 0 for valid stopword table */ /** Update innodb_ft_aux_table_id on SET GLOBAL innodb_ft_aux_table.
static @param[out] save new value of innodb_ft_aux_table
int @param[in] value user-specified value */
innodb_internal_table_validate( static int innodb_ft_aux_table_validate(THD*, st_mysql_sys_var*,
/*===========================*/ void* save, st_mysql_value* value)
THD*, st_mysql_sys_var*,
void* save, /*!< out: immediate result
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{ {
const char* table_name; char buf[STRING_BUFFER_USUAL_SIZE];
char buff[STRING_BUFFER_USUAL_SIZE]; int len = sizeof buf;
int len = sizeof(buff);
int ret = 1;
dict_table_t* user_table;
ut_a(save != NULL); if (const char* table_name = value->val_str(value, buf, &len)) {
ut_a(value != NULL); if (dict_table_t* table = dict_table_open_on_name(
table_name, FALSE, TRUE, DICT_ERR_IGNORE_NONE)) {
table_name = value->val_str(value, buff, &len); const table_id_t id = dict_table_has_fts_index(table)
? table->id : 0;
if (!table_name) { dict_table_close(table, FALSE, FALSE);
*static_cast<const char**>(save) = NULL; if (id) {
return(0); innodb_ft_aux_table_id = id;
} *static_cast<const char**>(save) = table_name;
return 0;
user_table = dict_table_open_on_name( }
table_name, FALSE, TRUE, DICT_ERR_IGNORE_NONE);
if (user_table) {
if (dict_table_has_fts_index(user_table)) {
*static_cast<const char**>(save) = table_name;
ret = 0;
} }
dict_table_close(user_table, FALSE, TRUE); return 1;
DBUG_EXECUTE_IF("innodb_evict_autoinc_table",
mutex_enter(&dict_sys->mutex);
dict_table_remove_from_cache_low(user_table, TRUE);
mutex_exit(&dict_sys->mutex);
);
}
return(ret);
}
/****************************************************************//**
Update global variable "fts_internal_tbl_name" with the "saved"
stopword table name value. This function is registered as a callback
with MySQL. */
static
void
innodb_internal_table_update(
/*=========================*/
THD*, st_mysql_sys_var*,
void* var_ptr,/*!< out: where the
formal string goes */
const void* save) /*!< in: immediate result
from check function */
{
const char* table_name;
char* old;
ut_a(save != NULL);
ut_a(var_ptr != NULL);
table_name = *static_cast<const char*const*>(save);
old = *(char**) var_ptr;
*(char**) var_ptr = table_name ? my_strdup(table_name, MYF(0)) : NULL;
my_free(old);
fts_internal_tbl_name2 = *(char**) var_ptr;
if (fts_internal_tbl_name2 == NULL) {
fts_internal_tbl_name = const_cast<char*>("default");
} else { } else {
fts_internal_tbl_name = fts_internal_tbl_name2; *static_cast<char**>(save) = NULL;
innodb_ft_aux_table_id = 0;
return 0;
} }
} }
@@ -19501,11 +19451,10 @@ static MYSQL_SYSVAR_BOOL(disable_sort_file_cache, srv_disable_sort_file_cache,
"Whether to disable OS system file cache for sort I/O", "Whether to disable OS system file cache for sort I/O",
NULL, NULL, FALSE); NULL, NULL, FALSE);
static MYSQL_SYSVAR_STR(ft_aux_table, fts_internal_tbl_name2, static MYSQL_SYSVAR_STR(ft_aux_table, innodb_ft_aux_table,
PLUGIN_VAR_RQCMDARG, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC,
"FTS internal auxiliary table to be checked", "FTS internal auxiliary table to be checked",
innodb_internal_table_validate, innodb_ft_aux_table_validate, NULL, NULL);
innodb_internal_table_update, NULL);
static MYSQL_SYSVAR_ULONG(ft_cache_size, fts_max_cache_size, static MYSQL_SYSVAR_ULONG(ft_cache_size, fts_max_cache_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
@@ -20615,7 +20564,7 @@ static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
/* Purge thread acquires dict_operation_lock while /* Purge thread acquires dict_operation_lock while
processing undo log record. Release the dict_operation_lock processing undo log record. Release the dict_operation_lock
before acquiring MDL on the table. */ 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); return innodb_acquire_mdl(thd, table);
} else { } else {
if (table->vc_templ->mysql_table_query_id if (table->vc_templ->mysql_table_query_id

View File

@@ -3719,7 +3719,7 @@ innobase_update_gis_column_type(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX); DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex)); 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(); info = pars_info_create();
@@ -5723,7 +5723,7 @@ op_ok:
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
ut_ad(ctx->trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(ctx->trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex)); 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); DICT_TF2_FLAG_SET(ctx->new_table, DICT_TF2_FTS);
if (ctx->need_rebuild()) { if (ctx->need_rebuild()) {
@@ -6918,8 +6918,8 @@ ha_innobase::inplace_alter_table(
DBUG_ASSERT(!srv_read_only_mode); DBUG_ASSERT(!srv_read_only_mode);
ut_ad(!sync_check_iterate(sync_check())); ut_ad(!sync_check_iterate(sync_check()));
ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_X)); ut_ad(!rw_lock_own_flagged(&dict_operation_lock,
ut_ad(!rw_lock_own(dict_operation_lock, RW_LOCK_S)); RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
DEBUG_SYNC(m_user_thd, "innodb_inplace_alter_table_enter"); DEBUG_SYNC(m_user_thd, "innodb_inplace_alter_table_enter");
@@ -7133,7 +7133,7 @@ innobase_online_rebuild_log_free(
dict_index_t* clust_index = dict_table_get_first_index(table); dict_index_t* clust_index = dict_table_get_first_index(table);
ut_ad(mutex_own(&dict_sys->mutex)); 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); rw_lock_x_lock(&clust_index->lock);
@@ -7408,7 +7408,7 @@ innobase_drop_foreign_try(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX); DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex)); 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. */ /* Drop the constraint from the data dictionary. */
static const char sql[] = static const char sql[] =
@@ -7470,7 +7470,7 @@ innobase_rename_column_try(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX); DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex)); 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) { if (new_clustered) {
goto rename_foreign; goto rename_foreign;
@@ -7751,7 +7751,7 @@ innobase_enlarge_column_try(
DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX); DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(mutex_own(&dict_sys->mutex)); 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) { if (is_v) {
v_col = dict_table_get_nth_v_col(user_table, nth_col); v_col = dict_table_get_nth_v_col(user_table, nth_col);

View File

@@ -59,6 +59,9 @@ Modified Dec 29, 2014 Jan Lindström (Added sys_semaphore_waits)
#include "fil0crypt.h" #include "fil0crypt.h"
#include "dict0crea.h" #include "dict0crea.h"
/** The latest successfully looked up innodb_fts_aux_table */
UNIV_INTERN table_id_t innodb_ft_aux_table_id;
/** structure associates a name string with a file page type and/or buffer /** structure associates a name string with a file page type and/or buffer
page state. */ page state. */
struct buf_page_desc_t{ struct buf_page_desc_t{
@@ -2864,25 +2867,21 @@ i_s_fts_deleted_generic_fill(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (!fts_internal_tbl_name) { RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
DBUG_RETURN(0);
}
/* Prevent DDL to drop fts aux tables. */ /* Prevent DROP of the internal tables for fulltext indexes.
rw_lock_s_lock(dict_operation_lock); FIXME: acquire DDL-blocking MDL on the user table name! */
rw_lock_s_lock(&dict_operation_lock);
user_table = dict_table_open_on_name( user_table = dict_table_open_on_id(
fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
if (!user_table) { if (!user_table) {
rw_lock_s_unlock(dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0); DBUG_RETURN(0);
} else if (!dict_table_has_fts_index(user_table)) { } else if (!dict_table_has_fts_index(user_table)) {
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);
rw_lock_s_unlock(dict_operation_lock);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@@ -2897,6 +2896,12 @@ i_s_fts_deleted_generic_fill(
fts_table_fetch_doc_ids(trx, &fts_table, deleted); fts_table_fetch_doc_ids(trx, &fts_table, deleted);
dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);
trx_free(trx);
fields = table->field; fields = table->field;
int ret = 0; int ret = 0;
@@ -2911,14 +2916,8 @@ i_s_fts_deleted_generic_fill(
BREAK_IF(ret = schema_table_store_record(thd, table)); BREAK_IF(ret = schema_table_store_record(thd, table));
} }
trx_free(trx);
fts_doc_ids_free(deleted); fts_doc_ids_free(deleted);
dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(dict_operation_lock);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
@@ -3278,32 +3277,33 @@ i_s_fts_index_cache_fill(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (!fts_internal_tbl_name) { RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
DBUG_RETURN(0);
}
user_table = dict_table_open_on_name( /* Prevent DROP of the internal tables for fulltext indexes.
fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); FIXME: acquire DDL-blocking MDL on the user table name! */
rw_lock_s_lock(&dict_operation_lock);
user_table = dict_table_open_on_id(
innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
if (!user_table) { if (!user_table) {
no_fts:
rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (user_table->fts == NULL || user_table->fts->cache == NULL) { if (!user_table->fts || !user_table->fts->cache) {
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
goto no_fts;
DBUG_RETURN(0);
} }
cache = user_table->fts->cache; cache = user_table->fts->cache;
ut_a(cache);
int ret = 0; int ret = 0;
fts_string_t conv_str; fts_string_t conv_str;
conv_str.f_len = system_charset_info->mbmaxlen byte word[HA_FT_MAXBYTELEN + 1];
* FTS_MAX_WORD_LEN_IN_CHAR; conv_str.f_len = sizeof word;
conv_str.f_str = static_cast<byte*>(ut_malloc_nokey(conv_str.f_len)); conv_str.f_str = word;
for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) { for (ulint i = 0; i < ib_vector_size(cache->indexes); i++) {
fts_index_cache_t* index_cache; fts_index_cache_t* index_cache;
@@ -3315,9 +3315,8 @@ i_s_fts_index_cache_fill(
index_cache, thd, &conv_str, tables)); index_cache, thd, &conv_str, tables));
} }
ut_free(conv_str.f_str);
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
@@ -3725,19 +3724,17 @@ i_s_fts_index_table_fill(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (!fts_internal_tbl_name) { RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
DBUG_RETURN(0);
}
/* Prevent DDL to drop fts aux tables. */ /* Prevent DROP of the internal tables for fulltext indexes.
rw_lock_s_lock(dict_operation_lock); FIXME: acquire DDL-blocking MDL on the user table name! */
rw_lock_s_lock(&dict_operation_lock);
user_table = dict_table_open_on_name( user_table = dict_table_open_on_id(
fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
if (!user_table) { if (!user_table) {
rw_lock_s_unlock(dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@@ -3757,7 +3754,7 @@ i_s_fts_index_table_fill(
dict_table_close(user_table, FALSE, FALSE); 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); ut_free(conv_str.f_str);
@@ -3890,32 +3887,28 @@ i_s_fts_config_fill(
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (!fts_internal_tbl_name) { RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
DBUG_RETURN(0);
}
DEBUG_SYNC_C("i_s_fts_config_fille_check"); /* Prevent DROP of the internal tables for fulltext indexes.
FIXME: acquire DDL-blocking MDL on the user table name! */
rw_lock_s_lock(&dict_operation_lock);
fields = table->field; user_table = dict_table_open_on_id(
innodb_ft_aux_table_id, FALSE, DICT_TABLE_OP_NORMAL);
/* Prevent DDL to drop fts aux tables. */
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) { if (!user_table) {
rw_lock_s_unlock(dict_operation_lock); no_fts:
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);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
if (!dict_table_has_fts_index(user_table)) {
dict_table_close(user_table, FALSE, FALSE);
goto no_fts;
}
fields = table->field;
trx = trx_create(); trx = trx_create();
trx->op_info = "Select for FTS CONFIG TABLE"; trx->op_info = "Select for FTS CONFIG TABLE";
@@ -3967,11 +3960,11 @@ i_s_fts_config_fill(
fts_sql_commit(trx); fts_sql_commit(trx);
trx_free(trx);
dict_table_close(user_table, FALSE, FALSE); dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
trx_free(trx);
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }
@@ -6341,7 +6334,7 @@ i_s_sys_tables_fill_table_stats(
} }
heap = mem_heap_create(1000); heap = mem_heap_create(1000);
rw_lock_s_lock(dict_operation_lock); rw_lock_s_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
mtr_start(&mtr); mtr_start(&mtr);
@@ -6375,11 +6368,11 @@ i_s_sys_tables_fill_table_stats(
err_msg); err_msg);
} }
rw_lock_s_unlock(dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
mem_heap_empty(heap); mem_heap_empty(heap);
/* Get the next record */ /* Get the next record */
rw_lock_s_lock(dict_operation_lock); rw_lock_s_lock(&dict_operation_lock);
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
mtr_start(&mtr); mtr_start(&mtr);
@@ -6388,7 +6381,7 @@ i_s_sys_tables_fill_table_stats(
mtr_commit(&mtr); mtr_commit(&mtr);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
rw_lock_s_unlock(dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
mem_heap_free(heap); mem_heap_free(heap);
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation. Copyright (c) 2014, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@@ -27,6 +27,7 @@ Modified Dec 29, 2014 Jan Lindström
#ifndef i_s_h #ifndef i_s_h
#define i_s_h #define i_s_h
#include "dict0types.h"
const char plugin_author[] = "Oracle Corporation"; const char plugin_author[] = "Oracle Corporation";
const char maria_plugin_author[] = "MariaDB Corporation"; const char maria_plugin_author[] = "MariaDB Corporation";
@@ -65,6 +66,9 @@ extern struct st_maria_plugin i_s_innodb_tablespaces_encryption;
extern struct st_maria_plugin i_s_innodb_tablespaces_scrubbing; extern struct st_maria_plugin i_s_innodb_tablespaces_scrubbing;
extern struct st_maria_plugin i_s_innodb_sys_semaphore_waits; extern struct st_maria_plugin i_s_innodb_sys_semaphore_waits;
/** The latest successfully looked up innodb_fts_aux_table */
extern table_id_t innodb_ft_aux_table_id;
/** maximum number of buffer page info we would cache. */ /** maximum number of buffer page info we would cache. */
#define MAX_BUF_INFO_CACHED 10000 #define MAX_BUF_INFO_CACHED 10000

View File

@@ -1607,7 +1607,7 @@ extern ib_mutex_t dict_foreign_err_mutex; /* mutex protecting the
/** the dictionary system */ /** the dictionary system */
extern dict_sys_t* dict_sys; extern dict_sys_t* dict_sys;
/** the data dictionary rw-latch protecting 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 */ /* Dictionary system struct */
struct dict_sys_t{ struct dict_sys_t{

View File

@@ -396,11 +396,6 @@ extern ulong fts_min_token_size;
need a sync to free some memory */ need a sync to free some memory */
extern bool fts_need_sync; extern bool fts_need_sync;
/** Variable specifying the table that has Fulltext index to display its
content through information schema table */
extern char* fts_internal_tbl_name;
extern char* fts_internal_tbl_name2;
#define fts_que_graph_free(graph) \ #define fts_que_graph_free(graph) \
do { \ do { \
mutex_enter(&dict_sys->mutex); \ mutex_enter(&dict_sys->mutex); \
@@ -452,12 +447,11 @@ fts_doc_ids_t*
fts_doc_ids_create(void); fts_doc_ids_create(void);
/*=====================*/ /*=====================*/
/******************************************************************//** /** Free fts_doc_ids_t */
Free a fts_doc_ids_t. */ inline void fts_doc_ids_free(fts_doc_ids_t* doc_ids)
void {
fts_doc_ids_free( mem_heap_free(static_cast<mem_heap_t*>(doc_ids->self_heap->arg));
/*=============*/ }
fts_doc_ids_t* doc_ids); /*!< in: doc_ids to free */
/******************************************************************//** /******************************************************************//**
Notify the FTS system about an operation on an FTS-indexed table. */ Notify the FTS system about an operation on an FTS-indexed table. */

View File

@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -625,34 +625,14 @@ struct rw_lock_t
#endif /* UNIV_PFS_RWLOCK */ #endif /* UNIV_PFS_RWLOCK */
#ifdef UNIV_DEBUG #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 to_string() const;
virtual std::string locked_from() 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 */ /** In the debug version: pointer to the debug info list of the lock */
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list; UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
/** Level in the global latching order. */ /** Level in the global latching order. */
latch_level_t level; latch_level_t level;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
}; };

View File

@@ -2007,13 +2007,7 @@ void log_t::close()
buf = NULL; buf = NULL;
os_event_destroy(flush_event); os_event_destroy(flush_event);
rw_lock_free(&checkpoint_lock); rw_lock_free(&checkpoint_lock);
/* rw_lock_free() already called checkpoint_lock.~rw_lock_t();
tame the debug assertions when the destructor will be called once more. */
ut_ad(checkpoint_lock.magic_n == 0);
ut_d(checkpoint_lock.magic_n = RW_LOCK_MAGIC_N);
mutex_free(&mutex); mutex_free(&mutex);
mutex_free(&write_mutex); mutex_free(&write_mutex);
mutex_free(&log_flush_order_mutex); mutex_free(&log_flush_order_mutex);

View File

@@ -3815,7 +3815,7 @@ row_import_for_mysql(
/* Prevent DDL operations while we are checking. */ /* 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; row_import cfg;
@@ -3840,14 +3840,14 @@ row_import_for_mysql(
autoinc = cfg.m_autoinc; 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", DBUG_EXECUTE_IF("ib_import_set_index_root_failure",
err = DB_TOO_MANY_CONCURRENT_TRXS;); err = DB_TOO_MANY_CONCURRENT_TRXS;);
} else if (cfg.m_missing) { } 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 /* We don't have a schema file, we will have to discover
the index root pages from the .ibd file and skip the schema the index root pages from the .ibd file and skip the schema
@@ -3879,7 +3879,7 @@ row_import_for_mysql(
space_flags = fetchIndexRootPages.get_space_flags(); space_flags = fetchIndexRootPages.get_space_flags();
} else { } else {
rw_lock_s_unlock_gen(dict_operation_lock, 0); rw_lock_s_unlock_gen(&dict_operation_lock, 0);
} }
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {

View File

@@ -1585,7 +1585,7 @@ row_ins_check_foreign_constraint(
upd_node= NULL; upd_node= NULL;
#endif /* WITH_WSREP */ #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; err = DB_SUCCESS;

View File

@@ -3111,7 +3111,7 @@ row_log_table_apply(
stage->begin_phase_log_table(); 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); clust_index = dict_table_get_first_index(old_table);
if (clust_index->online_log->n_rows == 0) { if (clust_index->online_log->n_rows == 0) {

View File

@@ -3757,7 +3757,7 @@ row_merge_drop_index_dict(
ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX); 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(); info = pars_info_create();
pars_info_add_ull_literal(info, "indexid", index_id); pars_info_add_ull_literal(info, "indexid", index_id);
@@ -3820,7 +3820,7 @@ row_merge_drop_indexes_dict(
ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX); 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 /* It is possible that table->n_ref_count > 1 when
locked=TRUE. In this case, all code that should have an open locked=TRUE. In this case, all code that should have an open
@@ -3870,7 +3870,7 @@ row_merge_drop_indexes(
ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
ut_ad(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX); 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); index = dict_table_get_first_index(table);
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));

View File

@@ -1500,7 +1500,8 @@ error_exit:
doc_id = fts_get_doc_id_from_row(table, node->row); doc_id = fts_get_doc_id_from_row(table, node->row);
if (doc_id <= 0) { if (doc_id <= 0) {
ib::error() << "FTS Doc ID must be large than 0"; ib::error() << "FTS_DOC_ID must be larger than 0 for table "
<< table->name;
err = DB_FTS_INVALID_DOCID; err = DB_FTS_INVALID_DOCID;
trx->error_state = DB_FTS_INVALID_DOCID; trx->error_state = DB_FTS_INVALID_DOCID;
goto error_exit; goto error_exit;
@@ -1511,8 +1512,7 @@ error_exit:
= table->fts->cache->next_doc_id; = table->fts->cache->next_doc_id;
if (doc_id < next_doc_id) { if (doc_id < next_doc_id) {
ib::error() << "FTS_DOC_ID must be larger than "
ib::error() << "FTS Doc ID must be large than "
<< next_doc_id - 1 << " for table " << next_doc_id - 1 << " for table "
<< table->name; << table->name;
@@ -2120,7 +2120,7 @@ row_mysql_freeze_data_dictionary_func(
{ {
ut_a(trx->dict_operation_lock_mode == 0); 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; trx->dict_operation_lock_mode = RW_S_LATCH;
} }
@@ -2136,7 +2136,7 @@ row_mysql_unfreeze_data_dictionary(
ut_a(trx->dict_operation_lock_mode == RW_S_LATCH); 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; trx->dict_operation_lock_mode = 0;
} }
@@ -2324,7 +2324,7 @@ row_mysql_lock_data_dictionary_func(
/* Serialize data dictionary operations with dictionary mutex: /* Serialize data dictionary operations with dictionary mutex:
no deadlocks or lock waits can occur then in these operations */ 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; trx->dict_operation_lock_mode = RW_X_LATCH;
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
@@ -2345,7 +2345,7 @@ row_mysql_unlock_data_dictionary(
no deadlocks can occur then in these operations */ no deadlocks can occur then in these operations */
mutex_exit(&dict_sys->mutex); 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; trx->dict_operation_lock_mode = 0;
} }
@@ -2369,7 +2369,7 @@ row_create_table_for_mysql(
que_thr_t* thr; que_thr_t* thr;
dberr_t err; 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(mutex_own(&dict_sys->mutex));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH); ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
@@ -2510,7 +2510,7 @@ row_create_index_for_mysql(
ulint len; ulint len;
dict_table_t* table = index->table; dict_table_t* table = index->table;
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(mutex_own(&dict_sys->mutex));
for (i = 0; i < index->n_def; i++) { for (i = 0; i < index->n_def; i++) {
@@ -3332,7 +3332,7 @@ row_drop_table_for_mysql(
} }
ut_ad(mutex_own(&dict_sys->mutex)); 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( table = dict_table_open_on_name(
name, TRUE, FALSE, name, TRUE, FALSE,

View File

@@ -111,7 +111,7 @@ row_purge_remove_clust_if_poss_low(
ulint offsets_[REC_OFFS_NORMAL_SIZE]; ulint offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_); 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()); || node->vcol_info.is_used());
index = dict_table_get_first_index(node->table); index = dict_table_get_first_index(node->table);
@@ -787,7 +787,7 @@ whose old history can no longer be observed.
@param[in,out] mtr mini-transaction (will be started and committed) */ @param[in,out] mtr mini-transaction (will be started and committed) */
static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr) static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr)
{ {
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()); || node->vcol_info.is_used());
/* Reset DB_TRX_ID, DB_ROLL_PTR for old records. */ /* Reset DB_TRX_ID, DB_ROLL_PTR for old records. */
mtr->start(); mtr->start();
@@ -863,7 +863,7 @@ row_purge_upd_exist_or_extern_func(
{ {
mem_heap_t* heap; 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()); || node->vcol_info.is_used());
ut_ad(!node->table->skip_alter_undo); ut_ad(!node->table->skip_alter_undo);
@@ -1062,7 +1062,7 @@ row_purge_parse_undo_rec(
for this row */ for this row */
try_again: 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( node->table = dict_table_open_on_id(
table_id, FALSE, DICT_TABLE_OP_NORMAL); table_id, FALSE, DICT_TABLE_OP_NORMAL);
@@ -1093,7 +1093,7 @@ try_again:
if (!mysqld_server_started) { if (!mysqld_server_started) {
dict_table_close(node->table, FALSE, FALSE); 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) { if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
return(false); return(false);
} }
@@ -1123,7 +1123,7 @@ inaccessible:
dict_table_close(node->table, FALSE, FALSE); dict_table_close(node->table, FALSE, FALSE);
node->table = NULL; node->table = NULL;
err_exit: err_exit:
rw_lock_s_unlock(dict_operation_lock); rw_lock_s_unlock(&dict_operation_lock);
node->skip(table_id, trx_id); node->skip(table_id, trx_id);
return(false); return(false);
} }
@@ -1259,10 +1259,10 @@ row_purge(
node, undo_rec, thr, updated_extern); node, undo_rec, thr, updated_extern);
if (!node->vcol_info.is_used()) { 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 if (purged
|| srv_shutdown_state != SRV_SHUTDOWN_NONE || srv_shutdown_state != SRV_SHUTDOWN_NONE

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1997, 2017, 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 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 the terms of the GNU General Public License as published by the Free Software
@@ -220,7 +220,7 @@ row_undo_mod_clust(
ut_ad(thr_get_trx(thr) == node->trx); ut_ad(thr_get_trx(thr) == node->trx);
ut_ad(node->trx->dict_operation_lock_mode); ut_ad(node->trx->dict_operation_lock_mode);
ut_ad(node->trx->in_rollback); 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)); RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
log_free_check(); log_free_check();

View File

@@ -2007,7 +2007,7 @@ srv_master_evict_from_table_cache(
{ {
ulint n_tables_evicted = 0; ulint n_tables_evicted = 0;
rw_lock_x_lock(dict_operation_lock); rw_lock_x_lock(&dict_operation_lock);
dict_mutex_enter_for_mysql(); dict_mutex_enter_for_mysql();
@@ -2016,7 +2016,7 @@ srv_master_evict_from_table_cache(
dict_mutex_exit_for_mysql(); dict_mutex_exit_for_mysql();
rw_lock_x_unlock(dict_operation_lock); rw_lock_x_unlock(&dict_operation_lock);
return(n_tables_evicted); return(n_tables_evicted);
} }

View File

@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -239,9 +239,6 @@ rw_lock_create_func(
mutex_enter(&rw_lock_list_mutex); 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); UT_LIST_ADD_FIRST(rw_lock_list, lock);
mutex_exit(&rw_lock_list_mutex); mutex_exit(&rw_lock_list_mutex);
@@ -269,12 +266,6 @@ rw_lock_free_func(
UT_LIST_REMOVE(rw_lock_list, lock); UT_LIST_REMOVE(rw_lock_list, lock);
mutex_exit(&rw_lock_list_mutex); 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);
} }
/******************************************************************//** /******************************************************************//**
@@ -862,7 +853,6 @@ rw_lock_validate(
lock_word = my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word), lock_word = my_atomic_load32_explicit(const_cast<int32_t*>(&lock->lock_word),
MY_MEMORY_ORDER_RELAXED); MY_MEMORY_ORDER_RELAXED);
ut_ad(lock->magic_n == RW_LOCK_MAGIC_N);
ut_ad(my_atomic_load32_explicit(const_cast<int32_t*>(&lock->waiters), ut_ad(my_atomic_load32_explicit(const_cast<int32_t*>(&lock->waiters),
MY_MEMORY_ORDER_RELAXED) < 2); MY_MEMORY_ORDER_RELAXED) < 2);
ut_ad(lock_word > -(2 * X_LOCK_DECR)); ut_ad(lock_word > -(2 * X_LOCK_DECR));

View File

@@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved. 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 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 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 */ /** This structure describes the intermediate buffer */
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 */
uintmax_t last_read; /*!< last time the cache was read; uintmax_t last_read; /*!< last time the cache was read;
measured in microseconds since 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 So it is not possible for last_read to be updated while we are
reading it. */ 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); now = ut_time_us(NULL);
if (now - cache->last_read > CACHE_MIN_IDLE_TIME_US) { if (now - cache->last_read > CACHE_MIN_IDLE_TIME_US) {
@@ -1349,10 +1349,7 @@ trx_i_s_cache_init(
release 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 */
cache->rw_lock = static_cast<rw_lock_t*>( rw_lock_create(trx_i_s_cache_lock_key, &cache->rw_lock,
ut_malloc_nokey(sizeof(*cache->rw_lock)));
rw_lock_create(trx_i_s_cache_lock_key, cache->rw_lock,
SYNC_TRX_I_S_RWLOCK); SYNC_TRX_I_S_RWLOCK);
cache->last_read = 0; cache->last_read = 0;
@@ -1381,10 +1378,7 @@ 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);
ut_free(cache->rw_lock);
cache->rw_lock = NULL;
mutex_free(&cache->last_read_mutex); mutex_free(&cache->last_read_mutex);
hash_table_free(cache->locks_hash); hash_table_free(cache->locks_hash);
@@ -1401,7 +1395,7 @@ trx_i_s_cache_start_read(
/*=====================*/ /*=====================*/
trx_i_s_cache_t* cache) /*!< in: cache */ trx_i_s_cache_t* cache) /*!< in: cache */
{ {
rw_lock_s_lock(cache->rw_lock); rw_lock_s_lock(&cache->rw_lock);
} }
/*******************************************************************//** /*******************************************************************//**
@@ -1413,7 +1407,7 @@ trx_i_s_cache_end_read(
{ {
uintmax_t now; 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 */ /* update cache last read time */
now = ut_time_us(NULL); now = ut_time_us(NULL);
@@ -1421,7 +1415,7 @@ trx_i_s_cache_end_read(
cache->last_read = now; cache->last_read = now;
mutex_exit(&cache->last_read_mutex); mutex_exit(&cache->last_read_mutex);
rw_lock_s_unlock(cache->rw_lock); rw_lock_s_unlock(&cache->rw_lock);
} }
/*******************************************************************//** /*******************************************************************//**
@@ -1431,7 +1425,7 @@ trx_i_s_cache_start_write(
/*======================*/ /*======================*/
trx_i_s_cache_t* cache) /*!< in: cache */ trx_i_s_cache_t* cache) /*!< in: cache */
{ {
rw_lock_x_lock(cache->rw_lock); rw_lock_x_lock(&cache->rw_lock);
} }
/*******************************************************************//** /*******************************************************************//**
@@ -1441,9 +1435,9 @@ trx_i_s_cache_end_write(
/*====================*/ /*====================*/
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_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);
} }
/*******************************************************************//** /*******************************************************************//**
@@ -1456,7 +1450,7 @@ cache_select_table(
trx_i_s_cache_t* cache, /*!< in: whole cache */ trx_i_s_cache_t* cache, /*!< in: whole cache */
enum i_s_table table) /*!< in: which table */ 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)); RW_LOCK_FLAG_X | RW_LOCK_FLAG_S));
switch (table) { switch (table) {

View File

@@ -192,10 +192,6 @@ void purge_sys_t::close()
trx->state= TRX_STATE_NOT_STARTED; trx->state= TRX_STATE_NOT_STARTED;
trx_free(trx); trx_free(trx);
rw_lock_free(&latch); 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); mutex_free(&pq_mutex);
os_event_destroy(event); os_event_destroy(event);
} }