MySQL 9.1.0
Source Code Documentation
fts0fts.cc File Reference

Full Text Search interface. More...

#include <current_thd.h>
#include <sys/types.h>
#include <new>
#include "btr0pcur.h"
#include "dict0priv.h"
#include "dict0stats.h"
#include "dict0types.h"
#include "fts0fts.h"
#include "fts0plugin.h"
#include "fts0priv.h"
#include "fts0types.h"
#include "fts0types.ic"
#include "fts0vlc.ic"
#include "ha_prototypes.h"
#include "lob0lob.h"
#include "m_string.h"
#include "my_dbug.h"
#include "mysql/strings/m_ctype.h"
#include "dict0dd.h"
#include "row0mysql.h"
#include "row0sel.h"
#include "row0upd.h"
#include "sync0sync.h"
#include "trx0roll.h"
#include "ut0new.h"

Classes

struct  fts_tokenize_param_t
 FTS tokenize parameter for plugin parser. More...
 

Macros

#define FTS_MAX_CACHE_SIZE_IN_MB   "cache_size_in_mb"
 Column name from the FTS config table. More...
 
#define FTS_IS_OBSOLETE_AUX_TABLE(table_name)
 Verify if a aux table name is a obsolete table by looking up the key word in the obsolete table names. More...
 

Functions

static dberr_t fts_sync (fts_sync_t *sync, bool unlock_cache, bool wait, bool has_dict)
 Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end. More...
 
static void fts_words_free (ib_rbt_t *words)
 Release all resources help by the words rb tree e.g., the node ilist. More...
 
static ulint fts_add_doc_by_id (fts_trx_table_t *ftt, doc_id_t doc_id, ib_vector_t *fts_indexes)
 This function fetches the document just inserted right before we commit the transaction, and tokenize the inserted text data and insert into FTS auxiliary table and its cache. More...
 
static dberr_t fts_update_sync_doc_id (const dict_table_t *table, const char *table_name, doc_id_t doc_id, trx_t *trx)
 Update the last document id. More...
 
static void fts_tokenize_document (fts_doc_t *doc, fts_doc_t *result, st_mysql_ftparser *parser)
 Tokenize a document. More...
 
static void fts_tokenize_document_next (fts_doc_t *doc, ulint add_pos, fts_doc_t *result, st_mysql_ftparser *parser)
 Continue to tokenize a document. More...
 
static ib_vector_tfts_get_docs_create (fts_cache_t *cache)
 Create the vector of fts_get_doc_t instances. More...
 
static void fts_cache_destroy (fts_cache_t *cache)
 Free the FTS cache. More...
 
static CHARSET_INFOfts_get_charset (ulint prtype)
 Get a character set based on precise type. More...
 
static void fts_load_default_stopword (fts_stopword_t *stopword_info)
 This function loads the default InnoDB stopword list. More...
 
static bool fts_read_stopword (void *row, void *user_arg)
 Callback function to read a single stopword value. More...
 
static bool fts_load_user_stopword (const char *stopword_table_name, fts_stopword_t *stopword_info)
 Load user defined stopword from designated user table. More...
 
static void fts_index_cache_init (ib_alloc_t *allocator, fts_index_cache_t *index_cache)
 Initialize the index cache. More...
 
void fts_cache_init (fts_cache_t *cache)
 Initialize FTS cache. More...
 
fts_cache_tfts_cache_create (dict_table_t *table)
 Create a FTS cache. More...
 
void fts_add_index (dict_index_t *index, dict_table_t *table)
 Add a newly create index into FTS cache. More...
 
static void fts_reset_get_doc (fts_cache_t *cache)
 recalibrate get_doc structure after index_cache in cache->indexes changed More...
 
static bool fts_in_dict_index (dict_table_t *table, dict_index_t *index_check)
 Check an index is in the table->indexes list. More...
 
static bool fts_in_index_cache (dict_table_t *table, dict_index_t *index)
 Check an index is in the fts->cache->indexes list. More...
 
bool fts_check_cached_index (dict_table_t *table)
 Check indexes in the fts->indexes is also present in index cache and table->indexes list. More...
 
dberr_t fts_drop_index (dict_table_t *table, dict_index_t *index, trx_t *trx, aux_name_vec_t *aux_vec, bool adding_another)
 Drop auxiliary tables related to an FTS index. More...
 
CHARSET_INFOfts_index_get_charset (dict_index_t *index)
 Create an FTS index cache. More...
 
fts_index_cache_tfts_cache_index_cache_create (dict_table_t *table, dict_index_t *index)
 Create an FTS index cache. More...
 
void fts_cache_index_cache_remove (dict_table_t *table, dict_index_t *index)
 Remove a FTS index cache. More...
 
void fts_cache_clear (fts_cache_t *cache)
 Clear cache. More...
 
static fts_index_cache_tfts_get_index_cache (fts_cache_t *cache, const dict_index_t *index)
 Search the index specific cache for a particular FTS index. More...
 
static fts_tokenizer_word_tfts_tokenizer_word_get (fts_cache_t *cache, fts_index_cache_t *index_cache, fts_string_t *text)
 Find an existing word, or if not found, create one and return it. More...
 
void fts_cache_node_add_positions (fts_cache_t *cache, fts_node_t *node, doc_id_t doc_id, ib_vector_t *positions)
 Add the given doc_id/word positions to the given node's ilist. More...
 
static void fts_cache_add_doc (fts_cache_t *cache, fts_index_cache_t *index_cache, doc_id_t doc_id, ib_rbt_t *tokens)
 Add document to the cache. More...
 
bool fts_drop_dd_tables (const aux_name_vec_t *aux_vec, bool file_per_table)
 Drop FTS AUX table DD table objects in vector. More...
 
void fts_free_aux_names (aux_name_vec_t *aux_vec)
 Free FTS AUX table names in vector. More...
 
static dberr_t fts_drop_table (trx_t *trx, const char *table_name, aux_name_vec_t *aux_vec)
 Drops a table. More...
 
static dberr_t fts_rename_one_aux_table (const char *new_name, const char *fts_table_old_name, trx_t *trx, bool replay)
 Rename a single auxiliary table due to database name change. More...
 
dberr_t fts_rename_aux_tables (dict_table_t *table, const char *new_name, trx_t *trx, bool replay)
 Rename auxiliary tables for all fts index for a table. More...
 
static dberr_t fts_drop_common_tables (trx_t *trx, fts_table_t *fts_table, aux_name_vec_t *aux_vec)
 Drops the common ancillary tables needed for supporting an FTS index on the given table. More...
 
dberr_t fts_drop_index_tables (trx_t *trx, dict_index_t *index, aux_name_vec_t *aux_vec)
 Since we do a horizontal split on the index table, we need to drop all the split tables. More...
 
static dberr_t fts_init_config_table (fts_table_t *fts_table)
 Write the default settings to the config table. More...
 
static dberr_t fts_empty_table (trx_t *trx, fts_table_t *fts_table)
 Empty a common talbes. More...
 
dberr_t fts_empty_common_tables (trx_t *trx, dict_table_t *table)
 Empty all common talbes. More...
 
static dberr_t fts_drop_all_index_tables (trx_t *trx, fts_t *fts, aux_name_vec_t *aux_vec)
 Drops FTS ancillary tables needed for supporting an FTS index on the given table. More...
 
dberr_t fts_drop_tables (trx_t *trx, dict_table_t *table, aux_name_vec_t *aux_vec)
 Drops the ancillary tables needed for supporting an FTS index on a given table. More...
 
static dberr_t fts_lock_common_tables (THD *thd, fts_table_t *fts_table)
 Lock all FTS AUX COMMON tables (for dropping table) More...
 
dberr_t fts_lock_index_tables (THD *thd, dict_index_t *index)
 Lock all FTS INDEX AUX tables (for dropping table) More...
 
static dberr_t fts_lock_all_index_tables (THD *thd, fts_t *fts)
 Lock all FTS index AUX tables (for dropping table) More...
 
dberr_t fts_lock_all_aux_tables (THD *thd, dict_table_t *table)
 Lock all FTS AUX tables (for dropping table) More...
 
static uint32_t fts_get_table_flags2_for_aux_tables (uint32_t flags2)
 Extract only the required flags from table->flags2 for FTS Aux tables. More...
 
static dict_table_tfts_create_in_mem_aux_table (const char *aux_table_name, const dict_table_t *table, ulint n_cols)
 Create dict_table_t object for FTS Aux tables. More...
 
static dict_table_tfts_create_one_common_table (trx_t *trx, const dict_table_t *table, const char *fts_table_name, const char *fts_suffix, mem_heap_t *heap)
 Function to create on FTS common table. More...
 
bool fts_check_common_tables_exist (const dict_table_t *table)
 Check if common tables already exist. More...
 
dberr_t fts_create_common_tables (trx_t *trx, const dict_table_t *table, const char *name, bool skip_doc_id_index)
 Creates the common auxiliary tables needed for supporting an FTS index on the given table. More...
 
static dict_table_tfts_create_one_index_table (trx_t *trx, const dict_index_t *index, fts_table_t *fts_table, mem_heap_t *heap)
 Creates one FTS auxiliary index table for an FTS index. More...
 
void fts_freeze_aux_tables (const dict_table_t *table)
 Freeze all auiliary tables to be not evictable if exist, with dict_mutex held. More...
 
void fts_detach_aux_tables (const dict_table_t *table, bool dict_locked)
 Allow all the auxiliary tables of specified base table to be evictable if they exist, if not exist just ignore. More...
 
bool fts_create_common_dd_tables (const dict_table_t *table)
 Update DD system table for auxiliary common tables for an FTS index. More...
 
