InnoDB Plugin  1.0
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
fts0fts.h File Reference
#include "univ.i"
#include "data0type.h"
#include "data0types.h"
#include "dict0types.h"
#include "hash0hash.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "row0types.h"
#include "trx0types.h"
#include "ut0vec.h"
#include "ut0rbt.h"
#include "ut0wqueue.h"
#include "que0types.h"
#include "ft_global.h"
Include dependency graph for fts0fts.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fts_trx_t
struct  fts_savepoint_t
struct  fts_trx_table_t
struct  fts_trx_row_t
struct  fts_doc_ids_t
struct  fts_string_t
struct  fts_ranking_t
struct  fts_result_t
struct  fts_table_t
struct  fts_t

Macros

#define FTS_NULL_DOC_ID   0
#define FTS_DOC_ID_COL_NAME   "FTS_DOC_ID"
#define FTS_DOC_ID_INDEX_NAME   "FTS_DOC_ID_INDEX"
#define FTS_DOC_ID_INDEX_NAME_LEN   16
#define FTS_DOC_ID_LEN   8
#define FTS_NUM_FIELDS_SORT   3
#define MAX_DOC_ID_OPT_VAL   1073741824
#define FTS_DOC_ID_FORMAT   IB_ID_FMT
#define fts_write_doc_id(d, s)   mach_write_to_8(d, s)
#define fts_read_doc_id(s)   mach_read_from_8(s)
#define fts_bind_doc_id(i, n, v)   pars_info_bind_int8_literal(i, n, v)
#define FTS_NL   0
#define FTS_BOOL   1
#define FTS_SORTED   2
#define FTS_EXPAND   4
#define FTS_PROXIMITY   8
#define FTS_PHRASE   16
#define FTS_OPT_RANKING   32
#define FTS_INDEX_TABLE_IND_NAME   "FTS_INDEX_TABLE_IND"
#define FTS_OPTIMIZE_THRESHOLD   10000000
#define FTS_DOC_ID_MAX_STEP   10000
#define FTS_INIT_FTS_TABLE(fts_table, m_suffix, m_type, m_table)
#define FTS_INIT_INDEX_TABLE(fts_table, m_suffix, m_type, m_index)
#define STOPWORD_NOT_INIT   0x1
#define STOPWORD_OFF   0x2
#define STOPWORD_FROM_DEFAULT   0x4
#define STOPWORD_USER_TABLE   0x8
#define FTS_MAX_WORD_LEN   HA_FT_MAXBYTELEN
#define FTS_MAX_WORD_LEN_IN_CHAR   HA_FT_MAXCHARLEN
#define fts_que_graph_free(graph)

Typedefs

typedef ib_uint64_t doc_id_t
typedef float fts_rank_t
typedef unsigned short ib_uc_t
typedef enum fts_status fts_status_t

Enumerations

enum  fts_row_state {
  FTS_INSERT = 0, FTS_MODIFY, FTS_DELETE, FTS_NOTHING,
  FTS_INVALID
}
enum  fts_table_type_t { FTS_INDEX_TABLE, FTS_COMMON_TABLE }
enum  fts_status {
  BG_THREAD_STOP = 1, BG_THREAD_READY = 2, ADD_THREAD_STARTED = 4, ADDED_TABLE_SYNCED = 8,
  TABLE_DICT_LOCKED = 16
}

Functions

