MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
row0ftsort.h File Reference
#include "univ.i"
#include "data0data.h"
#include "dict0types.h"
#include "row0mysql.h"
#include "fts0fts.h"
#include "fts0types.h"
#include "fts0priv.h"
#include "row0merge.h"
Include dependency graph for row0ftsort.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fts_doc_item
struct  fts_psort_common_t
struct  fts_psort_t
struct  fts_tokenize_ctx
struct  fts_psort_insert

Macros

#define FTS_NUM_AUX_INDEX   6
#define FTS_PLL_MERGE   1
#define FTS_PARENT_COMPLETE   1
#define FTS_CHILD_COMPLETE   1
#define FTS_CHILD_EXITING   2
#define FTSORT_PRINT
#define DEBUG_FTS_SORT_PRINT(str)

Typedefs

typedef struct fts_doc_item fts_doc_item_t
typedef struct fts_tokenize_ctx fts_tokenize_ctx_t
typedef struct fts_psort_insert fts_psort_insert_t

Functions

typedef UT_LIST_BASE_NODE_T (fts_doc_item_t) fts_doc_list_t
UNIV_INTERN dict_index_trow_merge_create_fts_sort_index (dict_index_t *index, const dict_table_t *table, ibool *opt_doc_id_size)
UNIV_INTERN ibool row_fts_psort_info_init (trx_t *trx, row_merge_dup_t *dup, const dict_table_t *new_table, ibool opt_doc_id_size, fts_psort_t **psort, fts_psort_t **merge) __attribute__((nonnull))
UNIV_INTERN void row_fts_psort_info_destroy (fts_psort_t *psort_info, fts_psort_t *merge_info)
UNIV_INTERN void row_fts_free_pll_merge_buf (fts_psort_t *psort_info)
UNIV_INTERN os_thread_ret_t fts_parallel_tokenization (void *arg)
UNIV_INTERN void row_fts_start_psort (fts_psort_t *psort_info)
UNIV_INTERN os_thread_ret_t fts_parallel_merge (void *arg)
UNIV_INTERN void row_fts_start_parallel_merge (fts_psort_t *merge_info)
UNIV_INTERN void row_fts_insert_tuple (fts_psort_insert_t *ins_ctx, fts_tokenizer_word_t *word, ib_vector_t *positions, doc_id_t *in_doc_id, dtuple_t *dtuple)
UNIV_INTERN int row_merge_fts_sel_propagate (int propogated, int *sel_tree, ulint level, const mrec_t **mrec, ulint **offsets, dict_index_t *index)
UNIV_INTERN dberr_t row_fts_merge_insert (dict_index_t *index, dict_table_t *table, fts_psort_t *psort_info, ulint id) __attribute__((nonnull))

Detailed Description

Create Full Text Index with (parallel) merge sort

Created 10/13/2010 Jimmy Yang

Definition in file row0ftsort.h.

Macro Definition Documentation

#define DEBUG_FTS_SORT_PRINT (   str)
Value:
do { \
ut_print_timestamp(stderr); \
fprintf(stderr, str); \
} while (0)

Definition at line 134 of file row0ftsort.h.

#define FTS_PARENT_COMPLETE   1

status bit used for communication between parent and child thread

Definition at line 126 of file row0ftsort.h.

#define FTSORT_PRINT

Print some debug information

Definition at line 131 of file row0ftsort.h.

Typedef Documentation

typedef struct fts_doc_item fts_doc_item_t
This structure defineds information the scan thread will fetch

and put to the linked list for parallel tokenization/sort threads to process

Definition at line 41 of file row0ftsort.h.

Function Documentation

UNIV_INTERN os_thread_ret_t fts_parallel_merge ( void *  arg)

Function performs the merge and insertion of the sorted records.

Returns
OS_THREAD_DUMMY_RETURN in: parallel merge info

Function performs the merge and insertion of the sorted records.

Returns
OS_THREAD_DUMMY_RETURN
Parameters
argin: parallel merge info

Definition at line 881 of file row0ftsort.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN os_thread_ret_t fts_parallel_tokenization ( void *  arg)

Function performs parallel tokenization of the incoming doc strings.

Returns
OS_THREAD_DUMMY_RETURN in: psort_info for the thread

Function performs parallel tokenization of the incoming doc strings. It also performs the initial in memory sort of the parsed records.

Returns
OS_THREAD_DUMMY_RETURN
Parameters
argin: psort_info for the thread