static dberr_t fts_create_one_index_dd_tables (const dict_index_t *index)
 Update DD system table for auxiliary index tables for an FTS index. More...
 
dberr_t fts_create_index_dd_tables (dict_table_t *table)
 Check if a table has FTS index needs to have its auxiliary index tables' metadata updated in DD. More...
 
dberr_t fts_create_index_tables_low (trx_t *trx, dict_index_t *index, const char *table_name, table_id_t table_id)
 Create auxiliary index tables for an FTS index. More...
 
dberr_t fts_create_index_tables (trx_t *trx, dict_index_t *index)
 Creates the column specific ancillary tables needed for supporting an FTS index on the given table. More...
 
static fts_row_state fts_trx_row_get_new_state (fts_row_state old_state, fts_row_state event)
 Calculate the new state of a row given the existing state and a new event. More...
 
static fts_savepoint_tfts_savepoint_create (ib_vector_t *savepoints, const char *name, mem_heap_t *heap)
 Create a savepoint instance. More...
 
fts_trx_tfts_trx_create (trx_t *trx)
 Create an FTS trx. More...
 
static fts_trx_table_tfts_trx_table_create (fts_trx_t *fts_trx, dict_table_t *table)
 Create an FTS trx table. More...
 
static fts_trx_table_tfts_trx_table_clone (const fts_trx_table_t *ftt_src)
 Clone an FTS trx table. More...
 
static fts_trx_table_tfts_trx_init (trx_t *trx, dict_table_t *table, ib_vector_t *savepoints)
 Initialize the FTS trx instance. More...
 
static void fts_trx_table_add_op (fts_trx_table_t *ftt, doc_id_t doc_id, fts_row_state state, ib_vector_t *fts_indexes)
 Notify the FTS system about an operation on an FTS-indexed table. More...
 
void fts_trx_add_op (trx_t *trx, dict_table_t *table, doc_id_t doc_id, fts_row_state state, ib_vector_t *fts_indexes)
 Notify the FTS system about an operation on an FTS-indexed table. More...
 
static bool fts_fetch_store_doc_id (void *row, void *user_arg)
 Fetch callback that converts a textual document id to a binary value and stores it in the given place. More...
 
void fts_update_next_doc_id (trx_t *trx, const dict_table_t *table, const char *table_name, doc_id_t doc_id)
 Update the next and last Doc ID in the CONFIG table to be the input "doc_id" value (+ 1). More...
 
dberr_t fts_get_next_doc_id (const dict_table_t *table, doc_id_t *doc_id)
 Get the next available document id. More...
 
static dberr_t fts_cmp_set_sync_doc_id (const dict_table_t *table, doc_id_t doc_id_cmp, bool read_only, doc_id_t *doc_id, trx_t *trx=nullptr)
 This function fetch the Doc ID from CONFIG table, and compare with the Doc ID supplied. More...
 
fts_doc_ids_tfts_doc_ids_create (void)
 Create a new fts_doc_ids_t. More...
 
void fts_doc_ids_free (fts_doc_ids_t *fts_doc_ids)
 Free a fts_doc_ids_t. More...
 
static void fts_add (fts_trx_table_t *ftt, fts_trx_row_t *row)
 Do commit-phase steps necessary for the insertion of a new row. More...
 
static dberr_t fts_delete (fts_trx_table_t *ftt, fts_trx_row_t *row)
 Do commit-phase steps necessary for the deletion of a row. More...
 
static dberr_t fts_modify (fts_trx_table_t *ftt, fts_trx_row_t *row)
 Do commit-phase steps necessary for the modification of a row. More...
 
dberr_t fts_create_doc_id (dict_table_t *table, dtuple_t *row, mem_heap_t *heap)
 Create a new document id. More...
 
static dberr_t fts_commit_table (fts_trx_table_t *ftt)
 The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. More...
 
dberr_t fts_commit (trx_t *trx)
 The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. More...
 
void fts_doc_init (fts_doc_t *doc)
 Initialize a document. More...
 
void fts_doc_free (fts_doc_t *doc)
 Free document. More...
 
bool fts_query_expansion_fetch_doc (void *row, void *user_arg)
 Callback function for fetch that stores the text of an FTS document, converting each column to UTF-16. More...
 
static void fts_fetch_doc_from_rec (fts_get_doc_t *get_doc, dict_index_t *clust_index, btr_pcur_t *pcur, ulint *offsets, fts_doc_t *doc)
 fetch and tokenize the document. More...
 
static void fts_fetch_doc_from_tuple (fts_get_doc_t *get_doc, const dtuple_t *tuple, fts_doc_t *doc)
 Fetch the data from tuple and tokenize the document. More...
 
void fts_add_doc_from_tuple (fts_trx_table_t *ftt, doc_id_t doc_id, const dtuple_t *tuple)
 Fetch the document from tuple, tokenize the text data and insert the text data into fts auxiliary table and its cache. More...
 
static bool fts_read_ulint (void *row, void *user_arg)
 Callback function to read a single ulint column. More...
 
doc_id_t fts_get_max_doc_id (dict_table_t *table)
 Get maximum Doc ID in a table if index "FTS_DOC_ID_INDEX" exists. More...
 
dberr_t fts_doc_fetch_by_doc_id (fts_get_doc_t *get_doc, doc_id_t doc_id, dict_index_t *index_to_use, ulint option, fts_sql_callback callback, void *arg)
 Fetch document with the given document id. More...
 
dberr_t fts_write_node (trx_t *trx, que_t **graph, fts_table_t *fts_table, fts_string_t *word, fts_node_t *node)
 Write out a single word's data as new entry/entries in the INDEX table. More...
 
static dberr_t fts_sync_add_deleted_cache (fts_sync_t *sync, ib_vector_t *doc_ids)
 Add rows to the DELETED_CACHE table. More...
 
static dberr_t fts_sync_write_words (trx_t *trx, fts_index_cache_t *index_cache, bool unlock_cache, std::chrono::steady_clock::time_point sync_start_time)
 Write the words and ilist to disk. More...
 
static void fts_sync_begin (fts_sync_t *sync)
 Begin Sync, create transaction, acquire locks, etc. More...
 
static dberr_t fts_sync_index (fts_sync_t *sync, fts_index_cache_t *index_cache)
 Run SYNC on the table, i.e., write out data from the index specific cache to the FTS aux INDEX table and FTS aux doc id stats table. More...
 
static bool fts_sync_index_check (fts_index_cache_t *index_cache)
 Check if index cache has been synced completely. More...
 
static void fts_sync_index_reset (fts_index_cache_t *index_cache)
 Reset synced flag in index cache when rollback. More...
 
static dberr_t fts_sync_commit (fts_sync_t *sync)
 Commit the SYNC, change state of processed doc ids etc. More...
 
static void fts_sync_rollback (fts_sync_t *sync)
 Rollback a sync operation. More...
 
dberr_t fts_sync_table (dict_table_t *table, bool unlock_cache, bool wait, bool has_dict)
 Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end. More...
 
bool fts_check_token (const fts_string_t *token, const ib_rbt_t *stopwords, bool is_ngram, const CHARSET_INFO *cs)
 Check fts token. More...
 
static void fts_add_token (fts_doc_t *result_doc, fts_string_t str, ulint position)
 Add the token and its start position to the token's list of positions. More...
 
static ulint fts_process_token (fts_doc_t *doc, fts_doc_t *result, ulint start_pos, ulint add_pos)
 Process next token from document starting at the given position, i.e., add the token's start position to the token's list of positions. More...
 
ulint fts_get_token_size (const CHARSET_INFO *cs, const char *token, ulint len)
 Get token char size by charset. More...
 
int fts_tokenize_document_internal (MYSQL_FTPARSER_PARAM *param, char *doc, int len)
 FTS plugin parser 'myql_parser' callback function for document tokenize. More...
 
static int fts_tokenize_add_word_for_parser (MYSQL_FTPARSER_PARAM *param, char *word, int word_len, MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info)
 FTS plugin parser 'myql_add_word' callback function for document tokenize. More...
 
static void fts_tokenize_by_parser (fts_doc_t *doc, st_mysql_ftparser *parser, fts_tokenize_param_t *fts_param)
 Parse a document using an external / user supplied parser. More...
 
static void fts_get_docs_clear (ib_vector_t *get_docs)
 
doc_id_t fts_init_doc_id (const dict_table_t *table)
 Get the initial Doc ID by consulting the CONFIG table. More...
 
ulint fts_get_rows_count (fts_table_t *fts_table)
 Fetch COUNT(*) from specified table. More...
 
static void fts_trx_table_rows_free (ib_rbt_t *rows)
 Free the modified rows of a table. More...
 
static void fts_savepoint_free (fts_savepoint_t *savepoint)
 Free an FTS savepoint instance. More...
 
void fts_trx_free (fts_trx_t *fts_trx)
 Free an FTS trx. More...
 
doc_id_t fts_get_doc_id_from_row (dict_table_t *table, dtuple_t *row)
 Extract the doc id from the FTS hidden column. More...
 
doc_id_t fts_get_doc_id_from_rec (dict_table_t *table, const rec_t *rec, const dict_index_t *index, mem_heap_t *heap)
 Extract the doc id from the record that belongs to index. More...
 
fts_index_cache_tfts_find_index_cache (const fts_cache_t *cache, const dict_index_t *index)
 Search the index specific cache for a particular FTS index. More...
 
const ib_vector_tfts_cache_find_word (const fts_index_cache_t *index_cache, const fts_string_t *text)
 Search cache for word. More...
 
void fts_cache_append_deleted_doc_ids (const fts_cache_t *cache, ib_vector_t *vector)
 Append deleted doc ids to vector. More...
 