UNIV_INTERN fts_cache_tfts_cache_create (dict_table_t *table)
UNIV_INTERN fts_index_cache_tfts_cache_index_cache_create (dict_table_t *table, dict_index_t *index)
UNIV_INTERN dberr_t fts_get_next_doc_id (const dict_table_t *table, doc_id_t *doc_id))
UNIV_INTERN void fts_update_next_doc_id (trx_t *trx, const dict_table_t *table, const char *table_name, doc_id_t doc_id)))
UNIV_INTERN dberr_t fts_create_doc_id (dict_table_t *table, dtuple_t *row, mem_heap_t *heap))
UNIV_INTERN fts_doc_ids_tfts_doc_ids_create (void)
UNIV_INTERN void fts_doc_ids_free (fts_doc_ids_t *doc_ids)
UNIV_INTERN 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)))
UNIV_INTERN void fts_trx_free (fts_trx_t *fts_trx)
UNIV_INTERN dberr_t fts_create_common_tables (trx_t *trx, const dict_table_t *table, const char *name, bool skip_doc_id_index))
UNIV_INTERN dberr_t fts_create_index_tables (trx_t *trx, const dict_index_t *index))
UNIV_INTERN dberr_t fts_create_index_tables_low (trx_t *trx, const dict_index_t *index, const char *table_name, table_id_t table_id))
UNIV_INTERN void fts_add_doc_id_column (dict_table_t *table, mem_heap_t *heap)))
UNIV_INTERN dberr_t fts_drop_tables (trx_t *trx, dict_table_t *table))
UNIV_INTERN dberr_t fts_commit (trx_t *trx))
UNIV_INTERN dberr_t fts_query (trx_t *trx, dict_index_t *index, uint flags, const byte *query, ulint query_len, fts_result_t **result))
UNIV_INTERN float fts_retrieve_ranking (fts_result_t *result, doc_id_t doc_id)
UNIV_INTERN void fts_query_sort_result_on_rank (fts_result_t *result)
UNIV_INTERN void fts_query_free_result (fts_result_t *result)
UNIV_INTERN doc_id_t fts_get_doc_id_from_row (dict_table_t *table, dtuple_t *row)
UNIV_INTERN doc_id_t fts_get_doc_id_from_rec (dict_table_t *table, const rec_t *rec, mem_heap_t *heap)
UNIV_INTERN doc_id_t fts_update_doc_id (dict_table_t *table, upd_field_t *ufield, doc_id_t *next_doc_id)
UNIV_INTERN void fts_startup (void)
UNIV_INTERN void fts_start_shutdown (dict_table_t *table, fts_t *fts)
UNIV_INTERN void fts_shutdown (dict_table_t *table, fts_t *fts)
UNIV_INTERN fts_tfts_create (dict_table_t *table)
UNIV_INTERN void fts_free (dict_table_t *table)
UNIV_INTERN dberr_t fts_optimize_table (dict_table_t *table))
UNIV_INTERN void fts_optimize_init (void)
UNIV_INTERN ibool fts_optimize_is_init (void)
UNIV_INTERN dberr_t fts_drop_index_tables (trx_t *trx, dict_index_t *index))
UNIV_INTERN void fts_optimize_remove_table (dict_table_t *table)
UNIV_INTERN void fts_optimize_start_shutdown (void)
UNIV_INTERN void fts_optimize_end (void)
UNIV_INTERN void fts_savepoint_take (trx_t *trx, fts_trx_t *fts_trx, const char *name))
UNIV_INTERN void fts_savepoint_laststmt_refresh (trx_t *trx))
UNIV_INTERN void fts_savepoint_release (trx_t *trx, const char *name)
UNIV_INTERN void fts_cache_destroy (fts_cache_t *cache)
UNIV_INTERN void fts_cache_clear (fts_cache_t *cache)
UNIV_INTERN void fts_cache_init (fts_cache_t *cache)
UNIV_INTERN void fts_savepoint_rollback (trx_t *trx, const char *name)
UNIV_INTERN void fts_savepoint_rollback_last_stmt (trx_t *trx)
UNIV_INTERN void fts_drop_orphaned_tables (void)
UNIV_INTERN dberr_t fts_drop_index_split_tables (trx_t *trx, dict_index_t *index))
UNIV_INTERN dberr_t fts_sync_table (dict_table_t *table))
UNIV_INTERN void fts_que_graph_free_check_lock (fts_table_t *fts_table, const fts_index_cache_t *index_cache, que_t *graph)
UNIV_INTERN CHARSET_INFO * fts_index_get_charset (dict_index_t *index)
UNIV_INTERN doc_id_t fts_init_doc_id (const dict_table_t *table)
int innobase_fts_text_cmp (const void *cs, const void *p1, const void *p2)
size_t innobase_fts_casedn_str (CHARSET_INFO *cs, char *src, size_t src_len, char *dst, size_t dst_len)
int innobase_fts_text_cmp_prefix (const void *cs, const void *p1, const void *p2)
ulint innobase_mysql_fts_get_token (CHARSET_INFO *charset, const byte *start, const byte *end, fts_string_t *token, ulint *offset)
UNIV_INTERN ulint fts_get_rows_count (fts_table_t *fts_table)
UNIV_INTERN doc_id_t fts_get_max_doc_id (dict_table_t *table)
UNIV_INTERN CHARSET_INFO * fts_valid_stopword_table (const char *stopword_table_name)
UNIV_INTERN ibool fts_load_stopword (const dict_table_t *table, trx_t *trx, const char *global_stopword_table, const char *session_stopword_table, ibool stopword_is_on, ibool reload)
UNIV_INTERN ib_vector_tfts_get_docs_create (fts_cache_t *cache)
UNIV_INTERN dberr_t fts_table_fetch_doc_ids (trx_t *trx, fts_table_t *fts_table, fts_doc_ids_t *doc_ids)
UNIV_INTERN ibool fts_init_index (dict_table_t *table, ibool has_cache_lock)
UNIV_INTERN void fts_add_index (dict_index_t *index, dict_table_t *table)
UNIV_INTERN dberr_t fts_drop_index (dict_table_t *table, dict_index_t *index, trx_t *trx))
dberr_t fts_rename_aux_tables (dict_table_t *table, const char *new_name, trx_t *trx)
UNIV_INTERN ibool fts_check_cached_index (dict_table_t *table)

