Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb_fts/r/index_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
content TEXT
) ENGINE= InnoDB;
SET STATEMENT debug_dbug='+d,innodb_report_deadlock' FOR
SET STATEMENT debug_dbug='+d,fts_load_stopword_fail' FOR
CREATE FULLTEXT INDEX idx ON articles (title, content);
ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB
CREATE FULLTEXT INDEX idx ON articles (title, content);
Expand Down
12 changes: 6 additions & 6 deletions mysql-test/suite/innodb_fts/r/sync.result
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mysql 1 3 2 3 0
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database') ORDER BY FTS_DOC_ID;
FTS_DOC_ID title
1 mysql
2 database
Expand All @@ -42,11 +42,11 @@ database 2 3 2 3 6
mysql 1 3 2 1 0
mysql 1 3 2 3 0
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database') ORDER BY FTS_DOC_ID;
FTS_DOC_ID title
3 mysql database
1 mysql
2 database
3 mysql database
connection default;
DROP TABLE t1;
# Case 2: Test insert and insert(sync)
Expand Down Expand Up @@ -79,12 +79,12 @@ mysql 1 4 3 1 0
mysql 1 4 3 3 0
mysql 1 4 3 4 0
SET GLOBAL innodb_ft_aux_table=default;
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database') ORDER BY FTS_DOC_ID;
FTS_DOC_ID title
3 mysql database
4 mysql database
1 mysql
2 database
3 mysql database
4 mysql database
connection default;
disconnect con1;
DROP TABLE t1;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb_fts/t/index_table.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CREATE TABLE articles (
) ENGINE= InnoDB;

--error ER_GET_ERRNO
SET STATEMENT debug_dbug='+d,innodb_report_deadlock' FOR
SET STATEMENT debug_dbug='+d,fts_load_stopword_fail' FOR
CREATE FULLTEXT INDEX idx ON articles (title, content);
CREATE FULLTEXT INDEX idx ON articles (title, content);

Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/innodb_fts/t/sync.test
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET GLOBAL innodb_ft_aux_table=default;

SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database') ORDER BY FTS_DOC_ID;

SET DEBUG_SYNC= 'now SIGNAL selected';

Expand All @@ -54,7 +54,7 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET GLOBAL innodb_ft_aux_table=default;

SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database') ORDER BY FTS_DOC_ID;

connection default;

Expand Down Expand Up @@ -96,7 +96,7 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE;
SET GLOBAL innodb_ft_aux_table=default;

SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database');
SELECT * FROM t1 WHERE MATCH(title) AGAINST('mysql database') ORDER BY FTS_DOC_ID;