bool fts_wait_for_background_thread_to_start (dict_table_t *table, std::chrono::microseconds max_wait)
 Wait for the background thread to start. More...
 
void fts_add_doc_id_column (dict_table_t *table, mem_heap_t *heap)
 Add the FTS document id hidden column. More...
 
doc_id_t fts_update_doc_id (dict_table_t *table, upd_field_t *ufield, doc_id_t *next_doc_id)
 Add new fts doc id to the update vector. More...
 
fts_tfts_create (dict_table_t *table)
 Create an instance of fts_t. More...
 
void fts_free (dict_table_t *table)
 Free the FTS resources. More...
 
static void fts_savepoint_copy (const fts_savepoint_t *src, fts_savepoint_t *dst)
 Take a FTS savepoint. More...
 
void fts_savepoint_take (fts_trx_t *fts_trx, const char *name)
 Take a FTS savepoint. More...
 
static ulint fts_savepoint_lookup (ib_vector_t *savepoints, const char *name)
 Lookup a savepoint instance by name. More...
 
void fts_savepoint_release (trx_t *trx, const char *name)
 Release the savepoint data identified by name. More...
 
void fts_savepoint_laststmt_refresh (trx_t *trx)
 Refresh last statement savepoint. More...
 
static void fts_undo_last_stmt (fts_trx_table_t *s_ftt, fts_trx_table_t *l_ftt)
 
void fts_savepoint_rollback_last_stmt (trx_t *trx)
 Rollback to savepoint identified by name. More...
 
void fts_savepoint_rollback (trx_t *trx, const char *name)
 Rollback to savepoint identified by name. More...
 
bool fts_is_aux_table_name (fts_aux_table_t *table, const char *name, ulint len)
 Check if a table is an FTS auxiliary table name. More...
 
CHARSET_INFOfts_valid_stopword_table (const char *stopword_table_name)
 Check whether user supplied stopword table is of the right format. More...
 
bool fts_load_stopword (const dict_table_t *table, trx_t *trx, const char *global_stopword_table, const char *session_stopword_table, bool stopword_is_on, bool reload)
 This function loads the stopword into the FTS cache. More...
 
static bool fts_init_get_doc_id (void *row, void *user_arg)
 Callback function when we initialize the FTS at the start up time. More...
 
static bool fts_init_recover_doc (void *row, void *user_arg)
 Callback function when we initialize the FTS at the start up time. More...
 
bool fts_init_index (dict_table_t *table, bool has_cache_lock)
 This function brings FTS index in sync when FTS index is first used. More...
 
static dict_table_tfts_upgrade_rename_aux_table_low (const char *old_name, const char *new_name)
 Rename old FTS common and aux tables with the new table_id. More...
 
static void fts_upgrade_rename_aux_table (const char *old_name, const char *new_name, bool rollback)
 Rename old FTS common and aux tables with the new table_id. More...
 
table_id_t fts_upgrade_get_5_7_table_id (table_id_t table_id)
 During upgrade, tables are moved by DICT_MAX_DD_TABLES offset, remove this offset to get 5.7 fts aux table names. More...
 
dberr_t fts_upgrade_aux_tables (dict_table_t *table)
 Upgrade FTS AUX Tables. More...
 
dberr_t fts_upgrade_rename (const dict_table_t *table, bool rollback)
 Rename FTS AUX tablespace name from 8.0 format to 5.7 format. More...
 

Variables

static const ulint FTS_MAX_ID_LEN = 32
 
ulong fts_max_cache_size
 This is maximum FTS cache for each table and would be a configurable variable. More...
 
bool fts_need_sync = false
 Whether the total memory used for FTS cache is exhausted, and we will need a sync to free some memory. More...
 
ulong fts_max_total_cache_size
 Variable specifying the total memory allocated for FTS cache. More...
 
ulong fts_result_cache_limit
 This is FTS result cache limit for each query and would be a configurable variable. More...
 
ulong fts_max_token_size
 Variable specifying the maximum FTS max token size. More...
 
ulong fts_min_token_size
 Variable specifying the minimum FTS max token size. More...
 
static std::chrono::steady_clock::duration elapsed_time
 
static ulint n_nodes = 0
 
static constexpr uint32_t FTS_DEADLOCK_RETRY_WAIT_MS = 100
 Time to sleep after DEADLOCK error before retrying operation in milliseconds. More...
 
char * fts_internal_tbl_name = nullptr
 variable to record innodb_fts_internal_tbl_name for information schema table INNODB_FTS_INSERTED etc. More...
 
const char * fts_default_stopword []
 InnoDB default stopword list: There are different versions of stopwords, the stop words listed below comes from "Google Stopword" list. More...
 
const char * FTS_PREFIX = "fts_"
 FTS auxiliary table prefix that are common to all FT indexes. More...
 
const char * FTS_PREFIX_5_7 = "FTS_"
 FTS auxiliary table prefix that are common to all FT indexes. More...
 
const char * fts_common_tables []
 FTS auxiliary table suffixes that are common to all FT indexes. More...
 
const char * FTS_SUFFIX_BEING_DELETED = fts_common_tables[0]
 
const char * FTS_SUFFIX_BEING_DELETED_CACHE = fts_common_tables[1]
 
const char * FTS_SUFFIX_CONFIG = fts_common_tables[2]
 
const char * FTS_SUFFIX_DELETED = fts_common_tables[3]
 
const char * FTS_SUFFIX_DELETED_CACHE = fts_common_tables[4]
 
const char * fts_common_tables_5_7 []
 FTS auxiliary table suffixes that are common to all FT indexes. More...
 
const char * FTS_SUFFIX_CONFIG_5_7 = fts_common_tables_5_7[2]
 
const fts_index_selector_t fts_index_selector []
 FTS auxiliary INDEX split intervals. More...
 
const fts_index_selector_t fts_index_selector_5_7 []
 FTS auxiliary INDEX split intervals. More...
 
static const char * fts_config_table_insert_values_sql
 Default config values for FTS indexes on a table. More...
 

Detailed Description

Full Text Search interface.

Macro Definition Documentation

◆ FTS_IS_OBSOLETE_AUX_TABLE

#define FTS_IS_OBSOLETE_AUX_TABLE (   table_name)
Value:
(strstr((table_name), "DOC_ID") != NULL || \
strstr((table_name), "ADDED") != NULL || \
strstr((table_name), "STOPWORDS") != NULL)
const char * table_name
Definition: rules_table_service.cc:56
#define NULL
Definition: types.h:55

Verify if a aux table name is a obsolete table by looking up the key word in the obsolete table names.

◆ FTS_MAX_CACHE_SIZE_IN_MB

#define FTS_MAX_CACHE_SIZE_IN_MB   "cache_size_in_mb"

Column name from the FTS config table.

Function Documentation

◆ fts_add()

static void fts_add ( fts_trx_table_t ftt,
fts_trx_row_t row 
)
static

Do commit-phase steps necessary for the insertion of a new row.

Parameters
[in]fttFTS transaction table
[in]rowrow to be inserted in index

◆ fts_add_doc_by_id()

static ulint fts_add_doc_by_id ( fts_trx_table_t ftt,
doc_id_t  doc_id,
ib_vector_t fts_indexes 
)
static

This function fetches the document just inserted right before we commit the transaction, and tokenize the inserted text data and insert into FTS auxiliary table and its cache.

Parameters
[in]fttFTS transaction table
[in]doc_iddoc id
[in]fts_indexesaffected FTS indexes
Returns
true if successful

◆ fts_add_doc_from_tuple()

void fts_add_doc_from_tuple ( fts_trx_table_t ftt,
doc_id_t  doc_id,
const dtuple_t tuple 
)

Fetch the document from tuple, tokenize the text data and insert the text data into fts auxiliary table and its cache.

Moreover this tuple fields doesn't contain any information about externally stored field. This tuple contains data directly converted from mysql.

Parameters
[in]fttFTS transaction table
[in]doc_iddoc id
[in]tupletuple from where data can be retrieved and tuple should be arranged in table schema order.

◆ fts_add_doc_id_column()

void fts_add_doc_id_column ( dict_table_t table,
mem_heap_t heap 
)

Add the FTS document id hidden column.

Parameters
[in,out]tableTable with FTS index
[in]heapTemporary memory heap, or NULL

◆ fts_add_index()

void fts_add_index ( dict_index_t index,
dict_table_t table 
)

Add a newly create index into FTS cache.

Add a newly create index in FTS cache.

Parameters
indexFTS index to be added
tabletable

◆ fts_add_token()

static void fts_add_token ( fts_doc_t result_doc,
fts_string_t  str,
ulint  position 
)
static

Add the token and its start position to the token's list of positions.

Parameters
[in,out]result_docresult doc rb tree
[in]strtoken string
[in]positiontoken position

◆ fts_cache_add_doc()

static void fts_cache_add_doc ( fts_cache_t cache,
fts_index_cache_t index_cache,
doc_id_t  doc_id,
ib_rbt_t tokens 
)
static

Add document to the cache.

Parameters
cachein: cache
index_cachein: index cache
doc_idin: doc id to add
tokensin: document tokens

◆ fts_cache_append_deleted_doc_ids()

void fts_cache_append_deleted_doc_ids ( const fts_cache_t cache,
ib_vector_t vector 
)

Append deleted doc ids to vector.

Append deleted doc ids to vector and sort the vector.

Parameters
cachein: cache to use
vectorin: append to this vector

◆ fts_cache_clear()

void fts_cache_clear ( fts_cache_t cache)

Clear cache.

Parameters
[in,out]cachefts cache

◆ fts_cache_create()

