summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/buf/buf0dblwr.cc7
-rw-r--r--storage/innobase/fil/fil0fil.cc3
-rw-r--r--storage/innobase/fts/fts0config.cc9
-rw-r--r--storage/innobase/fts/fts0fts.cc46
-rw-r--r--storage/innobase/fts/fts0opt.cc245
-rw-r--r--storage/innobase/fts/fts0que.cc4
-rw-r--r--storage/innobase/fts/fts0sql.cc104
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/include/fil0fil.h3
-rw-r--r--storage/innobase/include/fts0fts.h12
-rw-r--r--storage/innobase/include/fts0priv.h132
-rw-r--r--storage/innobase/row/row0ftsort.cc1
-rw-r--r--storage/innobase/row/row0merge.cc4
-rw-r--r--storage/innobase/row/row0trunc.cc4
-rw-r--r--storage/innobase/ut/ut0timer.cc34
15 files changed, 240 insertions, 372 deletions
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index 200a65ba6ef..0993b104c80 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -652,18 +652,13 @@ bad:
ulint decomp = fil_page_decompress(buf, page);
if (!decomp || (decomp != srv_page_size
&& page_size.is_compressed())) {
- goto bad_doublewrite;
+ continue;
}
if (expect_encrypted && mach_read_from_4(
page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
? !fil_space_verify_crypt_checksum(page, page_size)
: buf_page_is_corrupted(true, page, page_size, space)) {
- if (!is_all_zero) {
-bad_doublewrite:
- ib::warn() << "A doublewrite copy of page "
- << page_id << " is corrupted.";
- }
/* Theoretically we could have another good
copy for this page in the doublewrite
buffer. If not, we will report a fatal error
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 102d7e178b5..2d48fca35db 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2849,8 +2849,7 @@ but only by InnoDB table locks, which may be broken by
lock_remove_all_on_table().)
@param[in] table persistent table
checked @return whether the table is accessible */
-bool
-fil_table_accessible(const dict_table_t* table)
+bool fil_table_accessible(const dict_table_t* table)
{
if (UNIV_UNLIKELY(!table->is_readable() || table->corrupted)) {
return(false);
diff --git a/storage/innobase/fts/fts0config.cc b/storage/innobase/fts/fts0config.cc
index 7ad7459ea6a..c95689dbe98 100644
--- a/storage/innobase/fts/fts0config.cc
+++ b/storage/innobase/fts/fts0config.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, 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
@@ -215,8 +215,11 @@ fts_config_set_value(
pars_info_bind_varchar_literal(info, "value",
value->f_str, value->f_len);
+ const bool dict_locked = fts_table->table->fts->fts_status
+ & TABLE_DICT_LOCKED;
+
fts_table->suffix = "CONFIG";
- fts_get_table_name(fts_table, table_name);
+ fts_get_table_name(fts_table, table_name, dict_locked);
pars_info_bind_id(info, true, "table_name", table_name);
graph = fts_parse_sql(
@@ -244,7 +247,7 @@ fts_config_set_value(
pars_info_bind_varchar_literal(
info, "value", value->f_str, value->f_len);
- fts_get_table_name(fts_table, table_name);
+ fts_get_table_name(fts_table, table_name, dict_locked);
pars_info_bind_id(info, true, "table_name", table_name);
graph = fts_parse_sql(
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index a5e1d5eeb4c..57ee9a66c15 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -249,7 +249,6 @@ dberr_t
fts_update_sync_doc_id(
/*===================*/
const dict_table_t* table, /*!< in: table */
- const char* table_name, /*!< in: table name, or NULL */
doc_id_t doc_id, /*!< in: last document id */
trx_t* trx) /*!< in: update trx, or NULL */
MY_ATTRIBUTE((nonnull(1)));
@@ -1532,14 +1531,13 @@ fts_rename_aux_tables(
FTS_INIT_FTS_TABLE(&fts_table, NULL, FTS_COMMON_TABLE, table);
+ dberr_t err = DB_SUCCESS;
+ char old_table_name[MAX_FULL_NAME_LEN];
+
/* Rename common auxiliary tables */
for (i = 0; fts_common_tables[i] != NULL; ++i) {
- char old_table_name[MAX_FULL_NAME_LEN];
- dberr_t err = DB_SUCCESS;
-
fts_table.suffix = fts_common_tables[i];
-
- fts_get_table_name(&fts_table, old_table_name);
+ fts_get_table_name(&fts_table, old_table_name, true);
err = fts_rename_one_aux_table(new_name, old_table_name, trx);
@@ -1561,12 +1559,8 @@ fts_rename_aux_tables(
FTS_INIT_INDEX_TABLE(&fts_table, NULL, FTS_INDEX_TABLE, index);
for (ulint j = 0; j < FTS_NUM_AUX_INDEX; ++j) {
- dberr_t err;
- char old_table_name[MAX_FULL_NAME_LEN];
-
fts_table.suffix = fts_get_suffix(j);
-
- fts_get_table_name(&fts_table, old_table_name);
+ fts_get_table_name(&fts_table, old_table_name, true);
err = fts_rename_one_aux_table(
new_name, old_table_name, trx);
@@ -1605,8 +1599,7 @@ fts_drop_common_tables(
char table_name[MAX_FULL_NAME_LEN];
fts_table->suffix = fts_common_tables[i];
-
- fts_get_table_name(fts_table, table_name);
+ fts_get_table_name(fts_table, table_name, true);
err = fts_drop_table(trx, table_name);
@@ -1642,8 +1635,7 @@ fts_drop_index_split_tables(
char table_name[MAX_FULL_NAME_LEN];
fts_table.suffix = fts_get_suffix(i);
-
- fts_get_table_name(&fts_table, table_name);
+ fts_get_table_name(&fts_table, table_name, true);
err = fts_drop_table(trx, table_name);
@@ -1890,7 +1882,7 @@ fts_create_common_tables(
for (ulint i = 0; fts_common_tables[i] != NULL; ++i) {
fts_table.suffix = fts_common_tables[i];
- fts_get_table_name(&fts_table, full_name[i]);
+ fts_get_table_name(&fts_table, full_name[i], true);
dict_table_t* common_table = fts_create_one_common_table(
trx, table, full_name[i], fts_table.suffix, heap);
@@ -1915,7 +1907,7 @@ fts_create_common_tables(
info = pars_info_create();
fts_table.suffix = "CONFIG";
- fts_get_table_name(&fts_table, fts_name);
+ fts_get_table_name(&fts_table, fts_name, true);
pars_info_bind_id(info, true, "config_table", fts_name);
graph = fts_parse_sql_no_dict_lock(
@@ -1979,7 +1971,7 @@ fts_create_one_index_table(
ut_ad(index->type & DICT_FTS);
- fts_get_table_name(fts_table, table_name);
+ fts_get_table_name(fts_table, table_name, true);
new_table = fts_create_in_mem_aux_table(
table_name, fts_table->table,
@@ -2068,7 +2060,6 @@ fts_create_index_tables_low(
fts_table.type = FTS_INDEX_TABLE;
fts_table.index_id = index->id;
fts_table.table_id = table_id;
- fts_table.parent = table_name;
fts_table.table = index->table;
/* aux_idx_tables vector is used for dropping FTS AUX INDEX
@@ -2610,7 +2601,6 @@ fts_update_next_doc_id(
/*===================*/
trx_t* trx, /*!< in/out: transaction */
const dict_table_t* table, /*!< in: table */
- const char* table_name, /*!< in: table name, or NULL */
doc_id_t doc_id) /*!< in: DOC ID to set */
{
table->fts->cache->synced_doc_id = doc_id;
@@ -2619,7 +2609,7 @@ fts_update_next_doc_id(
table->fts->cache->first_doc_id = table->fts->cache->next_doc_id;
fts_update_sync_doc_id(
- table, table_name, table->fts->cache->synced_doc_id, trx);
+ table, table->fts->cache->synced_doc_id, trx);
}
@@ -2686,8 +2676,6 @@ retry:
fts_table.type = FTS_COMMON_TABLE;
fts_table.table = table;
- fts_table.parent = table->name.m_name;
-
trx = trx_allocate_for_background();
if (srv_read_only_mode) {
trx_start_internal_read_only(trx);
@@ -2752,7 +2740,7 @@ retry:
if (doc_id_cmp > *doc_id) {
error = fts_update_sync_doc_id(
- table, table->name.m_name, cache->synced_doc_id, trx);
+ table, cache->synced_doc_id, trx);
}
*doc_id = cache->next_doc_id;
@@ -2788,7 +2776,6 @@ dberr_t
fts_update_sync_doc_id(
/*===================*/
const dict_table_t* table, /*!< in: table */
- const char* table_name, /*!< in: table name, or NULL */
doc_id_t doc_id, /*!< in: last document id */
trx_t* trx) /*!< in: update trx, or NULL */
{
@@ -2810,11 +2797,6 @@ fts_update_sync_doc_id(
fts_table.table_id = table->id;
fts_table.type = FTS_COMMON_TABLE;
fts_table.table = table;
- if (table_name) {
- fts_table.parent = table_name;
- } else {
- fts_table.parent = table->name.m_name;
- }
if (!trx) {
trx = trx_allocate_for_background();
@@ -2831,7 +2813,8 @@ fts_update_sync_doc_id(
pars_info_bind_varchar_literal(info, "doc_id", id, id_len);
- fts_get_table_name(&fts_table, fts_name);
+ fts_get_table_name(&fts_table, fts_name,
+ table->fts->fts_status & TABLE_DICT_LOCKED);
pars_info_bind_id(info, true, "table_name", fts_name);
graph = fts_parse_sql(
@@ -6243,7 +6226,6 @@ fts_rename_one_aux_table_to_hex_format(
ut_a(fts_table.suffix != NULL);
- fts_table.parent = parent_table->name.m_name;
fts_table.table_id = aux_table->parent_id;
fts_table.index_id = aux_table->index_id;
fts_table.table = parent_table;
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 22efd3e27b0..2d39643f770 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -60,15 +60,6 @@ static const ulint FTS_WORD_NODES_INIT_SIZE = 64;
/** Last time we did check whether system need a sync */
static ib_time_t last_check_sync_time;
-/** State of a table within the optimization sub system. */
-enum fts_state_t {
- FTS_STATE_LOADED,
- FTS_STATE_RUNNING,
- FTS_STATE_SUSPENDED,
- FTS_STATE_DONE,
- FTS_STATE_EMPTY
-};
-
/** FTS optimize thread message types. */
enum fts_msg_type_t {
FTS_MSG_STOP, /*!< Stop optimizing and exit thread */
@@ -177,11 +168,11 @@ struct fts_encode_t {
/** We use this information to determine when to start the optimize
cycle for a table. */
struct fts_slot_t {
- dict_table_t* table; /*!< Table to optimize */
+ /** table identifier, or 0 if the slot is empty */
+ table_id_t table_id;
- table_id_t table_id; /*!< Table id */
-
- fts_state_t state; /*!< State of this slot */
+ /** whether this slot is being processed */
+ bool running;
ulint added; /*!< Number of doc ids added since the
last time this table was optimized */
@@ -1608,12 +1599,10 @@ fts_optimize_create(
optim->trx = trx_allocate_for_background();
trx_start_internal(optim->trx);
- optim->fts_common_table.parent = table->name.m_name;
optim->fts_common_table.table_id = table->id;
optim->fts_common_table.type = FTS_COMMON_TABLE;
optim->fts_common_table.table = table;
- optim->fts_index_table.parent = table->name.m_name;
optim->fts_index_table.table_id = table->id;
optim->fts_index_table.type = FTS_INDEX_TABLE;
optim->fts_index_table.table = table;
@@ -2392,31 +2381,35 @@ fts_optimize_table_bk(
fts_slot_t* slot) /*!< in: table to optimiza */
{
dberr_t error;
- dict_table_t* table = slot->table;
- fts_t* fts = table->fts;
/* Avoid optimizing tables that were optimized recently. */
if (slot->last_run > 0
&& (ut_time() - slot->last_run) < slot->interval_time) {
return(DB_SUCCESS);
+ }
- } else if (fts && fts->cache
- && fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) {
+ dict_table_t* table = dict_table_open_on_id(
+ slot->table_id, FALSE, DICT_TABLE_OP_NORMAL);
+ if (table && fil_table_accessible(table)
+ && table->fts && table->fts->cache
+ && table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) {
error = fts_optimize_table(table);
+ slot->last_run = ut_time();
+
if (error == DB_SUCCESS) {
- slot->state = FTS_STATE_DONE;
- slot->last_run = 0;
- slot->completed = ut_time();
+ slot->running = false;
+ slot->completed = slot->last_run;
}
} else {
+ /* Note time this run completed. */
+ slot->last_run = ut_time();
error = DB_SUCCESS;
}
- /* Note time this run completed. */
- slot->last_run = ut_time();
+ dict_table_close(table, FALSE, FALSE);
return(error);
}
@@ -2633,85 +2626,59 @@ fts_optimize_request_sync_table(
ib_wqueue_add(fts_optimize_wq, msg, msg->heap);
}
-/**********************************************************************//**
-Add the table to the vector if it doesn't already exist. */
-static
-ibool
-fts_optimize_new_table(
-/*===================*/
- ib_vector_t* tables, /*!< in/out: vector of tables */
- dict_table_t* table) /*!< in: table to add */
+/** Add a table to fts_slots if it doesn't already exist. */
+static bool fts_optimize_new_table(dict_table_t* table)
{
ulint i;
fts_slot_t* slot;
- ulint empty_slot = ULINT_UNDEFINED;
+ fts_slot_t* empty = NULL;
+ const table_id_t table_id = table->id;
+ ut_ad(table_id);
/* Search for duplicates, also find a free slot if one exists. */
- for (i = 0; i < ib_vector_size(tables); ++i) {
+ for (i = 0; i < ib_vector_size(fts_slots); ++i) {
- slot = static_cast<fts_slot_t*>(
- ib_vector_get(tables, i));
+ slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i));
- if (slot->state == FTS_STATE_EMPTY) {
- empty_slot = i;
- } else if (slot->table == table) {
+ if (!slot->table_id) {
+ empty = slot;
+ } else if (slot->table_id == table_id) {
/* Already exists in our optimize queue. */
- ut_ad(slot->table_id == table->id);
return(FALSE);
}
}
- /* Reuse old slot. */
- if (empty_slot != ULINT_UNDEFINED) {
-
- slot = static_cast<fts_slot_t*>(
- ib_vector_get(tables, empty_slot));
-
- ut_a(slot->state == FTS_STATE_EMPTY);
-
- } else { /* Create a new slot. */
-
- slot = static_cast<fts_slot_t*>(ib_vector_push(tables, NULL));
- }
+ slot = empty ? empty : static_cast<fts_slot_t*>(
+ ib_vector_push(fts_slots, NULL));
memset(slot, 0x0, sizeof(*slot));
- slot->table = table;
slot->table_id = table->id;
- slot->state = FTS_STATE_LOADED;
+ slot->running = false;
slot->interval_time = FTS_OPTIMIZE_INTERVAL_IN_SECS;
return(TRUE);
}
-/**********************************************************************//**
-Remove the table from the vector if it exists. */
-static
-ibool
-fts_optimize_del_table(
-/*===================*/
- ib_vector_t* tables, /*!< in/out: vector of tables */
- fts_msg_del_t* msg) /*!< in: table to delete */
+/** Remove a table from fts_slots if it exists.
+@param[in,out] table table to be removed from fts_slots */
+static bool fts_optimize_del_table(const dict_table_t* table)
{
- ulint i;
- dict_table_t* table = msg->table;
+ const table_id_t table_id = table->id;
+ ut_ad(table_id);
- for (i = 0; i < ib_vector_size(tables); ++i) {
+ for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) {
fts_slot_t* slot;
- slot = static_cast<fts_slot_t*>(ib_vector_get(tables, i));
-
- if (slot->state != FTS_STATE_EMPTY
- && slot->table == table) {
+ slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i));
+ if (slot->table_id == table_id) {
if (fts_enable_diag_print) {
ib::info() << "FTS Optimize Removing table "
<< table->name;
}
- slot->table = NULL;
- slot->state = FTS_STATE_EMPTY;
-
+ slot->table_id = 0;
return(TRUE);
}
}
@@ -2720,14 +2687,9 @@ fts_optimize_del_table(
}
/**********************************************************************//**
-Calculate how many of the registered tables need to be optimized.
+Calculate how many tables in fts_slots need to be optimized.
@return no. of tables to optimize */
-static
-ulint
-fts_optimize_how_many(
-/*==================*/
- const ib_vector_t* tables) /*!< in: registered tables
- vector*/
+static ulint fts_optimize_how_many()
{
ulint i;
ib_time_t delta;
@@ -2736,15 +2698,14 @@ fts_optimize_how_many(
current_time = ut_time();
- for (i = 0; i < ib_vector_size(tables); ++i) {
- const fts_slot_t* slot;
-
- slot = static_cast<const fts_slot_t*>(
- ib_vector_get_const(tables, i));
+ for (i = 0; i < ib_vector_size(fts_slots); ++i) {
+ const fts_slot_t* slot = static_cast<const fts_slot_t*>(
+ ib_vector_get_const(fts_slots, i));
+ if (slot->table_id == 0) {
+ continue;
+ }
- switch (slot->state) {
- case FTS_STATE_DONE:
- case FTS_STATE_LOADED:
+ if (!slot->running) {
ut_a(slot->completed <= current_time);
delta = current_time - slot->completed;
@@ -2753,9 +2714,7 @@ fts_optimize_how_many(
if (delta >= slot->interval_time) {
++n_tables;
}
- break;
-
- case FTS_STATE_RUNNING:
+ } else {
ut_a(slot->last_run <= current_time);
delta = current_time - slot->last_run;
@@ -2763,15 +2722,7 @@ fts_optimize_how_many(
if (delta > slot->interval_time) {
++n_tables;
}
- break;
-
- /* Slots in a state other than the above
- are ignored. */
- case FTS_STATE_EMPTY:
- case FTS_STATE_SUSPENDED:
- break;
}
-
}
return(n_tables);
@@ -2780,12 +2731,7 @@ fts_optimize_how_many(
/**********************************************************************//**
Check if the total memory used by all FTS table exceeds the maximum limit.
@return true if a sync is needed, false otherwise */
-static
-bool
-fts_is_sync_needed(
-/*===============*/
- const ib_vector_t* tables) /*!< in: registered tables
- vector*/
+static bool fts_is_sync_needed()
{
ulint total_memory = 0;
double time_diff = difftime(ut_time(), last_check_sync_time);
@@ -2796,17 +2742,26 @@ fts_is_sync_needed(
last_check_sync_time = ut_time();
- for (ulint i = 0; i < ib_vector_size(tables); ++i) {
- const fts_slot_t* slot;
+ for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) {
+ const fts_slot_t* slot = static_cast<const fts_slot_t*>(
+ ib_vector_get_const(fts_slots, i));
- slot = static_cast<const fts_slot_t*>(
- ib_vector_get_const(tables, i));
+ if (slot->table_id == 0) {
+ continue;
+ }
+
+ dict_table_t* table = dict_table_open_on_id(
+ slot->table_id, FALSE, DICT_TABLE_OP_NORMAL);
+ if (!table) {
+ continue;
+ }
- if (slot->state != FTS_STATE_EMPTY && slot->table
- && slot->table->fts && slot->table->fts->cache) {
- total_memory += slot->table->fts->cache->total_size;
+ if (table->fts && table->fts->cache) {
+ total_memory += table->fts->cache->total_size;
}
+ dict_table_close(table, FALSE, FALSE);
+
if (total_memory > fts_max_total_cache_size) {
return(true);
}
@@ -2817,16 +2772,12 @@ fts_is_sync_needed(
/** Sync fts cache of a table
@param[in] table_id table id */
-void
-fts_optimize_sync_table(
- table_id_t table_id)
+static void fts_optimize_sync_table(table_id_t table_id)
{
- dict_table_t* table = NULL;
-
- table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL);
-
- if (table) {
- if (dict_table_has_fts_index(table) && table->fts->cache) {
+ if (dict_table_t* table = dict_table_open_on_id(
+ table_id, FALSE, DICT_TABLE_OP_NORMAL)) {
+ if (fil_table_accessible(table)
+ && table->fts && table->fts->cache) {
fts_sync_table(table, true, false, false);
}
@@ -2866,28 +2817,18 @@ fts_optimize_thread(
&& ib_wqueue_is_empty(wq)
&& n_tables > 0
&& n_optimize > 0) {
-
- fts_slot_t* slot;
-
- ut_a(ib_vector_size(fts_slots) > 0);
-
- slot = static_cast<fts_slot_t*>(
+ fts_slot_t* slot = static_cast<fts_slot_t*>(
ib_vector_get(fts_slots, current));
/* Handle the case of empty slots. */
- if (slot->state != FTS_STATE_EMPTY) {
-
- slot->state = FTS_STATE_RUNNING;
-
+ if (slot->table_id) {
+ slot->running = true;
fts_optimize_table_bk(slot);
}
- ++current;
-
/* Wrap around the counter. */
- if (current >= ib_vector_size(fts_slots)) {
- n_optimize = fts_optimize_how_many(fts_slots);
-
+ if (++current >= ib_vector_size(fts_slots)) {
+ n_optimize = fts_optimize_how_many();
current = 0;
}
@@ -2899,7 +2840,7 @@ fts_optimize_thread(
/* Timeout ? */
if (msg == NULL) {
- if (fts_is_sync_needed(fts_slots)) {
+ if (fts_is_sync_needed()) {
fts_need_sync = true;
}
@@ -2914,17 +2855,16 @@ fts_optimize_thread(
case FTS_MSG_ADD_TABLE:
ut_a(!done);
if (fts_optimize_new_table(
- fts_slots,
- static_cast<dict_table_t*>(
- msg->ptr))) {
+ static_cast<dict_table_t*>(
+ msg->ptr))) {
++n_tables;
}
break;
case FTS_MSG_DEL_TABLE:
if (fts_optimize_del_table(
- fts_slots, static_cast<fts_msg_del_t*>(
- msg->ptr))) {
+ static_cast<fts_msg_del_t*>(
+ msg->ptr)->table)) {
--n_tables;
}
@@ -2948,33 +2888,25 @@ fts_optimize_thread(
}
mem_heap_free(msg->heap);
-
- if (!done) {
- n_optimize = fts_optimize_how_many(fts_slots);
- } else {
- n_optimize = 0;
- }
+ n_optimize = done ? 0 : fts_optimize_how_many();
}
}
/* Server is being shutdown, sync the data from FTS cache to disk
if needed */
if (n_tables > 0) {
- ulint i;
-
- for (i = 0; i < ib_vector_size(fts_slots); i++) {
- fts_slot_t* slot;
-
- slot = static_cast<fts_slot_t*>(
+ for (ulint i = 0; i < ib_vector_size(fts_slots); i++) {
+ fts_slot_t* slot = static_cast<fts_slot_t*>(
ib_vector_get(fts_slots, i));
- if (slot->state != FTS_STATE_EMPTY) {
- fts_optimize_sync_table(slot->table_id);
+ if (table_id_t table_id = slot->table_id) {
+ fts_optimize_sync_table(table_id);
}
}
}
ib_vector_free(fts_slots);
+ fts_slots = NULL;
ib::info() << "FTS optimize thread exiting.";
@@ -3022,8 +2954,7 @@ fts_optimize_init(void)
table = UT_LIST_GET_NEXT(table_LRU, table)) {
if (table->fts &&
dict_table_has_fts_index(table)) {
- if (fts_optimize_new_table(fts_slots,
- table)){
+ if (fts_optimize_new_table(table)){
table_vector.push_back(table);
}
}
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 2396a376853..64504eeecf4 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 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
@@ -3961,7 +3961,6 @@ fts_query(
query.fts_common_table.type = FTS_COMMON_TABLE;
query.fts_common_table.table_id = index->table->id;
- query.fts_common_table.parent = index->table->name.m_name;
query.fts_common_table.table = index->table;
charset = fts_index_get_charset(index);
@@ -3969,7 +3968,6 @@ fts_query(
query.fts_index_table.type = FTS_INDEX_TABLE;
query.fts_index_table.index_id = index->id;
query.fts_index_table.table_id = index->table->id;
- query.fts_index_table.parent = index->table->name.m_name;
query.fts_index_table.charset = charset;
query.fts_index_table.table = index->table;
diff --git a/storage/innobase/fts/fts0sql.cc b/storage/innobase/fts/fts0sql.cc
index ae2186c2d30..bc39b28c983 100644
--- a/storage/innobase/fts/fts0sql.cc
+++ b/storage/innobase/fts/fts0sql.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -88,69 +89,52 @@ fts_get_table_id(
return(len);
}
-/******************************************************************//**
-Construct the prefix name of an FTS table.
-@return own: table name, must be freed with ut_free() */
-char*
-fts_get_table_name_prefix(
-/*======================*/
- const fts_table_t*
- fts_table) /*!< in: Auxiliary table type */
+/** Construct the name of an internal FTS table for the given table.
+@param[in] fts_table metadata on fulltext-indexed table
+@param[in] dict_locked whether dict_sys->mutex is being held
+@return the prefix, must be freed with ut_free() */
+char* fts_get_table_name_prefix(const fts_table_t* fts_table)
{
- int len;
- const char* slash;
- char* prefix_name;
- int dbname_len = 0;
- int prefix_name_len;
char table_id[FTS_AUX_MIN_TABLE_ID_LENGTH];
-
- slash = static_cast<const char*>(
- memchr(fts_table->parent, '/', strlen(fts_table->parent)));
-
- if (slash) {
- /* Print up to and including the separator. */
- dbname_len = static_cast<int>(slash - fts_table->parent) + 1;
- }
-
- len = fts_get_table_id(fts_table, table_id);
-
- prefix_name_len = dbname_len + 4 + len + 1;
-
- prefix_name = static_cast<char*>(ut_malloc_nokey(prefix_name_len));
-
- len = sprintf(prefix_name, "%.*sFTS_%s",
- dbname_len, fts_table->parent, table_id);
-
- ut_a(len > 0);
- ut_a(len == prefix_name_len - 1);
-
- return(prefix_name);
+ const size_t table_id_len = size_t(fts_get_table_id(fts_table,
+ table_id)) + 1;
+ mutex_enter(&dict_sys->mutex);
+ /* Include the separator as well. */
+ const size_t dbname_len = fts_table->table->name.dblen() + 1;
+ ut_ad(dbname_len > 1);
+ const size_t prefix_name_len = dbname_len + 4 + table_id_len;
+ char* prefix_name = static_cast<char*>(
+ ut_malloc_nokey(prefix_name_len));
+ memcpy(prefix_name, fts_table->table->name.m_name, dbname_len);
+ mutex_exit(&dict_sys->mutex);
+ memcpy(prefix_name + dbname_len, "FTS_", 4);
+ memcpy(prefix_name + dbname_len + 4, table_id, table_id_len);
+ return prefix_name;
}
-/******************************************************************//**
-Construct the name of an ancillary FTS table for the given table.
-Caller must allocate enough memory(usually size of MAX_FULL_NAME_LEN)
-for param 'table_name'. */
-void
-fts_get_table_name(
-/*===============*/
- const fts_table_t* fts_table,
- /*!< in: Auxiliary table type */
- char* table_name)
- /*!< in/out: aux table name */
+/** Construct the name of an internal FTS table for the given table.
+@param[in] fts_table metadata on fulltext-indexed table
+@param[out] table_name a name up to MAX_FULL_NAME_LEN
+@param[in] dict_locked whether dict_sys->mutex is being held */
+void fts_get_table_name(const fts_table_t* fts_table, char* table_name,
+ bool dict_locked)
{
- int len;
- char* prefix_name;
-
- prefix_name = fts_get_table_name_prefix(fts_table);
-
- len = sprintf(table_name, "%s_%s", prefix_name, fts_table->suffix);
-
- ut_a(len > 0);
- ut_a(strlen(prefix_name) + 1 + strlen(fts_table->suffix)
- == static_cast<uint>(len));
-
- ut_free(prefix_name);
+ if (!dict_locked) {
+ mutex_enter(&dict_sys->mutex);
+ }
+ ut_ad(mutex_own(&dict_sys->mutex));
+ /* Include the separator as well. */
+ const size_t dbname_len = fts_table->table->name.dblen() + 1;
+ ut_ad(dbname_len > 1);
+ memcpy(table_name, fts_table->table->name.m_name, dbname_len);
+ if (!dict_locked) {
+ mutex_exit(&dict_sys->mutex);
+ }
+ memcpy(table_name += dbname_len, "FTS_", 4);
+ table_name += 4;
+ table_name += fts_get_table_id(fts_table, table_name);
+ *table_name++ = '_';
+ strcpy(table_name, fts_table->suffix);
}
/******************************************************************//**
@@ -205,14 +189,10 @@ fts_parse_sql_no_dict_lock(
char* str;
que_t* graph;
-#ifdef UNIV_DEBUG
ut_ad(mutex_own(&dict_sys->mutex));
-#endif
str = ut_str3cat(fts_sql_begin, sql, fts_sql_end);
- //fprintf(stderr, "%s\n", str);
-
graph = pars_sql(info, str);
ut_a(graph);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index eb6664c427a..7c9d81cdd7f 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -15101,6 +15101,10 @@ get_foreign_key_info(
LEX_STRING* referenced_key_name;
LEX_STRING* name = NULL;
+ if (dict_table_t::is_temporary_name(foreign->foreign_table_name)) {
+ return NULL;
+ }
+
ptr = dict_remove_db_name(foreign->id);
f_key_info.foreign_id = thd_make_lex_string(
thd, 0, ptr, strlen(ptr), 1);
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 0ef5e7a3364..8035b3b99b6 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -932,8 +932,7 @@ but only by InnoDB table locks, which may be broken by
lock_remove_all_on_table().)
@param[in] table persistent table
checked @return whether the table is accessible */
-bool
-fil_table_accessible(const dict_table_t* table)
+bool fil_table_accessible(const dict_table_t* table)
MY_ATTRIBUTE((warn_unused_result, nonnull));
/** Delete a tablespace and associated .ibd file.
diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h
index 82431c76b51..ef6865807eb 100644
--- a/storage/innobase/include/fts0fts.h
+++ b/storage/innobase/include/fts0fts.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2017, 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
@@ -176,7 +176,6 @@ do { \
(fts_table)->suffix = m_suffix; \
(fts_table)->type = m_type; \
(fts_table)->table_id = m_table->id; \
- (fts_table)->parent = m_table->name.m_name; \
(fts_table)->table = m_table; \
} while (0);
@@ -185,7 +184,6 @@ do { \
(fts_table)->suffix = m_suffix; \
(fts_table)->type = m_type; \
(fts_table)->table_id = m_index->table->id; \
- (fts_table)->parent = m_index->table->name.m_name; \
(fts_table)->table = m_index->table; \
(fts_table)->index_id = m_index->id; \
} while (0);
@@ -290,10 +288,6 @@ struct fts_result_t {
table id and the index id to generate the column specific FTS auxiliary
table name. */
struct fts_table_t {
- const char* parent; /*!< Parent table name, this is
- required only for the database
- name */
-
fts_table_type_t
type; /*!< The auxiliary table type */
@@ -448,8 +442,8 @@ fts_update_next_doc_id(
/*===================*/
trx_t* trx, /*!< in/out: transaction */
const dict_table_t* table, /*!< in: table */
- const char* table_name, /*!< in: table name, or NULL */
- doc_id_t doc_id); /*!< in: DOC ID to set */
+ doc_id_t doc_id) /*!< in: DOC ID to set */
+ MY_ATTRIBUTE((nonnull(2)));
/******************************************************************//**
Create a new fts_doc_ids_t.
diff --git a/storage/innobase/include/fts0priv.h b/storage/innobase/include/fts0priv.h
index 59e6311f7d4..45a50cd2938 100644
--- a/storage/innobase/include/fts0priv.h
+++ b/storage/innobase/include/fts0priv.h
@@ -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
@@ -121,8 +121,7 @@ fts_parse_sql(
fts_table_t* fts_table, /*!< in: FTS aux table */
pars_info_t* info, /*!< in: info struct, or NULL */
const char* sql) /*!< in: SQL string to evaluate */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result));
/******************************************************************//**
Evaluate a parsed SQL statement
@return DB_SUCCESS or error code */
@@ -131,19 +130,15 @@ fts_eval_sql(
/*=========*/
trx_t* trx, /*!< in: transaction */
que_t* graph) /*!< in: Parsed statement */
- MY_ATTRIBUTE((warn_unused_result));
-
-/******************************************************************//**
-Construct the name of an ancillary FTS table for the given table.
-Caller must allocate enough memory(usually size of MAX_FULL_NAME_LEN)
-for param 'table_name'. */
-void
-fts_get_table_name(
-/*===============*/
- const fts_table_t*
- fts_table, /*!< in: FTS aux table info */
- char* table_name); /*!< in/out: aux table name */
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
+/** Construct the name of an internal FTS table for the given table.
+@param[in] fts_table metadata on fulltext-indexed table
+@param[out] table_name a name up to MAX_FULL_NAME_LEN
+@param[in] dict_locked whether dict_sys->mutex is being held */
+void fts_get_table_name(const fts_table_t* fts_table, char* table_name,
+ bool dict_locked = false)
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Construct the column specification part of the SQL string for selecting the
indexed FTS columns for the given table. Adds the necessary bound
@@ -165,7 +160,7 @@ fts_get_select_columns_str(
dict_index_t* index, /*!< in: FTS index */
pars_info_t* info, /*!< in/out: parser info */
mem_heap_t* heap) /*!< in: memory heap */
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/** define for fts_doc_fetch_by_doc_id() "option" value, defines whether
we want to get Doc whose ID is equal to or greater or smaller than supplied
@@ -190,7 +185,8 @@ fts_doc_fetch_by_doc_id(
fts_sql_callback
callback, /*!< in: callback to read
records */
- void* arg); /*!< in: callback arg */
+ void* arg) /*!< in: callback arg */
+ MY_ATTRIBUTE((nonnull(6)));
/*******************************************************************//**
Callback function for fetch that stores the text of an FTS document,
@@ -200,8 +196,8 @@ ibool
fts_query_expansion_fetch_doc(
/*==========================*/
void* row, /*!< in: sel_node_t* */
- void* user_arg); /*!< in: fts_doc_t* */
-
+ void* user_arg) /*!< in: fts_doc_t* */
+ MY_ATTRIBUTE((nonnull));
/********************************************************************
Write out a single word's data as new entry/entries in the INDEX table.
@return DB_SUCCESS if all OK. */
@@ -213,7 +209,7 @@ fts_write_node(
fts_table_t* fts_table, /*!< in: the FTS aux index */
fts_string_t* word, /*!< in: word in UTF-8 */
fts_node_t* node) /*!< in: node columns */
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Check if a fts token is a stopword or less than fts_min_token_size
or greater than fts_max_token_size.
@@ -233,7 +229,8 @@ Initialize a document. */
void
fts_doc_init(
/*=========*/
- fts_doc_t* doc); /*!< in: doc to initialize */
+ fts_doc_t* doc) /*!< in: doc to initialize */
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Do a binary search for a doc id in the array
@@ -246,21 +243,21 @@ fts_bsearch(
int lower, /*!< in: lower bound of array*/
int upper, /*!< in: upper bound of array*/
doc_id_t doc_id) /*!< in: doc id to lookup */
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Free document. */
void
fts_doc_free(
/*=========*/
- fts_doc_t* doc); /*!< in: document */
-
+ fts_doc_t* doc) /*!< in: document */
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Free fts_optimizer_word_t instanace.*/
void
fts_word_free(
/*==========*/
- fts_word_t* word); /*!< in: instance to free.*/
-
+ fts_word_t* word) /*!< in: instance to free.*/
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Read the rows from the FTS inde
@return DB_SUCCESS or error code */
@@ -272,8 +269,8 @@ fts_index_fetch_nodes(
fts_table_t* fts_table, /*!< in: FTS aux table */
const fts_string_t*
word, /*!< in: the word to fetch */
- fts_fetch_t* fetch); /*!< in: fetch callback.*/
-
+ fts_fetch_t* fetch) /*!< in: fetch callback.*/
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Compare two fts_trx_table_t instances, we actually compare the
table id's here.
@@ -283,8 +280,8 @@ int
fts_trx_table_cmp(
/*==============*/
const void* v1, /*!< in: id1 */
- const void* v2); /*!< in: id2 */
-
+ const void* v2) /*!< in: id2 */
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Compare a table id with a trx_table_t table id.
@return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
@@ -293,24 +290,24 @@ int
fts_trx_table_id_cmp(
/*=================*/
const void* p1, /*!< in: id1 */
- const void* p2); /*!< in: id2 */
-
+ const void* p2) /*!< in: id2 */
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Commit a transaction.
@return DB_SUCCESS if all OK */
dberr_t
fts_sql_commit(
/*===========*/
- trx_t* trx); /*!< in: transaction */
-
+ trx_t* trx) /*!< in: transaction */
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Rollback a transaction.
@return DB_SUCCESS if all OK */
dberr_t
fts_sql_rollback(
/*=============*/
- trx_t* trx); /*!< in: transaction */
-
+ trx_t* trx) /*!< in: transaction */
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Parse an SQL string. %s is replaced with the table's id. Don't acquire
the dict mutex
@@ -321,8 +318,7 @@ fts_parse_sql_no_dict_lock(
fts_table_t* fts_table, /*!< in: table with FTS index */
pars_info_t* info, /*!< in: parser info */
const char* sql) /*!< in: SQL string to evaluate */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result));
/******************************************************************//**
Get value from config table. The caller must ensure that enough
space is allocated for value to hold the column contents
@@ -334,8 +330,9 @@ fts_config_get_value(
fts_table_t* fts_table, /*!< in: the indexed FTS table */
const char* name, /*!< in: get config value for
this parameter name */
- fts_string_t* value); /*!< out: value read from
+ fts_string_t* value) /*!< out: value read from
config table */
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Get value specific to an FTS index from the config table. The caller
must ensure that enough space is allocated for value to hold the
@@ -350,8 +347,7 @@ fts_config_get_index_value(
this parameter name */
fts_string_t* value) /*!< out: value read from
config table */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Set the value in the config table for name.
@return DB_SUCCESS or error code */
@@ -363,8 +359,8 @@ fts_config_set_value(
const char* name, /*!< in: get config value for
this parameter name */
const fts_string_t*
- value); /*!< in: value to update */
-
+ value) /*!< in: value to update */
+ MY_ATTRIBUTE((nonnull));
/****************************************************************//**
Set an ulint value in the config table.
@return DB_SUCCESS if all OK else error code */
@@ -375,8 +371,7 @@ fts_config_set_ulint(
fts_table_t* fts_table, /*!< in: the indexed FTS table */
const char* name, /*!< in: param name */
ulint int_value) /*!< in: value */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Set the value specific to an FTS index in the config table.
@return DB_SUCCESS or error code */
@@ -389,7 +384,7 @@ fts_config_set_index_value(
this parameter name */
fts_string_t* value) /*!< out: value read from
config table */
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
#ifdef FTS_OPTIMIZE_DEBUG
/******************************************************************//**
@@ -402,7 +397,7 @@ fts_config_get_index_ulint(
dict_index_t* index, /*!< in: FTS index */
const char* name, /*!< in: param name */
ulint* int_value) /*!< out: value */
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
#endif /* FTS_OPTIMIZE_DEBUG */
/******************************************************************//**
@@ -415,8 +410,7 @@ fts_config_set_index_ulint(
dict_index_t* index, /*!< in: FTS index */
const char* name, /*!< in: param name */
ulint int_value) /*!< in: value */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Get an ulint value from the config table.
@return DB_SUCCESS or error code */
@@ -426,8 +420,8 @@ fts_config_get_ulint(
trx_t* trx, /*!< in: transaction */
fts_table_t* fts_table, /*!< in: the indexed FTS table */
const char* name, /*!< in: param name */
- ulint* int_value); /*!< out: value */
-
+ ulint* int_value) /*!< out: value */
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Search cache for word.
@return the word node vector if found else NULL */
@@ -438,7 +432,7 @@ fts_cache_find_word(
index_cache, /*!< in: cache to search */
const fts_string_t*
text) /*!< in: word to search for */
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Append deleted doc ids to vector and sort the vector. */
@@ -471,8 +465,7 @@ fts_find_index_cache(
cache, /*!< in: cache to search */
const dict_index_t*
index) /*!< in: index to search for */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Write the table id to the given buffer (including final NUL). Buffer must be
at least FTS_AUX_MIN_TABLE_ID_LENGTH bytes long.
@@ -483,10 +476,10 @@ fts_write_object_id(
/*================*/
ib_id_t id, /*!< in: a table/index id */
char* str, /*!< in: buffer to write the id to */
- bool hex_format MY_ATTRIBUTE((unused)));
+ bool hex_format MY_ATTRIBUTE((unused)))
/*!< in: true for fixed hex format,
false for old ambiguous format */
-
+ MY_ATTRIBUTE((nonnull));
/******************************************************************//**
Read the table id from the string generated by fts_write_object_id().
@return TRUE if parse successful */
@@ -496,8 +489,7 @@ fts_read_object_id(
/*===============*/
ib_id_t* id, /*!< out: a table id */
const char* str) /*!< in: buffer to read from */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/******************************************************************//**
Get the table id.
@return number of bytes written */
@@ -509,18 +501,13 @@ fts_get_table_id(
char* table_id) /*!< out: table id, must be at least
FTS_AUX_MIN_TABLE_ID_LENGTH bytes
long */
- MY_ATTRIBUTE((warn_unused_result));
-
-/******************************************************************//**
-Construct the prefix name of an FTS table.
-@return own: table name, must be freed with ut_free() */
-char*
-fts_get_table_name_prefix(
-/*======================*/
- const fts_table_t*
- fts_table) /*!< in: Auxiliary table type */
- MY_ATTRIBUTE((warn_unused_result));
-
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
+/** Construct the name of an internal FTS table for the given table.
+@param[in] fts_table metadata on fulltext-indexed table
+@param[in] dict_locked whether dict_sys->mutex is being held
+@return the prefix, must be freed with ut_free() */
+char* fts_get_table_name_prefix(const fts_table_t* fts_table)
+ MY_ATTRIBUTE((nonnull, malloc, warn_unused_result));
/******************************************************************//**
Add node positions. */
void
@@ -529,7 +516,8 @@ fts_cache_node_add_positions(
fts_cache_t* cache, /*!< in: cache */
fts_node_t* node, /*!< in: word node */
doc_id_t doc_id, /*!< in: doc id */
- ib_vector_t* positions); /*!< in: fts_token_t::positions */
+ ib_vector_t* positions) /*!< in: fts_token_t::positions */
+ MY_ATTRIBUTE((nonnull(2,4)));
/******************************************************************//**
Create the config table name for retrieving index specific value.
@@ -539,7 +527,7 @@ fts_config_create_index_param_name(
/*===============================*/
const char* param, /*!< in: base name of param */
const dict_index_t* index) /*!< in: index for config */
- MY_ATTRIBUTE((warn_unused_result));
+ MY_ATTRIBUTE((nonnull, malloc, warn_unused_result));
#include "fts0priv.ic"
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index d3af57986de..4049d467961 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1655,7 +1655,6 @@ row_fts_merge_insert(
fts_table.type = FTS_INDEX_TABLE;
fts_table.index_id = index->id;
fts_table.table_id = table->id;
- fts_table.parent = index->table->name.m_name;
fts_table.table = index->table;
fts_table.suffix = fts_get_suffix(id);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index e1ef6983073..10600468e5a 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -2736,9 +2736,7 @@ wait_again:
false, true, false);
if (err == DB_SUCCESS) {
- fts_update_next_doc_id(
- 0, new_table,
- old_table->name.m_name, max_doc_id);
+ fts_update_next_doc_id(NULL, new_table, max_doc_id);
}
}
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index cffcc73f312..e7230b1f929 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 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
@@ -1531,7 +1531,7 @@ row_truncate_update_system_tables(
os_thread_sleep(10000000););
table->fts->fts_status |= TABLE_DICT_LOCKED;
- fts_update_next_doc_id(trx, table, NULL, 0);
+ fts_update_next_doc_id(trx, table, 0);
fts_cache_clear(table->fts->cache);
fts_cache_init(table->fts->cache);
table->fts->fts_status &= uint(~TABLE_DICT_LOCKED);
diff --git a/storage/innobase/ut/ut0timer.cc b/storage/innobase/ut/ut0timer.cc
index 85292cce28c..abb2326d8a5 100644
--- a/storage/innobase/ut/ut0timer.cc
+++ b/storage/innobase/ut/ut0timer.cc
@@ -46,6 +46,7 @@ Function pointer to point selected timer function.
ulonglong (*ut_timer_now)(void) = &ut_timer_none;
struct my_timer_unit_info ut_timer;
+extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info;
/**************************************************************//**
Sets up the data required for use of my_timer_* functions.
@@ -57,30 +58,27 @@ void
ut_init_timer(void)
/*===============*/
{
- MY_TIMER_INFO all_timer_info;
- my_timer_init(&all_timer_info);
-
- if (all_timer_info.cycles.frequency > 1000000 &&
- all_timer_info.cycles.resolution == 1) {
- ut_timer = all_timer_info.cycles;
+ if (sys_timer_info.cycles.frequency > 1000000 &&
+ sys_timer_info.cycles.resolution == 1) {
+ ut_timer = sys_timer_info.cycles;
ut_timer_now = &my_timer_cycles;
- } else if (all_timer_info.nanoseconds.frequency > 1000000 &&
- all_timer_info.nanoseconds.resolution == 1) {
- ut_timer = all_timer_info.nanoseconds;
+ } else if (sys_timer_info.nanoseconds.frequency > 1000000 &&
+ sys_timer_info.nanoseconds.resolution == 1) {
+ ut_timer = sys_timer_info.nanoseconds;
ut_timer_now = &my_timer_nanoseconds;
- } else if (all_timer_info.microseconds.frequency >= 1000000 &&
- all_timer_info.microseconds.resolution == 1) {
- ut_timer = all_timer_info.microseconds;
+ } else if (sys_timer_info.microseconds.frequency >= 1000000 &&
+ sys_timer_info.microseconds.resolution == 1) {
+ ut_timer = sys_timer_info.microseconds;
ut_timer_now = &my_timer_microseconds;
- } else if (all_timer_info.milliseconds.frequency >= 1000 &&
- all_timer_info.milliseconds.resolution == 1) {
- ut_timer = all_timer_info.milliseconds;
+ } else if (sys_timer_info.milliseconds.frequency >= 1000 &&
+ sys_timer_info.milliseconds.resolution == 1) {
+ ut_timer = sys_timer_info.milliseconds;
ut_timer_now = &my_timer_milliseconds;
- } else if (all_timer_info.ticks.frequency >= 1000 &&
+ } else if (sys_timer_info.ticks.frequency >= 1000 &&
/* Will probably be false */
- all_timer_info.ticks.resolution == 1) {
- ut_timer = all_timer_info.ticks;
+ sys_timer_info.ticks.resolution == 1) {
+ ut_timer = sys_timer_info.ticks;
ut_timer_now = &my_timer_ticks;
} else {
/* None are acceptable, so leave it as "None", and fill in struct */