Variables

ulong fts_sort_pll_degree
ulong fts_num_word_optimize
char fts_enable_diag_print
const char * fts_default_stopword []
ulong fts_max_cache_size
ulong fts_max_total_cache_size
ulong fts_result_cache_limit
ulong fts_max_token_size
ulong fts_min_token_size
bool fts_need_sync
char * fts_internal_tbl_name

Detailed Description

Full text search header file

Created 2011/09/02 Sunny Bains

Macro Definition Documentation

#define fts_bind_doc_id (   i,
  n,
 
)    pars_info_bind_int8_literal(i, n, v)

Bind the doc id to a variable

#define FTS_DOC_ID_COL_NAME   "FTS_DOC_ID"

FTS hidden column that is used to map to and from the row

#define FTS_DOC_ID_FORMAT   IB_ID_FMT

doc_id_t printf format

#define FTS_DOC_ID_INDEX_NAME   "FTS_DOC_ID_INDEX"

The name of the index created by FTS

#define FTS_DOC_ID_LEN   8

Doc ID is a 8 byte value

#define FTS_INIT_FTS_TABLE (   fts_table,
  m_suffix,
  m_type,
  m_table 
)
Value:
do { \
(fts_table)->suffix = m_suffix; \
(fts_table)->type = m_type; \
(fts_table)->table_id = m_table->id; \
(fts_table)->parent = m_table->name; \
(fts_table)->table = m_table; \
} while (0);
Initialize the "fts_table" for internal query into FTS auxiliary

tables

#define FTS_INIT_INDEX_TABLE (   fts_table,
  m_suffix,
  m_type,
  m_index 
)
Value:
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; \
(fts_table)->table = m_index->table; \
(fts_table)->index_id = m_index->id; \
} while (0);
#define FTS_MAX_WORD_LEN   HA_FT_MAXBYTELEN

Maximum possible Fulltext word length

#define FTS_MAX_WORD_LEN_IN_CHAR   HA_FT_MAXCHARLEN

Maximum possible Fulltext word length (in characters)