fts_cache_t * fts_cache_create ( dict_table_t table)

Create a FTS cache.

table owns the FTS cache

Parameters
tablein: table owns the FTS cache

◆ fts_cache_destroy()

static void fts_cache_destroy ( fts_cache_t cache)
static

Free the FTS cache.

Parameters
[in,out]cacheto be freed

◆ fts_cache_find_word()

const ib_vector_t * fts_cache_find_word ( const fts_index_cache_t index_cache,
const fts_string_t text 
)

Search cache for word.

Returns
the word node vector if found else NULL
Parameters
index_cachein: cache to search
textin: word to search for

◆ fts_cache_index_cache_create()

fts_index_cache_t * fts_cache_index_cache_create ( dict_table_t table,
dict_index_t index 
)

Create an FTS index cache.

Create a FTS index cache.

Returns
Index Cache
Parameters
tablein: table with FTS index
indexin: FTS index

◆ fts_cache_index_cache_remove()

void fts_cache_index_cache_remove ( dict_table_t table,
dict_index_t index 
)

Remove a FTS index cache.

Parameters
[in]tabletable with FTS index
[in]indexFTS index

◆ fts_cache_init()

void fts_cache_init ( fts_cache_t cache)

Initialize FTS cache.

Initialize things in cache.

Parameters
cachein: cache to initialize

◆ fts_cache_node_add_positions()

void fts_cache_node_add_positions ( fts_cache_t cache,
fts_node_t node,
doc_id_t  doc_id,
ib_vector_t positions 
)

Add the given doc_id/word positions to the given node's ilist.

Add node positions.

Parameters
cachein: cache
nodein: word node
doc_idin: doc id
positionsin: fts_token_t::positions

◆ fts_check_cached_index()

bool fts_check_cached_index ( dict_table_t table)

Check indexes in the fts->indexes is also present in index cache and table->indexes list.

Returns
true if all indexes match
Parameters
tablein: Table where indexes are dropped

◆ fts_check_common_tables_exist()

bool fts_check_common_tables_exist ( const dict_table_t table)

Check if common tables already exist.

Parameters
[in]tabletable with fts index
Returns
true on success, false on failure

◆ fts_check_token()

bool fts_check_token ( const fts_string_t token,
const ib_rbt_t stopwords,
bool  is_ngram,
const CHARSET_INFO cs 
)

Check fts token.

  1. for ngram token, check whether the token contains any words in stopwords
  2. for non-ngram token, check if it's stopword or less than fts_min_token_size or greater than fts_max_token_size.
    Parameters
    [in]tokentoken string
    [in]stopwordsstopwords rb tree
    [in]is_ngramis ngram parser
    [in]cstoken charset
    Return values
    trueif it is not stopword and length in range
    falseif it is stopword or length not in range

◆ fts_cmp_set_sync_doc_id()

static dberr_t fts_cmp_set_sync_doc_id ( const dict_table_t table,
doc_id_t  doc_id_cmp,
bool  read_only,
doc_id_t doc_id,
trx_t trx = nullptr 
)
static

This function fetch the Doc ID from CONFIG table, and compare with the Doc ID supplied.

And store the larger one to the CONFIG table.

Returns
DB_SUCCESS if OK
Parameters
tablein: table
doc_id_cmpin: Doc ID to compare
read_onlyin: true if read the synced_doc_id only
doc_idout: larger document id after comparing "doc_id_cmp" to the one stored in CONFIG table
trxin: transaction in which the doc_id is retrieved and stored

◆ fts_commit()

dberr_t fts_commit ( trx_t trx)

The given transaction is about to be committed; do whatever is necessary from the FTS system's POV.

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction

◆ fts_commit_table()

static dberr_t fts_commit_table ( fts_trx_table_t ftt)
static

The given transaction is about to be committed; do whatever is necessary from the FTS system's POV.

Returns
DB_SUCCESS or error code
Parameters
fttin: FTS table to commit

◆ fts_create()

fts_t * fts_create ( dict_table_t table)

Create an instance of fts_t.

Returns
instance of fts_t
Parameters
tablein/out: table with FTS indexes

◆ fts_create_common_dd_tables()

bool fts_create_common_dd_tables ( const dict_table_t table)

Update DD system table for auxiliary common tables for an FTS index.

Parameters
[in]tabledict table instance
Returns
true on success, false on failure

◆ fts_create_common_tables()

dberr_t fts_create_common_tables ( trx_t trx,
const dict_table_t table,
const char *  name,
bool  skip_doc_id_index 
)

Creates the common auxiliary tables needed for supporting an FTS index on the given table.