Definition at line 553 of file row0ftsort.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void row_fts_free_pll_merge_buf ( fts_psort_t psort_info)

Free up merge buffers when merge sort is done in: parallel sort info

Free up merge buffers when merge sort is done

Parameters
psort_infoin: parallel sort info

Definition at line 332 of file row0ftsort.cc.

Here is the call graph for this function:

UNIV_INTERN void row_fts_insert_tuple ( fts_psort_insert_t ins_ctx,
fts_tokenizer_word_t word,
ib_vector_t positions,
doc_id_t in_doc_id,
dtuple_t dtuple 
)

Read sorted FTS data files and insert data tuples to auxillary tables.

Returns
DB_SUCCESS or error number in: entry to insert
Parameters
ins_ctxin: insert context
wordin: last processed tokenized word
positionsin: word position
in_doc_idin: last item doc id
UNIV_INTERN dberr_t row_fts_merge_insert ( dict_index_t index,
dict_table_t table,
fts_psort_t psort_info,
ulint  id 
)

Read sorted file containing index data tuples and insert these data tuples to the index

Returns
DB_SUCCESS or error number
Parameters
indexin: index
tablein: new table
psort_infoparallel sort info

Here is the caller graph for this function:

UNIV_INTERN void row_fts_psort_info_destroy ( fts_psort_t psort_info,
fts_psort_t merge_info 
)

Clean up and deallocate FTS parallel sort structures, and close temparary merge sort files parallel merge info

Clean up and deallocate FTS parallel sort structures, and close the merge sort files

Parameters
psort_infoparallel sort info
merge_infoparallel merge info

Definition at line 294 of file row0ftsort.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN ibool row_fts_psort_info_init ( trx_t trx,
row_merge_dup_t dup,
const dict_table_t new_table,
ibool  opt_doc_id_size,
fts_psort_t **  psort,
fts_psort_t **  merge 
)

Initialize FTS parallel sort structures.

Returns
TRUE if all successful
Parameters
trxin: transaction
dupin,own: descriptor of FTS index being created
new_tablein: table on which indexes are created
opt_doc_id_sizein: whether to use 4 bytes instead of 8 bytes integer to store Doc ID during sort
psortout: parallel sort info to be instantiated
mergeout: parallel merge info to be instantiated

Definition at line 171 of file row0ftsort.cc.

Here is the call graph for this function:

UNIV_INTERN void row_fts_start_parallel_merge ( fts_psort_t merge_info)

Kick off the parallel merge and insert thread in: parallel sort info

Kick off the parallel merge and insert thread

Parameters
merge_infoin: parallel sort info

Definition at line 913 of file row0ftsort.cc.

Here is the call graph for this function:

UNIV_INTERN void row_fts_start_psort ( fts_psort_t psort_info)

Start the parallel tokenization and parallel merge sort in: parallel sort info

Start the parallel tokenization and parallel merge sort

Parameters
psort_infoparallel sort structure

Definition at line 861 of file row0ftsort.cc.

Here is the call graph for this function:

UNIV_INTERN dict_index_t* row_merge_create_fts_sort_index ( dict_index_t index,
const dict_table_t table,
ibool *  opt_doc_id_size 
)

Create a temporary "fts sort index" used to merge sort the tokenized doc string. The index has three "fields":

1) Tokenized word, 2) Doc ID 3) Word's position in original 'doc'.

Returns
dict_index_t structure for the fts sort index out: whether to use 4 bytes instead of 8 bytes integer to store Doc ID during sort

Create a temporary "fts sort index" used to merge sort the tokenized doc string. The index has three "fields":

1) Tokenized word, 2) Doc ID (depend on number of records to sort, it can be a 4 bytes or 8 bytes integer value) 3) Word's position in original doc.

Returns
dict_index_t structure for the fts sort index
Parameters
indexin: Original FTS index based on which this sort index is created
tablein: table that FTS index is being created on
opt_doc_id_sizeout: whether to use 4 bytes instead of 8 bytes integer to store Doc ID during sort

Definition at line 63 of file row0ftsort.cc.

Here is the call graph for this function:

UNIV_INTERN int row_merge_fts_sel_propagate ( int  propogated,
int *  sel_tree,
ulint  level,
const mrec_t **  mrec,
ulint **  offsets,
dict_index_t index 
)

Propagate a newly added record up one level in the selection tree

Returns
parent where this value propagated to
typedef UT_LIST_BASE_NODE_T ( fts_doc_item_t  )
This defines the list type that scan thread would feed the parallel

tokenization threads and sort threads.