#define FTS_NL   0
Defines for FTS query mode, they have the same values as

those defined in mysql file ft_global.h

#define FTS_NULL_DOC_ID   0

"NULL" value of a document id.

#define FTS_NUM_FIELDS_SORT   3
The number of fields to sort when we build FT index with

FIC. Three fields are sort: (word, doc_id, position)

#define FTS_OPTIMIZE_THRESHOLD   10000000

Threshold where our optimize thread automatically kicks in

#define fts_que_graph_free (   graph)
Value:
do { \
mutex_enter(&dict_sys->mutex); \
que_graph_free(graph); \
mutex_exit(&dict_sys->mutex); \
} while (0)
#define fts_read_doc_id (   s)    mach_read_from_8(s)

Read a document id to internal format.

#define fts_write_doc_id (   d,
 
)    mach_write_to_8(d, s)

Convert document id to the InnoDB (BIG ENDIAN) storage format.

#define MAX_DOC_ID_OPT_VAL   1073741824
Maximum number of rows in a table, smaller than which, we will

optimize using a 4 byte Doc ID for FIC merge sort to reduce sort size

#define STOPWORD_NOT_INIT   0x1

status bits for fts_stopword_t status field.

Typedef Documentation

typedef ib_uint64_t doc_id_t

Document id type.

typedef float fts_rank_t

FTS rank type, which will be between 0 .. 1 inclusive

typedef unsigned short ib_uc_t
Since MySQL's character set support for Unicode is woefully inadequate

(it supports basic operations like isalpha etc. only for 8-bit characters), we have to implement our own. We use UTF-16 without surrogate processing as our in-memory format. This typedef is a single such character.

Enumeration Type Documentation

Type of a row during a transaction. FTS_NOTHING means the row can be

forgotten from the FTS system's POV, FTS_INVALID is an internal value used to mark invalid states.

NOTE: Do not change the order or value of these, fts_trx_row_get_new_state depends on them being exactly as they are.

enum fts_status
Enumerator:
BG_THREAD_STOP 

TRUE if the FTS background thread has finished reading the ADDED table, meaning more items can be added to the table.

BG_THREAD_READY 

TRUE if the FTS background thread is ready

ADD_THREAD_STARTED 

TRUE if the FTS add thread has started

ADDED_TABLE_SYNCED 

TRUE if the ADDED table record is sync-ed after crash recovery

TABLE_DICT_LOCKED 

Set if the table has dict_sys->mutex

The FTS table types.

Enumerator:
FTS_INDEX_TABLE 

FTS auxiliary table that is specific to a particular FTS index on a table

FTS_COMMON_TABLE 

FTS auxiliary table that is common for all FTS index on a table

Function Documentation

UNIV_INTERN void fts_add_doc_id_column ( dict_table_t table,
mem_heap_t heap 
)

Add the FTS document id hidden column.

Parameters
tablein/out: Table with FTS index
heapin: temporary memory heap, or NULL
UNIV_INTERN void fts_add_index ( dict_index_t index,
dict_table_t table 
)

Add a newly create index in FTS cache table

Parameters
indexFTS index to be added
UNIV_INTERN void fts_cache_clear ( fts_cache_t cache)

Clear cache. in: cache

UNIV_INTERN fts_cache_t* fts_cache_create ( dict_table_t table)

Create a FTS cache. table owns the FTS cache

UNIV_INTERN void fts_cache_destroy ( fts_cache_t cache)

Free the FTS cache. in: cache

UNIV_INTERN fts_index_cache_t* fts_cache_index_cache_create ( dict_table_t table,
dict_index_t index 
)

Create a FTS index cache.

Returns
Index Cache in: FTS index
Parameters
tablein: table with FTS index
UNIV_INTERN void fts_cache_init ( fts_cache_t cache)

Initialize things in cache. in: cache

UNIV_INTERN ibool 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 in: Table where indexes are dropped fts0fts.h
UNIV_INTERN 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
UNIV_INTERN fts_t* fts_create ( dict_table_t table)