row_mysql_lock_data_dictionary must have been called before this. The following tables are created. CREATE TABLE $FTS_PREFIX_DELETED (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_DELETED_CACHE (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_BEING_DELETED (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_BEING_DELETED_CACHE (doc_id BIGINT UNSIGNED, UNIQUE CLUSTERED INDEX on doc_id) CREATE TABLE $FTS_PREFIX_CONFIG (key CHAR(50), value CHAR(200), UNIQUE CLUSTERED INDEX on key)

Parameters
[in,out]trxtransaction
[in]tabletable with FTS index
[in]nametable name normalized
[in]skip_doc_id_indexSkip index on doc id
Returns
DB_SUCCESS if succeed

◆ fts_create_doc_id()

dberr_t fts_create_doc_id ( dict_table_t table,
dtuple_t row,
mem_heap_t heap 
)

Create a new document id.

Parameters
[in]tableRow is of this table.
[in,out]rowAdd doc id value to this row. This is the current row that is being inserted.
[in]heapMemory heap on which the doc_id object will be created.
Returns
DB_SUCCESS if all went well else error

◆ fts_create_in_mem_aux_table()

static dict_table_t * fts_create_in_mem_aux_table ( const char *  aux_table_name,
const dict_table_t table,
ulint  n_cols 
)
static

Create dict_table_t object for FTS Aux tables.

Parameters
[in]aux_table_nameFTS Aux table name
[in]tabletable object of FTS Index
[in]n_colsnumber of columns for FTS Aux table
Returns
table object for FTS Aux table

◆ fts_create_index_dd_tables()

dberr_t fts_create_index_dd_tables ( dict_table_t table)

Check if a table has FTS index needs to have its auxiliary index tables' metadata updated in DD.

Parameters
[in,out]tabletable to check
Returns
DB_SUCCESS or error code

◆ fts_create_index_tables()

dberr_t fts_create_index_tables ( trx_t trx,
dict_index_t index 
)

Creates the column specific ancillary tables needed for supporting an FTS index on the given table.

row_mysql_lock_data_dictionary must have been called before this.

All FTS AUX Index tables have the following schema. CREATE TABLE $FTS_PREFIX_INDEX_[1-6]( word VARCHAR(FTS_MAX_WORD_LEN), first_doc_id INT NOT NULL, last_doc_id UNSIGNED NOT NULL, doc_count UNSIGNED INT NOT NULL, ilist VARBINARY NOT NULL, UNIQUE CLUSTERED INDEX ON (word, first_doc_id))

Parameters
[in,out]trxtransaction
[in]indexindex instance
Returns
DB_SUCCESS or error code

◆ fts_create_index_tables_low()

dberr_t fts_create_index_tables_low ( trx_t trx,
dict_index_t index,
const char *  table_name,
table_id_t  table_id 
)

Create auxiliary index tables for an FTS index.

Parameters
[in,out]trxtransaction
[in]indexthe index instance
[in]table_nametable name
[in]table_idthe table id
Returns
DB_SUCCESS or error code

◆ fts_create_one_common_table()

static dict_table_t * fts_create_one_common_table ( trx_t trx,
const dict_table_t table,
const char *  fts_table_name,
const char *  fts_suffix,
mem_heap_t heap 
)
static

Function to create on FTS common table.

Parameters
[in,out]trxInnoDB transaction
[in]tableTable that has FTS Index
[in]fts_table_nameFTS AUX table name
[in]fts_suffixFTS AUX table suffix
[in]heapheap
Returns
table object if created, else NULL

◆ fts_create_one_index_dd_tables()

static dberr_t fts_create_one_index_dd_tables ( const dict_index_t index)
static

Update DD system table for auxiliary index tables for an FTS index.

Parameters
[in]indexthe index instance
Returns
DB_SUCCESS or error code

◆ fts_create_one_index_table()

static dict_table_t * fts_create_one_index_table ( trx_t trx,
const dict_index_t index,
fts_table_t fts_table,
mem_heap_t heap 
)
static

Creates one FTS auxiliary index table for an FTS index.

Parameters
[in,out]trxtransaction
[in]indexthe index instance
[in]fts_tablefts_table structure
[in]heapmemory heap
Returns
DB_SUCCESS or error code

◆ fts_delete()

static dberr_t fts_delete ( fts_trx_table_t ftt,
fts_trx_row_t row 
)
static

Do commit-phase steps necessary for the deletion of a row.

Returns
DB_SUCCESS or error code
Parameters
fttin: FTS trx table
rowin: row

◆ fts_detach_aux_tables()

void fts_detach_aux_tables ( const dict_table_t table,
bool  dict_locked 
)

Allow all the auxiliary tables of specified base table to be evictable if they exist, if not exist just ignore.

Parameters
[in]tableInnoDB table object
[in]dict_lockedTrue if we have dict_sys mutex

◆ fts_doc_fetch_by_doc_id()

dberr_t fts_doc_fetch_by_doc_id ( fts_get_doc_t get_doc,
doc_id_t  doc_id,
dict_index_t index_to_use,
ulint  option,
fts_sql_callback  callback,
void *  arg 
)

Fetch document with the given document id.

Fetch document (= a single row's indexed text) with the given document id.

Returns
DB_SUCCESS if OK else error
Parameters
get_docin: state
doc_idin: id of document to fetch
index_to_usein: caller supplied FTS index, or NULL
optionin: search option, if it is greater than doc_id or equal
callbackin: callback to read
argin: callback arg

◆ fts_doc_free()

void fts_doc_free ( fts_doc_t doc)

Free document.

in: document

Parameters
docin: document

◆ fts_doc_ids_create()

fts_doc_ids_t * fts_doc_ids_create ( void  )

Create a new fts_doc_ids_t.

Returns
new fts_doc_ids_t

◆ fts_doc_ids_free()

void fts_doc_ids_free ( fts_doc_ids_t doc_ids)

Free a fts_doc_ids_t.

in: doc_ids to free

◆ fts_doc_init()

void fts_doc_init ( fts_doc_t doc)

Initialize a document.

in: doc to initialize

Parameters
docin: doc to initialize

◆ fts_drop_all_index_tables()

static dberr_t fts_drop_all_index_tables ( trx_t trx,
fts_t fts,
aux_name_vec_t aux_vec 
)
static

Drops FTS ancillary tables needed for supporting an FTS index on the given table.

row_mysql_lock_data_dictionary must have been called before this.

Parameters
[in,out]trxtransaction
[in]ftsfts instance
[in,out]aux_vecfts aux table name vector
Returns
DB_SUCCESS or error code

◆ fts_drop_common_tables()

static dberr_t fts_drop_common_tables ( trx_t trx,
fts_table_t fts_table,
aux_name_vec_t aux_vec 
)
static

Drops the common ancillary tables needed for supporting an FTS index on the given table.

row_mysql_lock_data_dictionary must have been called before this.

Parameters
[in,out]trxtransaction
[in,out]fts_tabletable with fts index
[in,out]aux_vecfts table name vector
Returns
DB_SUCCESS or error code

◆ fts_drop_dd_tables()

bool fts_drop_dd_tables ( const aux_name_vec_t aux_vec,
bool  file_per_table 
)

Drop FTS AUX table DD table objects in vector.

Parameters
[in]aux_vecaux table name vector
[in]file_per_tablewhether file per table
Returns
true on success, false on failure.

◆ fts_drop_index()

dberr_t fts_drop_index ( dict_table_t table,
dict_index_t index,
trx_t trx,
aux_name_vec_t aux_vec,
bool  adding_another 
)

Drop auxiliary tables related to an FTS index.

Parameters
[in]tableTable where indexes are dropped
[in]indexIndex to be dropped
[in]trxTransaction for the drop
[in,out]aux_vecAux table name vector
[in]adding_anotherAnother FTS index is to be added as part of the same transaction
Returns
DB_SUCCESS or error number

◆ fts_drop_index_tables()

dberr_t fts_drop_index_tables ( trx_t trx,
dict_index_t index,
aux_name_vec_t aux_vec 
)

Since we do a horizontal split on the index table, we need to drop all the split tables.

Parameters
[in]trxtransaction
[in]indexfts index
[out]aux_vecdropped table names vector
Returns
DB_SUCCESS or error code

◆ fts_drop_table()

static dberr_t fts_drop_table ( trx_t trx,
const char *  table_name,
aux_name_vec_t aux_vec 
)
static

Drops a table.

If the table can't be found we return a SUCCESS code.

Parameters
[in,out]trxtransaction
[in]table_nametable to drop
[in,out]aux_vecfts aux table name vector
Returns
DB_SUCCESS or error code

◆ fts_drop_tables()

dberr_t fts_drop_tables ( trx_t trx,
dict_table_t table,
aux_name_vec_t aux_vec 
)

Drops the ancillary tables needed for supporting an FTS index on a given table.

row_mysql_lock_data_dictionary must have been called before this.

Parameters
[in,out]trxtransaction
[in]tabletable has the fts index
[in,out]aux_vecfts aux table name vector
Returns
DB_SUCCESS or error code

◆ fts_empty_common_tables()

dberr_t fts_empty_common_tables ( trx_t trx,
dict_table_t table 
)

Empty all common talbes.

Parameters
[in,out]trxtransaction
[in]tabledict table
Returns
DB_SUCCESS or error code.

◆ fts_empty_table()

static dberr_t fts_empty_table ( trx_t trx,
fts_table_t fts_table 
)
static

Empty a common talbes.

Parameters
[in,out]trxtransaction
[in]fts_tablefts table
Returns
DB_SUCCESS or error code.

◆ fts_fetch_doc_from_rec()

static void fts_fetch_doc_from_rec ( fts_get_doc_t get_doc,
dict_index_t clust_index,
btr_pcur_t pcur,
ulint offsets,
fts_doc_t doc 
)
static

fetch and tokenize the document.

Parameters
get_docin: FTS index's get_doc struct
clust_indexin: cluster index
pcurin: cursor whose position has been stored
offsetsin: offsets
docout: fts doc to hold parsed documents

◆ fts_fetch_doc_from_tuple()

static void fts_fetch_doc_from_tuple ( fts_get_doc_t get_doc,
const dtuple_t tuple,
fts_doc_t doc 
)
static

Fetch the data from tuple and tokenize the document.

Parameters
[in]get_docFTS index's get_doc struct
[in]tupletuple should be arranged in table schema order
[out]docfts doc to hold parsed documents.

◆ fts_fetch_store_doc_id()

static bool fts_fetch_store_doc_id ( void *  row,
void *  user_arg 
)
static

Fetch callback that converts a textual document id to a binary value and stores it in the given place.

Returns
always returns NULL
Parameters
rowin: sel_node_t*
user_argin: doc_id_t* to store doc_id in

◆ fts_find_index_cache()

fts_index_cache_t * fts_find_index_cache ( const fts_cache_t cache,
const dict_index_t index 
)

Search the index specific cache for a particular FTS index.

Returns
the index specific cache else NULL
Parameters
cachein: cache to search
indexin: index to search for

◆ fts_free()

void fts_free ( dict_table_t table)

Free the FTS resources.

in/out: table with FTS indexes

Parameters
tablein/out: table with FTS indexes

◆ fts_free_aux_names()

void fts_free_aux_names ( aux_name_vec_t aux_vec)

Free FTS AUX table names in vector.

Parameters
[in]aux_vecaux table name vector

◆ fts_freeze_aux_tables()

void fts_freeze_aux_tables ( const dict_table_t table)

Freeze all auiliary tables to be not evictable if exist, with dict_mutex held.

Parameters
[in]tableInnoDB table object

◆ fts_get_charset()

static CHARSET_INFO * fts_get_charset ( ulint  prtype)
inlinestatic

Get a character set based on precise type.

Parameters
prtypeprecise type
Returns
the corresponding character set

◆ fts_get_doc_id_from_rec()

doc_id_t fts_get_doc_id_from_rec ( dict_table_t table,
const rec_t rec,
const dict_index_t index,
mem_heap_t heap 
)

Extract the doc id from the record that belongs to index.

Parameters
[in]tabletable
[in]recrecord contains FTS_DOC_ID
[in]indexindex of rec
[in]heapheap memory
Returns
doc id that was extracted from rec

◆ fts_get_doc_id_from_row()

doc_id_t fts_get_doc_id_from_row ( dict_table_t table,
dtuple_t row 
)

Extract the doc id from the FTS hidden column.

Returns
doc id that was extracted from rec
Parameters
tablein: table
rowin: row whose FTS doc id we want to extract.

◆ fts_get_docs_clear()

static void fts_get_docs_clear ( ib_vector_t get_docs)
static
Parameters
get_docsin: Doc retrieval vector

◆ fts_get_docs_create()

static ib_vector_t * fts_get_docs_create ( fts_cache_t cache)
static

Create the vector of fts_get_doc_t instances.

Parameters
[in,out]cachefts cache
Returns
vector of fts_get_doc_t instances

◆ fts_get_index_cache()

static fts_index_cache_t * fts_get_index_cache ( fts_cache_t cache,
const dict_index_t index 
)
inlinestatic

Search the index specific cache for a particular FTS index.

Returns
the index cache else NULL
Parameters
cachein: cache to search
indexin: index to search for

◆ fts_get_max_doc_id()

doc_id_t fts_get_max_doc_id ( dict_table_t table)

Get maximum Doc ID in a table if index "FTS_DOC_ID_INDEX" exists.

Returns
max Doc ID or 0 if index "FTS_DOC_ID_INDEX" does not exist
Parameters
tablein: user table

◆ fts_get_next_doc_id()

dberr_t fts_get_next_doc_id ( const dict_table_t table,
doc_id_t doc_id 
)

Get the next available document id.

Returns
DB_SUCCESS if OK
Parameters
tablein: table
doc_idout: new document id

◆ fts_get_rows_count()

ulint fts_get_rows_count ( fts_table_t fts_table)

Fetch COUNT(*) from specified table.

Returns
the number of rows in the table
Parameters
fts_tablein: fts table to read

◆ fts_get_table_flags2_for_aux_tables()

static uint32_t fts_get_table_flags2_for_aux_tables ( uint32_t  flags2)
inlinestatic

Extract only the required flags from table->flags2 for FTS Aux tables.

Parameters
[in]flags2Table flags2
Returns
extracted flags2 for FTS aux tables

◆ fts_get_token_size()

ulint fts_get_token_size ( const CHARSET_INFO cs,
const char *  token,
ulint  len 
)

Get token char size by charset.

Returns
token size
Parameters
csin: Character set
tokenin: token
lenin: token length

◆ fts_in_dict_index()

static bool fts_in_dict_index ( dict_table_t table,
dict_index_t index_check 
)
static

Check an index is in the table->indexes list.

Returns
true if it exists
Parameters
tablein: Table
index_checkin: index to be checked

◆ fts_in_index_cache()

static bool fts_in_index_cache ( dict_table_t table,
dict_index_t index 
)
static

Check an index is in the fts->cache->indexes list.

Returns
true if it exists
Parameters
tablein: Table
indexin: index to be checked

◆ fts_index_cache_init()

static void fts_index_cache_init ( ib_alloc_t allocator,
fts_index_cache_t index_cache 
)
static

Initialize the index cache.

Parameters
allocatorin: the allocator to use
index_cachein: index cache

◆ fts_index_get_charset()

CHARSET_INFO * fts_index_get_charset ( dict_index_t index)

Create an FTS index cache.

in: FTS index

Parameters
indexin: FTS index

◆ fts_init_config_table()

static dberr_t fts_init_config_table ( fts_table_t fts_table)
static

Write the default settings to the config table.

Parameters
[in]fts_tablefts table
Returns
DB_SUCCESS or error code.

◆ fts_init_doc_id()

doc_id_t fts_init_doc_id ( const dict_table_t table)

Get the initial Doc ID by consulting the CONFIG table.

Returns
initial Doc ID
Parameters
tablein: table

◆ fts_init_get_doc_id()

static bool fts_init_get_doc_id ( void *  row,
void *  user_arg 
)
static

Callback function when we initialize the FTS at the start up time.

It recovers the maximum Doc IDs presented in the current table.

Returns
: always returns true
Parameters
rowin: sel_node_t*
user_argin: fts cache

◆ fts_init_index()

bool fts_init_index ( dict_table_t table,
bool  has_cache_lock 
)

This function brings FTS index in sync when FTS index is first used.

There are documents that have not yet sync-ed to auxiliary tables from last server abnormally shutdown, we will need to bring such document into FTS cache before any further operations

Returns
true if all OK
Parameters
tablein: Table with FTS
has_cache_lockin: Whether we already have cache lock

◆ fts_init_recover_doc()

static bool fts_init_recover_doc ( void *  row,
void *  user_arg 
)
static

Callback function when we initialize the FTS at the start up time.

It recovers Doc IDs that have not sync-ed to the auxiliary table, and require to bring them back into FTS index.

Returns
: always returns true

When a nullptr is passed for trx, it means we will fetch the latest LOB (and no MVCC will be done).

Parameters
rowin: sel_node_t*
user_argin: fts cache

◆ fts_is_aux_table_name()

bool fts_is_aux_table_name ( fts_aux_table_t table,
const char *  name,
ulint  len 
)

Check if a table is an FTS auxiliary table name.

Parameters
[out]tableFTS table info
[in]nameTable name
[in]lenLength of table name
Returns
true if the name matches an auxiliary table name pattern

◆ fts_load_default_stopword()

static void fts_load_default_stopword ( fts_stopword_t stopword_info)
static

This function loads the default InnoDB stopword list.

Parameters
stopword_infoin: stopword info

◆ fts_load_stopword()

bool fts_load_stopword ( const dict_table_t table,
trx_t trx,
const char *  global_stopword_table,
const char *  session_stopword_table,
bool  stopword_is_on,
bool  reload 
)

This function loads the stopword into the FTS cache.

This function loads specified stopword into FTS cache.

It also records/fetches stopword configuration to/from FTS configure table, depending on whether we are creating or reloading the FTS.

Returns
true if load operation is successful
Parameters
tablein: Table with FTS
trxin: Transactions
global_stopword_tablein: Global stopword table name
session_stopword_tablein: Session stopword table name
stopword_is_onin: Whether stopword option is turned on/off
reloadin: Whether it is for reloading FTS table

◆ fts_load_user_stopword()

static bool fts_load_user_stopword ( const char *  stopword_table_name,
fts_stopword_t stopword_info 
)
static

Load user defined stopword from designated user table.

Returns
true if load operation is successful
Parameters
stopword_table_namein: Stopword table name
stopword_infoin: Stopword info

◆ fts_lock_all_aux_tables()

dberr_t fts_lock_all_aux_tables ( THD thd,
dict_table_t table 
)

Lock all FTS AUX tables (for dropping table)

Parameters
[in]thdthread locking the AUX table
[in]tabletable has the fts index
Returns
DB_SUCCESS or error code

◆ fts_lock_all_index_tables()

static dberr_t fts_lock_all_index_tables ( THD thd,
fts_t fts 
)
static

Lock all FTS index AUX tables (for dropping table)

Parameters
[in]thdthread locking the AUX table
[in]ftsfts instance
Returns
DB_SUCCESS or error code

◆ fts_lock_common_tables()

static dberr_t fts_lock_common_tables ( THD thd,
fts_table_t fts_table 
)
static

Lock all FTS AUX COMMON tables (for dropping table)

Parameters
[in]thdthread locking the AUX table
[in,out]fts_tabletable with fts index
Returns
DB_SUCCESS or error code

◆ fts_lock_index_tables()

dberr_t fts_lock_index_tables ( THD thd,
dict_index_t index 
)

Lock all FTS INDEX AUX tables (for dropping table)

Parameters
[in]thdthread locking the AUX table
[in]indexfts index
Returns
DB_SUCCESS or error code

◆ fts_modify()

static dberr_t fts_modify ( fts_trx_table_t ftt,
fts_trx_row_t row 
)
static

Do commit-phase steps necessary for the modification of a row.

Returns
DB_SUCCESS or error code
Parameters
fttin: FTS trx table
rowin: row

◆ fts_process_token()

static ulint fts_process_token ( fts_doc_t doc,
fts_doc_t result,
ulint  start_pos,
ulint  add_pos 
)
static

Process next token from document starting at the given position, i.e., add the token's start position to the token's list of positions.

Parameters
[in,out]docdocument to tokenize
[out]resultif provided, save result here
[in]start_posstart position in text
[in]add_posadd this position to all tokens from this tokenization
Returns
number of characters handled in this call

◆ fts_query_expansion_fetch_doc()

bool fts_query_expansion_fetch_doc ( void *  row,
void *  user_arg 
)

Callback function for fetch that stores the text of an FTS document, converting each column to UTF-16.

Returns
always false
Parameters
rowin: sel_node_t*
user_argin: fts_doc_t*

◆ fts_read_stopword()

static bool fts_read_stopword ( void *  row,
void *  user_arg 
)
static

Callback function to read a single stopword value.

Returns
Always return true
Parameters
rowin: sel_node_t*
user_argin: pointer to ib_vector_t

◆ fts_read_ulint()

static bool fts_read_ulint ( void *  row,
void *  user_arg 
)
static

Callback function to read a single ulint column.

return always returns true

Parameters
rowin: sel_node_t*
user_argin: pointer to ulint

◆ fts_rename_aux_tables()

dberr_t fts_rename_aux_tables ( dict_table_t table,
const char *  new_name,
trx_t trx,
bool  replay 
)

Rename auxiliary tables for all fts index for a table.

This(rename) is due to database name change

Returns
DB_SUCCESS or error code
Parameters
tablein: user Table
new_namein: new table name
trxin: transaction
replayin: Whether in replay stage

◆ fts_rename_one_aux_table()

static dberr_t fts_rename_one_aux_table ( const char *  new_name,
const char *  fts_table_old_name,
trx_t trx,
bool  replay 
)
static

Rename a single auxiliary table due to database name change.

Returns
DB_SUCCESS or error code
Parameters
new_namein: new parent tbl name
fts_table_old_namein: old aux tbl name
trxin: transaction
replayWhether in replay stage

◆ fts_reset_get_doc()

static void fts_reset_get_doc ( fts_cache_t cache)
static

recalibrate get_doc structure after index_cache in cache->indexes changed

Parameters
cachein: FTS index cache

◆ fts_savepoint_copy()

static void fts_savepoint_copy ( const fts_savepoint_t src,
fts_savepoint_t dst 
)
inlinestatic

Take a FTS savepoint.

Parameters
srcin: source savepoint
dstout: destination savepoint

◆ fts_savepoint_create()

static fts_savepoint_t * fts_savepoint_create ( ib_vector_t savepoints,
const char *  name,
mem_heap_t heap 
)
static

Create a savepoint instance.

Returns
savepoint instance
Parameters
savepointsout: InnoDB transaction
namein: savepoint name
heapin: heap

◆ fts_savepoint_free()

static void fts_savepoint_free ( fts_savepoint_t savepoint)
inlinestatic

Free an FTS savepoint instance.

Parameters
savepointin: savepoint instance

◆ fts_savepoint_laststmt_refresh()

void fts_savepoint_laststmt_refresh ( trx_t trx)

Refresh last statement savepoint.

in: transaction

Parameters
trxin: transaction

◆ fts_savepoint_lookup()

static ulint fts_savepoint_lookup ( ib_vector_t savepoints,
const char *  name 
)
inlinestatic

Lookup a savepoint instance by name.

Returns
ULINT_UNDEFINED if not found
Parameters
savepointsin: savepoints
namein: savepoint name

◆ fts_savepoint_release()

void fts_savepoint_release ( trx_t trx,
const char *  name 
)

Release the savepoint data identified by name.

All savepoints created after the named savepoint are kept.

Parameters
trxin: transaction
namein: savepoint name

◆ fts_savepoint_rollback()

void fts_savepoint_rollback ( trx_t trx,
const char *  name 
)

Rollback to savepoint identified by name.

Rollback to and including savepoint identified by name.

Parameters
trxin: transaction
namein: savepoint name

◆ fts_savepoint_rollback_last_stmt()

void fts_savepoint_rollback_last_stmt ( trx_t trx)

Rollback to savepoint identified by name.

Rollback to and including savepoint identified by name.

Parameters
trxin: transaction

◆ fts_savepoint_take()

void fts_savepoint_take ( fts_trx_t fts_trx,
const char *  name 
)

Take a FTS savepoint.

Parameters
[in]fts_trxFts transaction
[in]nameSavepoint name

◆ fts_sync()

static dberr_t fts_sync ( fts_sync_t sync,
bool  unlock_cache,
bool  wait,
bool  has_dict 
)
static

Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end.

Parameters
[in,out]syncsync state
[in]unlock_cachewhether unlock cache lock when write node
[in]waitwhether wait when a sync is in progress
[in]has_dictwhether has dict operation lock
Returns
DB_SUCCESS if all OK

◆ fts_sync_add_deleted_cache()

static dberr_t fts_sync_add_deleted_cache ( fts_sync_t sync,
ib_vector_t doc_ids 
)
static

Add rows to the DELETED_CACHE table.

Returns
DB_SUCCESS if all went well else error code
Parameters
syncin: sync state
doc_idsin: doc ids to add

◆ fts_sync_begin()

static void fts_sync_begin ( fts_sync_t sync)
static

Begin Sync, create transaction, acquire locks, etc.

Parameters
syncin: sync state

◆ fts_sync_commit()

static dberr_t fts_sync_commit ( fts_sync_t sync)
static

Commit the SYNC, change state of processed doc ids etc.

Parameters
[in,out]syncsync state
Returns
DB_SUCCESS if all OK

◆ fts_sync_index()

static dberr_t fts_sync_index ( fts_sync_t sync,
fts_index_cache_t index_cache 
)
static

Run SYNC on the table, i.e., write out data from the index specific cache to the FTS aux INDEX table and FTS aux doc id stats table.

Returns
DB_SUCCESS if all OK
Parameters
syncin: sync state
index_cachein: index cache

◆ fts_sync_index_check()

static bool fts_sync_index_check ( fts_index_cache_t index_cache)
static

Check if index cache has been synced completely.

Parameters
[in,out]index_cacheindex cache
Returns
true if index is synced, otherwise false.

◆ fts_sync_index_reset()

static void fts_sync_index_reset ( fts_index_cache_t index_cache)
static

Reset synced flag in index cache when rollback.

Parameters
[in,out]index_cacheindex cache

◆ fts_sync_rollback()

static void fts_sync_rollback ( fts_sync_t sync)
static

Rollback a sync operation.

Parameters
syncin: sync state

◆ fts_sync_table()

dberr_t fts_sync_table ( dict_table_t table,
bool  unlock_cache,
bool  wait,
bool  has_dict 
)

Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end.

Parameters
[in,out]tablefts table
[in]unlock_cachewhether unlock cache when write node
[in]waitwhether wait for existing sync to finish
[in]has_dictwhether has dict operation lock
Returns
DB_SUCCESS on success, error code on failure.

◆ fts_sync_write_words()

static dberr_t fts_sync_write_words ( trx_t trx,
fts_index_cache_t index_cache,
bool  unlock_cache,
std::chrono::steady_clock::time_point  sync_start_time 
)
static

Write the words and ilist to disk.

Parameters
[in,out]trxtransaction
[in]index_cacheindex cache
[in]unlock_cachewhether unlock cache when write node
[in]sync_start_timeHolds the timestamp of start of sync for deducing the length of sync time
Returns
DB_SUCCESS if all went well else error code

◆ fts_tokenize_add_word_for_parser()

static int fts_tokenize_add_word_for_parser ( MYSQL_FTPARSER_PARAM param,
char *  word,
int  word_len,
MYSQL_FTPARSER_BOOLEAN_INFO boolean_info 
)
static

FTS plugin parser 'myql_add_word' callback function for document tokenize.

Refer to 'MYSQL_FTPARSER_PARAM' for more detail.

Returns
always returns 0

◆ fts_tokenize_by_parser()

static void fts_tokenize_by_parser ( fts_doc_t doc,
st_mysql_ftparser parser,
fts_tokenize_param_t fts_param 
)
static

Parse a document using an external / user supplied parser.

◆ fts_tokenize_document()

static void fts_tokenize_document ( fts_doc_t doc,
fts_doc_t result,
st_mysql_ftparser parser 
)
static

Tokenize a document.

Parameters
[in,out]docdocument to tokenize
[out]resulttokenization result
[in]parserpluggable parser

◆ fts_tokenize_document_internal()

int fts_tokenize_document_internal ( MYSQL_FTPARSER_PARAM param,
char *  doc,
int  len 
)

FTS plugin parser 'myql_parser' callback function for document tokenize.

FULLTEXT tokenizer internal in MYSQL_FTPARSER_SIMPLE_MODE.

Refer to 'MYSQL_FTPARSER_PARAM' for more detail.

Returns
always returns 0
Parameters
paramin: parser parameter
docin/out: document
lenin: document length

◆ fts_tokenize_document_next()

static void fts_tokenize_document_next ( fts_doc_t doc,
ulint  add_pos,
fts_doc_t result,
st_mysql_ftparser parser 
)
static

Continue to tokenize a document.

Parameters
[in,out]docdocument to tokenize
[in]add_posadd this position to all tokens from this tokenization
[out]resulttokenization result
[in]parserpluggable parser

◆ fts_tokenizer_word_get()

static fts_tokenizer_word_t * fts_tokenizer_word_get ( fts_cache_t cache,
fts_index_cache_t index_cache,
fts_string_t text 
)
static

Find an existing word, or if not found, create one and return it.

Returns
specified word token
Parameters
cachein: cache
index_cachein: index cache
textin: node text

◆ fts_trx_add_op()

void fts_trx_add_op ( trx_t trx,
dict_table_t table,
doc_id_t  doc_id,
fts_row_state  state,
ib_vector_t fts_indexes 
)

Notify the FTS system about an operation on an FTS-indexed table.

Parameters
[in]trxInnodb transaction
[in]tableTable
[in]doc_idDoc id
[in]stateState of the row
[in]fts_indexesFts indexes affected (null=all)

◆ fts_trx_create()

fts_trx_t * fts_trx_create ( trx_t trx)

Create an FTS trx.

Parameters
[in,out]trxInnoDB Transaction
Returns
FTS transaction.

◆ fts_trx_free()

void fts_trx_free ( fts_trx_t fts_trx)

Free an FTS trx.

in, own: FTS trx

◆ fts_trx_init()

static fts_trx_table_t * fts_trx_init ( trx_t trx,
dict_table_t table,
ib_vector_t savepoints 
)
static

Initialize the FTS trx instance.

Returns
FTS trx instance
Parameters
trxin: transaction
tablein: FTS table instance
savepointsin: Savepoints

◆ fts_trx_row_get_new_state()

static fts_row_state fts_trx_row_get_new_state ( fts_row_state  old_state,
fts_row_state  event 
)
static

Calculate the new state of a row given the existing state and a new event.

Returns
new state of row
Parameters
old_statein: existing state of row
eventin: new event

◆ fts_trx_table_add_op()

static void fts_trx_table_add_op ( fts_trx_table_t ftt,
doc_id_t  doc_id,
fts_row_state  state,
ib_vector_t fts_indexes 
)
static

Notify the FTS system about an operation on an FTS-indexed table.

Parameters
fttin: FTS trx table
doc_idin: doc id
statein: state of the row
fts_indexesin: FTS indexes affected

◆ fts_trx_table_clone()

static fts_trx_table_t * fts_trx_table_clone ( const fts_trx_table_t ftt_src)
static

Clone an FTS trx table.

Returns
FTS trx table
Parameters
ftt_srcin: FTS trx

◆ fts_trx_table_create()

static fts_trx_table_t * fts_trx_table_create ( fts_trx_t fts_trx,
dict_table_t table 
)
static

Create an FTS trx table.

Returns
FTS trx table
Parameters
fts_trxin: FTS trx
tablein: table

◆ fts_trx_table_rows_free()

static void fts_trx_table_rows_free ( ib_rbt_t rows)
inlinestatic

Free the modified rows of a table.

Parameters
rowsin: rbt of rows to free

◆ fts_undo_last_stmt()

static void fts_undo_last_stmt ( fts_trx_table_t s_ftt,
fts_trx_table_t l_ftt 
)
static
Parameters
s_fttin: Transaction FTS table
l_fttin: last stmt FTS table

◆ fts_update_doc_id()

doc_id_t fts_update_doc_id ( dict_table_t table,
upd_field_t ufield,
doc_id_t next_doc_id 
)

Add new fts doc id to the update vector.

Parameters
[in]tablethe table that contains the FTS index.
[in,out]ufieldthe fts doc id field in the update vector. No new memory is allocated for this in this function.
[in,out]next_doc_idthe fts doc id that has been added to the update vector. If 0, a new fts doc id is automatically generated. The memory provided for this argument will be used by the update vector. Ensure that the life time of this memory matches that of the update vector.
Returns
the fts doc id used in the update vector

◆ fts_update_next_doc_id()

void fts_update_next_doc_id ( trx_t trx,
const dict_table_t table,
const char *  table_name,
doc_id_t  doc_id 
)

Update the next and last Doc ID in the CONFIG table to be the input "doc_id" value (+ 1).

We would do so after each FTS index build or table truncate

Parameters
trxin/out: transaction
tablein: table
table_namein: table name, or NULL
doc_idin: DOC ID to set

◆ fts_update_sync_doc_id()

static dberr_t fts_update_sync_doc_id ( const dict_table_t table,
const char *  table_name,
doc_id_t  doc_id,
trx_t trx 
)
static

Update the last document id.

This function could create a new transaction to update the last document id.

Returns
DB_SUCCESS if OK in: update trx, or NULL

This function could create a new transaction to update the last document id.

Returns
DB_SUCCESS if OK
Parameters
tablein: table
table_namein: table name, or NULL
doc_idin: last document id
trxin: update trx, or NULL

◆ fts_upgrade_aux_tables()

dberr_t fts_upgrade_aux_tables ( dict_table_t table)

Upgrade FTS AUX Tables.

The FTS common and aux tables are renamed because they have table_id in their name. We move table_ids by DICT_MAX_DD_TABLES offset. Aux tables are registered into DD after rename.

Parameters
[in]tableInnoDB table object
Returns
DB_SUCCESS or error code

◆ fts_upgrade_get_5_7_table_id()

table_id_t fts_upgrade_get_5_7_table_id ( table_id_t  table_id)
inline

During upgrade, tables are moved by DICT_MAX_DD_TABLES offset, remove this offset to get 5.7 fts aux table names.

Parameters
[in]table_id8.0 table id

◆ fts_upgrade_rename()

dberr_t fts_upgrade_rename ( const dict_table_t table,
bool  rollback 
)

Rename FTS AUX tablespace name from 8.0 format to 5.7 format.

This will be done on upgrade failure

Parameters
[in]tableparent table
[in]rollbackrollback the rename from 8.0 to 5.7 if true, rename to 5.7 format if false, mark the table as evictable
Returns
DB_SUCCESS on success, DB_ERROR on error

◆ fts_upgrade_rename_aux_table()

static void fts_upgrade_rename_aux_table ( const char *  old_name,
const char *  new_name,
bool  rollback 
)
static

Rename old FTS common and aux tables with the new table_id.

Parameters
[in]old_nameold name of FTS AUX table
[in]new_namenew name of FTS AUX table
[in]rollbackif true, do the rename back else mark original AUX tables evictable

◆ fts_upgrade_rename_aux_table_low()

static dict_table_t * fts_upgrade_rename_aux_table_low ( const char *  old_name,
const char *  new_name 
)
static

Rename old FTS common and aux tables with the new table_id.

Parameters
[in]old_nameold name of FTS AUX table
[in]new_namenew name of FTS AUX table
Returns
new fts table if success, else nullptr on failure

◆ fts_valid_stopword_table()

CHARSET_INFO * fts_valid_stopword_table ( const char *  stopword_table_name)

Check whether user supplied stopword table is of the right format.

Check whether user supplied stopword table exists and is of the right format.

Caller is responsible to hold dictionary locks.

Returns
the stopword column charset if qualifies
Parameters
stopword_table_namein: Stopword table name

◆ fts_wait_for_background_thread_to_start()

bool fts_wait_for_background_thread_to_start ( dict_table_t table,
std::chrono::microseconds  max_wait 
)

Wait for the background thread to start.

We poll to detect change of state, which is acceptable, since the wait should happen only once during startup.

Parameters
[in]tabletable to which the thread is attached
[in]max_waitTime to wait. If set to 0 then it disables timeout checking
Returns
true if the thread started else false (i.e timed out)

◆ fts_words_free()

static void fts_words_free ( ib_rbt_t words)
static

Release all resources help by the words rb tree e.g., the node ilist.

in: rb tree of words

Parameters
wordsin: rb tree of words

◆ fts_write_node()

dberr_t fts_write_node ( trx_t trx,
que_t **  graph,
fts_table_t fts_table,
fts_string_t word,
fts_node_t node 
)

Write out a single word's data as new entry/entries in the INDEX table.

in: node columns

Returns
DB_SUCCESS if all OK.
Parameters
trxin: transaction
graphin: query graph
fts_tablein: aux table
wordin: word in UTF-8
nodein: node columns

Variable Documentation

◆ elapsed_time

std::chrono::steady_clock::duration elapsed_time
static

◆ fts_common_tables

const char* fts_common_tables[]
Initial value:
= {"being_deleted", "being_deleted_cache",
"config", "deleted",
"deleted_cache", nullptr}

FTS auxiliary table suffixes that are common to all FT indexes.

It's defined in fts0fts.cc

◆ fts_common_tables_5_7

const char* fts_common_tables_5_7[]
Initial value:
= {"BEING_DELETED", "BEING_DELETED_CACHE",
"CONFIG", "DELETED",
"DELETED_CACHE", nullptr}

FTS auxiliary table suffixes that are common to all FT indexes.

◆ fts_config_table_insert_values_sql

const char* fts_config_table_insert_values_sql
static
Initial value:
=
"BEGIN\n"
"\n"
"INSERT INTO $config_table VALUES('" FTS_MAX_CACHE_SIZE_IN_MB
"', '256');\n"
""
"INSERT INTO $config_table VALUES('" FTS_OPTIMIZE_LIMIT_IN_SECS
"', '180');\n"
""
"INSERT INTO $config_table VALUES ('" FTS_SYNCED_DOC_ID
"', '0');\n"
""
"INSERT INTO $config_table VALUES ('" FTS_TOTAL_DELETED_COUNT
"', '0');\n"
""
"INSERT INTO $config_table VALUES ('" FTS_TABLE_STATE "', '0');\n"
#define FTS_MAX_CACHE_SIZE_IN_MB
Column name from the FTS config table.
Definition: fts0fts.cc:65
#define FTS_SYNCED_DOC_ID
The next doc id.
Definition: fts0priv.h:84
#define FTS_OPTIMIZE_LIMIT_IN_SECS
FTS config table name parameters.
Definition: fts0priv.h:81
#define FTS_TOTAL_DELETED_COUNT
Total number of documents that have been deleted.
Definition: fts0priv.h:91
#define FTS_TABLE_STATE
State of the FTS system for this table.
Definition: fts0priv.h:110

Default config values for FTS indexes on a table.

◆ FTS_DEADLOCK_RETRY_WAIT_MS

constexpr uint32_t FTS_DEADLOCK_RETRY_WAIT_MS = 100
staticconstexpr

Time to sleep after DEADLOCK error before retrying operation in milliseconds.

◆ fts_default_stopword

const char* fts_default_stopword[]
Initial 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", nullptr}

InnoDB default stopword list: There are different versions of stopwords, the stop words listed below comes from "Google Stopword" list.

Reference: http://meta.wikimedia.org/wiki/Stop_word_list/google_stop_word_list. The final version of InnoDB default stopword list is still pending for decision

◆ fts_index_selector

const fts_index_selector_t fts_index_selector[]
Initial value:
= {
{9, "index_1"}, {65, "index_2"}, {70, "index_3"}, {75, "index_4"},
{80, "index_5"}, {85, "index_6"}, {0, nullptr}}

FTS auxiliary INDEX split intervals.

It's defined in fts/fts0fts.c.

◆ fts_index_selector_5_7

const fts_index_selector_t fts_index_selector_5_7[]
Initial value:
= {
{9, "INDEX_1"}, {65, "INDEX_2"}, {70, "INDEX_3"}, {75, "INDEX_4"},
{80, "INDEX_5"}, {85, "INDEX_6"}, {0, nullptr}}

FTS auxiliary INDEX split intervals.

It's defined in fts/fts0fts.c.

◆ fts_internal_tbl_name

char* fts_internal_tbl_name = nullptr

variable to record innodb_fts_internal_tbl_name for information schema table INNODB_FTS_INSERTED etc.

Variable specifying the table that has Fulltext index to display its content through information schema table.

◆ fts_max_cache_size

ulong fts_max_cache_size

This is maximum FTS cache for each table and would be a configurable variable.

Variable specifying the maximum FTS cache size for each table.

◆ FTS_MAX_ID_LEN

const ulint FTS_MAX_ID_LEN = 32
static

◆ fts_max_token_size

ulong fts_max_token_size

Variable specifying the maximum FTS max token size.

◆ fts_max_total_cache_size

ulong fts_max_total_cache_size

Variable specifying the total memory allocated for FTS cache.

◆ fts_min_token_size

ulong fts_min_token_size

Variable specifying the minimum FTS max token size.

◆ fts_need_sync

bool fts_need_sync = false

Whether the total memory used for FTS cache is exhausted, and we will need a sync to free some memory.

◆ FTS_PREFIX

const char* FTS_PREFIX = "fts_"

FTS auxiliary table prefix that are common to all FT indexes.

◆ FTS_PREFIX_5_7

const char* FTS_PREFIX_5_7 = "FTS_"

FTS auxiliary table prefix that are common to all FT indexes.

◆ fts_result_cache_limit

ulong fts_result_cache_limit

This is FTS result cache limit for each query and would be a configurable variable.

Variable specifying the FTS result cache limit for each query.

◆ FTS_SUFFIX_BEING_DELETED

const char* FTS_SUFFIX_BEING_DELETED = fts_common_tables[0]

◆ FTS_SUFFIX_BEING_DELETED_CACHE

const char* FTS_SUFFIX_BEING_DELETED_CACHE = fts_common_tables[1]

◆ FTS_SUFFIX_CONFIG

const char* FTS_SUFFIX_CONFIG = fts_common_tables[2]

◆ FTS_SUFFIX_CONFIG_5_7

const char* FTS_SUFFIX_CONFIG_5_7 = fts_common_tables_5_7[2]

◆ FTS_SUFFIX_DELETED

const char* FTS_SUFFIX_DELETED = fts_common_tables[3]

◆ FTS_SUFFIX_DELETED_CACHE

const char* FTS_SUFFIX_DELETED_CACHE = fts_common_tables[4]

◆ n_nodes

ulint n_nodes = 0
static