connection default;
disconnect con1;
Expand Down
5 changes: 4 additions & 1 deletion storage/innobase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ SET(INNOBASE_SOURCES
fts/fts0ast.cc
fts/fts0blex.cc
fts/fts0config.cc
fts/fts0exec.cc
fts/fts0opt.cc
fts/fts0pars.cc
fts/fts0que.cc
fts/fts0sql.cc
fts/fts0tlex.cc
gis/gis0geo.cc
gis/gis0rtree.cc
Expand Down Expand Up @@ -242,6 +242,7 @@ SET(INNOBASE_SOURCES
include/fsp_binlog.h
include/fts0ast.h
include/fts0blex.h
include/fts0exec.h
include/fts0fts.h
include/fts0opt.h
include/fts0pars.h
Expand Down Expand Up @@ -315,6 +316,7 @@ SET(INNOBASE_SOURCES
include/row0mysql.h
include/row0purge.h
include/row0quiesce.h
include/row0query.h
include/row0row.h
include/row0row.inl
include/row0sel.h
Expand Down Expand Up @@ -403,6 +405,7 @@ SET(INNOBASE_SOURCES
row/row0undo.cc
row/row0upd.cc
row/row0quiesce.cc
row/row0query.cc
row/row0vers.cc
srv/srv0mon.cc
srv/srv0srv.cc
Expand Down
60 changes: 36 additions & 24 deletions storage/innobase/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -612,20 +612,22 @@ dict_table_t *dict_sys_t::find_table(const span<const char> &name)
});
}

/** Acquire MDL shared for the table name.
@tparam trylock whether to use non-blocking operation
/** Acquire MDL for the table name.
By default, acquires MDL_SHARED lock. Use exclusive=true for MDL_EXCLUSIVE.
@tparam trylock whether to use non-blocking operation
@tparam exclusive MDL Exclusive lock (default: false, MDL_SHARED)
@param[in,out] table table object
@param[in,out] mdl_context MDL context
@param[out] mdl MDL ticket
@param[in] table_op operation to perform when opening
@return table object after locking MDL shared
@return table object after locking MDL
@retval nullptr if the table is not readable, or if trylock && MDL blocked */
template<bool trylock>
template<bool trylock, bool exclusive>
__attribute__((nonnull, warn_unused_result))
dict_table_t*
dict_acquire_mdl_shared(dict_table_t *table,
MDL_context *mdl_context, MDL_ticket **mdl,
dict_table_op_t table_op)
dict_acquire_mdl(dict_table_t *table,
MDL_context *mdl_context, MDL_ticket **mdl,
dict_table_op_t table_op)
{
char db_buf[NAME_LEN + 1], db_buf1[NAME_LEN + 1];
char tbl_buf[NAME_LEN + 1], tbl_buf1[NAME_LEN + 1];
Expand Down Expand Up @@ -655,7 +657,8 @@ dict_acquire_mdl_shared(dict_table_t *table,

{
MDL_request request;
MDL_REQUEST_INIT(&request,MDL_key::TABLE, db_buf, tbl_buf, MDL_SHARED,
MDL_REQUEST_INIT(&request,MDL_key::TABLE, db_buf, tbl_buf,
exclusive ? MDL_EXCLUSIVE : MDL_SHARED,
MDL_EXPLICIT);
if (trylock
? mdl_context->try_acquire_lock(&request)
Expand Down Expand Up @@ -755,23 +758,27 @@ dict_acquire_mdl_shared(dict_table_t *table,
goto retry;
}

template dict_table_t* dict_acquire_mdl_shared<false>
(dict_table_t*,MDL_context*,MDL_ticket**,dict_table_op_t);
template dict_table_t* dict_acquire_mdl<false, true>
(dict_table_t*,MDL_context*,MDL_ticket**,dict_table_op_t);
template dict_table_t* dict_acquire_mdl<false, false>
(dict_table_t*,MDL_context*,MDL_ticket**,dict_table_op_t);

/** Acquire MDL shared for the table name.
/** Acquire MDL for the table name.
By default, acquires MDL_SHARED lock. Use exclusive=true for MDL_EXCLUSIVE.
@tparam trylock whether to use non-blocking operation
@tparam exclusive Used to take MDL_EXCLUSIVE lock (default: false, MDL_SHARED)
@param[in,out] table table object
@param[in,out] thd background thread
@param[out] mdl mdl ticket
@param[in] table_op operation to perform when opening
@return table object after locking MDL shared
@return table object after locking MDL
@retval nullptr if the table is not readable, or if trylock && MDL blocked */
template<bool trylock>
template<bool trylock, bool exclusive>
dict_table_t*
dict_acquire_mdl_shared(dict_table_t *table,
THD *thd,
MDL_ticket **mdl,
dict_table_op_t table_op)
dict_acquire_mdl(dict_table_t *table,
THD *thd,
MDL_ticket **mdl,
dict_table_op_t table_op)
{
if (!table || !mdl)
return table;
Expand All @@ -793,13 +800,18 @@ dict_acquire_mdl_shared(dict_table_t *table,
if (db_len == 0)
return table; /* InnoDB system tables are not covered by MDL */

return dict_acquire_mdl_shared<trylock>(table, &thd->mdl_context, mdl, table_op);
return dict_acquire_mdl<trylock, exclusive>(
table, &thd->mdl_context, mdl, table_op);
}

template dict_table_t* dict_acquire_mdl_shared<false>
(dict_table_t*,THD*,MDL_ticket**,dict_table_op_t);
template dict_table_t* dict_acquire_mdl_shared<true>
(dict_table_t*,THD*,MDL_ticket**,dict_table_op_t);
template dict_table_t* dict_acquire_mdl<false, false>
(dict_table_t*,THD*,MDL_ticket**,dict_table_op_t);
template dict_table_t* dict_acquire_mdl<false, true>
(dict_table_t*,THD*,MDL_ticket**,dict_table_op_t);
template dict_table_t* dict_acquire_mdl<true, true>
(dict_table_t*,THD*,MDL_ticket**,dict_table_op_t);
template dict_table_t* dict_acquire_mdl<true, false>
(dict_table_t*,THD*,MDL_ticket**,dict_table_op_t);

/** Look up a table by numeric identifier.
@param[in] table_id table identifier
Expand All @@ -824,7 +836,7 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked,
{
if (thd)
{
table= dict_acquire_mdl_shared<false>(table, thd, mdl, table_op);
table= dict_acquire_mdl<false>(table, thd, mdl, table_op);
if (table)
goto acquire;
}
Expand Down Expand Up @@ -1526,7 +1538,7 @@ dict_table_rename_in_cache(

if (keep_mdl_name) {
/* Preserve the original table name for
dict_table_t::parse_name() and dict_acquire_mdl_shared(). */
dict_table_t::parse_name() and dict_acquire_mdl(). */
table->mdl_name.m_name = mem_heap_strdup(table->heap,
table->name.m_name);
}
Expand Down
Loading
Loading