Create an instance of fts_t.

Returns
instance of fts_t out: table with FTS indexes
UNIV_INTERN 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 ancillary tables needed for supporting an FTS index on the given table. row_mysql_lock_data_dictionary must have been called before this.

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction handle
tablein: table with one FTS index
namein: table name
skip_doc_id_indexin: Skip index on doc id
UNIV_INTERN dberr_t fts_create_doc_id ( dict_table_t table,
dtuple_t row,
mem_heap_t heap 
)

Create a new document id .

Returns
DB_SUCCESS if all went well else error
Parameters
tablein: row is of this table.
rowin/out: add doc id value to this row. This is the current row that is being inserted.
heapin: heap
UNIV_INTERN dberr_t fts_create_index_tables ( trx_t trx,
const dict_index_t index 
)

Wrapper function of fts_create_index_tables_low(), create auxiliary tables for an FTS index

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction handle
indexin: the FTS index instance
UNIV_INTERN dberr_t fts_create_index_tables_low ( trx_t trx,
const dict_index_t index,
const char *  table_name,
table_id_t  table_id 
)

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.

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction handle
indexin: the FTS index instance
table_namein: the table name
table_idin: the table id
UNIV_INTERN fts_doc_ids_t* fts_doc_ids_create ( void  )

Create a new fts_doc_ids_t.

Returns
new fts_doc_ids_t.
UNIV_INTERN void fts_doc_ids_free ( fts_doc_ids_t doc_ids)

Free a fts_doc_ids_t. in: doc_ids to free

UNIV_INTERN dberr_t fts_drop_index ( dict_table_t table,
dict_index_t index,
trx_t trx 
)

Drop auxiliary tables related to an FTS index

Returns
DB_SUCCESS or error number
Parameters
tablein: Table where indexes are dropped
indexin: Index to be dropped
trxin: Transaction for the drop
UNIV_INTERN dberr_t fts_drop_index_split_tables ( trx_t trx,
dict_index_t index 
)

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

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction
indexin: fts instance
UNIV_INTERN dberr_t fts_drop_index_tables ( trx_t trx,
dict_index_t index 
)

Drops index ancillary tables for a FTS index

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction
indexin: Index to drop
UNIV_INTERN void fts_drop_orphaned_tables ( void  )

Drop all orphaned FTS auxiliary tables, those that don't have a parent table or FTS index defined on them.

UNIV_INTERN dberr_t fts_drop_tables ( trx_t trx,
dict_table_t table 
)

Drops the ancillary tables needed for supporting an FTS index on the given table. row_mysql_lock_data_dictionary must have been called before this.

Returns
DB_SUCCESS or error code
Parameters
trxin: transaction
tablein: table has the FTS index
UNIV_INTERN void fts_free ( dict_table_t table)

Free the FTS resources. in/out: table with FTS indexes

UNIV_INTERN doc_id_t fts_get_doc_id_from_rec ( dict_table_t table,
const rec_t *  rec,
mem_heap_t heap 
)

Extract the doc id from the FTS hidden column. in: heap

Parameters
tablein: table
recin: rec
UNIV_INTERN 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. in: row whose FTS doc id we want to extract.

Parameters
tablein: table
UNIV_INTERN ib_vector_t* fts_get_docs_create ( fts_cache_t cache)

Create the vector of fts_get_doc_t instances.

Returns
vector of fts_get_doc_t instances in: fts cache
UNIV_INTERN 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 in: user table
UNIV_INTERN dberr_t fts_get_next_doc_id ( const dict_table_t table,
doc_id_t doc_id 
)

Get the next available document id. This function creates a new transaction to generate the document id.

Returns
DB_SUCCESS if OK
Parameters
tablein: table
doc_idout: new document id
UNIV_INTERN ulint fts_get_rows_count ( fts_table_t fts_table)

Fetch COUNT(*) from specified table.

Returns
the number of rows in the table in: fts table to read
UNIV_INTERN CHARSET_INFO* fts_index_get_charset ( dict_index_t index)

Create an FTS index cache. in: FTS index

UNIV_INTERN 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 in: table
UNIV_INTERN ibool fts_init_index ( dict_table_t table,
ibool  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 in: Whether we already have cache lock
Parameters
tablein: Table with FTS
UNIV_INTERN ibool fts_load_stopword ( const dict_table_t table,
trx_t trx,
const char *  global_stopword_table,
const char *  session_stopword_table,
ibool  stopword_is_on,
ibool  reload 
)

This function loads specified stopword into FTS cache

Returns
TRUE if success in: Whether it is during reload of FTS table
Parameters
tablein: Table with FTS
trxin: Transaction
global_stopword_tablein: Global stopword table name
session_stopword_tablein: Session stopword table name
stopword_is_onin: Whether stopword option is turned on/off
UNIV_INTERN void fts_optimize_end ( void  )

Inform optimize to clean up.

UNIV_INTERN void fts_optimize_init ( void  )

Startup the optimize thread and create the work queue.

UNIV_INTERN ibool fts_optimize_is_init ( void  )

Check whether the work queue is initialized.

Returns
TRUE if optimze queue is initialized.
UNIV_INTERN void fts_optimize_remove_table ( dict_table_t table)

Remove the table from the OPTIMIZER's list. We do wait for acknowledgement from the consumer of the message. in: table to remove

UNIV_INTERN void fts_optimize_start_shutdown ( void  )

Signal the optimize thread to prepare for shutdown.

UNIV_INTERN dberr_t fts_optimize_table ( dict_table_t table)

Run OPTIMIZE on the given table.

Returns
DB_SUCCESS if all OK
Parameters
tablein: table to optimiza
UNIV_INTERN void fts_que_graph_free_check_lock ( fts_table_t fts_table,
const fts_index_cache_t index_cache,
que_t graph 
)

Free the query graph but check whether dict_sys->mutex is already held in: query graph

Parameters
fts_tablein: FTS table
index_cachein: FTS index cache
UNIV_INTERN dberr_t fts_query ( trx_t trx,
dict_index_t index,
uint  flags,
const byte *  query,
ulint  query_len,
fts_result_t **  result 
)

FTS Query entry point.

Returns
DB_SUCCESS if successful otherwise error code
Parameters
trxin: transaction
indexin: FTS index to search
flagsin: FTS search mode
queryin: FTS query
query_lenin: FTS query string len in bytes
resultout: query result, to be freed by the caller.
UNIV_INTERN void fts_query_free_result ( fts_result_t result)

FTS Query free result, returned by fts_query(). in: result instance to free.

UNIV_INTERN void fts_query_sort_result_on_rank ( fts_result_t result)

FTS Query sort result, returned by fts_query() on fts_ranking_t::rank. out: result instance to sort.

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

Rename auxiliary tables for all fts index for a table

Returns
DB_SUCCESS or error code in: transaction
Parameters
tablein: user Table
new_namein: new table name
UNIV_INTERN float fts_retrieve_ranking ( fts_result_t result,
doc_id_t  doc_id 
)

Retrieve the FTS Relevance Ranking result for doc with doc_id

Returns
the relevance ranking value. in: the interested document doc_id
Parameters
resultin: FTS result structure
UNIV_INTERN void fts_savepoint_laststmt_refresh ( trx_t trx)

Refresh last statement savepoint.

Parameters
trxin: transaction
UNIV_INTERN void fts_savepoint_release ( trx_t trx,
const char *  name 
)

Release the savepoint data identified by name. in: savepoint name

Parameters
trxin: transaction
UNIV_INTERN void fts_savepoint_rollback ( trx_t trx,
const char *  name 
)

Rollback to and including savepoint indentified by name. in: savepoint name

Parameters
trxin: transaction
UNIV_INTERN void fts_savepoint_rollback_last_stmt ( trx_t trx)

Rollback to and including savepoint indentified by name. in: transaction

UNIV_INTERN void fts_savepoint_take ( trx_t trx,
fts_trx_t fts_trx,
const char *  name 
)

Take a FTS savepoint.

Parameters
trxin: transaction
fts_trxin: fts transaction
namein: savepoint name
UNIV_INTERN void fts_shutdown ( dict_table_t table,
fts_t fts 
)

Wait for FTS threads to shutdown. in: fts instance to shutdown

Parameters
tablein: table with FTS indexes
UNIV_INTERN void fts_start_shutdown ( dict_table_t table,
fts_t fts 
)

Signal FTS threads to initiate shutdown. in: fts instance to shutdown

Parameters
tablein: table with FTS indexes
UNIV_INTERN void fts_startup ( void  )

FTS initialize.

UNIV_INTERN dberr_t fts_sync_table ( dict_table_t table)

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
tablein: table
UNIV_INTERN dberr_t fts_table_fetch_doc_ids ( trx_t trx,
fts_table_t fts_table,
fts_doc_ids_t doc_ids 
)

Read the rows from the FTS index

Returns
DB_SUCCESS if OK in: For collecting doc ids
Parameters
trxin: transaction
fts_tablein: aux table
UNIV_INTERN 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
trxin: InnoDB transaction
tablein: table
doc_idin: doc id
statein: state of the row
fts_indexesin: FTS indexes affected (NULL=all)
UNIV_INTERN void fts_trx_free ( fts_trx_t fts_trx)

Free an FTS trx. in, own: FTS trx

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

Update the query graph with a new document id.

Returns
Doc ID used out: buffer for writing
Parameters
tablein: table
ufieldout: update node
UNIV_INTERN 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
UNIV_INTERN CHARSET_INFO* fts_valid_stopword_table ( const char *  stopword_table_name)

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

Returns
the stopword column charset if qualifies in: Stopword table name
size_t innobase_fts_casedn_str ( CHARSET_INFO *  cs,
char *  src,
size_t  src_len,
char *  dst,
size_t  dst_len 
)

Makes all characters in a string lower case. in: buffer size

Parameters
csin: Character set
srcin: string to put in lower case
src_lenin: input string length
dstin: buffer for result string
int innobase_fts_text_cmp ( const void *  cs,
const void *  p1,
const void *  p2 
)

compare two character string according to their charset. in: node

Parameters
csin: Character set
p1in: key
int innobase_fts_text_cmp_prefix ( const void *  cs,
const void *  p1,
const void *  p2 
)

compare two character string according to their charset. in: node

Parameters
csin: Character set
p1in: key
ulint innobase_mysql_fts_get_token ( CHARSET_INFO *  charset,
const byte *  start,
const byte *  end,
fts_string_t token,
ulint *  offset 
)

Get the next token from the given string and store it in *token. out: offset to token, measured as characters from 'start'

Parameters
charsetin: Character set
startin: start of text
endin: one character past end of text
tokenout: token's text

Variable Documentation

char fts_enable_diag_print
Variable specifying whether we do additional FTS diagnostic printout

in the log

char* fts_internal_tbl_name
Variable specifying the table that has Fulltext index to display its

content through information schema table

ulong fts_max_cache_size

Variable specifying the maximum FTS cache size for each table

ulong fts_max_token_size

Variable specifying the maximum FTS max token size

ulong fts_max_total_cache_size

Variable specifying the total memory allocated for FTS cache

ulong fts_min_token_size

Variable specifying the minimum FTS max token size

bool fts_need_sync
Whether the total memory used for FTS cache is exhausted, and we will

need a sync to free some memory

ulong fts_num_word_optimize
Variable specifying the number of word to optimize for each optimize table

call

ulong fts_result_cache_limit

Variable specifying the FTS result cache limit for each query

ulong fts_sort_pll_degree

Variable specifying the FTS parallel sort degree