InnoDB Plugin  1.0
row0ftsort.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2010, 2012, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #ifndef row0ftsort_h
27 #define row0ftsort_h
28 
29 #include "univ.i"
30 #include "data0data.h"
31 #include "dict0types.h"
32 #include "row0mysql.h"
33 #include "fts0fts.h"
34 #include "fts0types.h"
35 #include "fts0priv.h"
36 #include "row0merge.h"
37 
42 
44 struct fts_doc_item {
47  UT_LIST_NODE_T(fts_doc_item_t) doc_list;
49 };
50 
53 typedef UT_LIST_BASE_NODE_T(fts_doc_item_t) fts_doc_list_t;
54 
55 #define FTS_NUM_AUX_INDEX 6
56 #define FTS_PLL_MERGE 1
57 
59 struct fts_psort_t;
60 
69  ibool opt_doc_id_size;
74 };
75 
76 struct fts_psort_t {
77  ulint psort_id;
78  row_merge_buf_t* merge_buf[FTS_NUM_AUX_INDEX];
80  merge_file_t* merge_file[FTS_NUM_AUX_INDEX];
82  row_merge_block_t* merge_block[FTS_NUM_AUX_INDEX];
84  row_merge_block_t* block_alloc[FTS_NUM_AUX_INDEX];
86  ulint child_status;
87  ulint state;
88  fts_doc_list_t fts_doc_list;
90  os_thread_t thread_hdl;
92  ulint memory_used;
94 };
95 
98  ulint processed_len;
99  ulint init_pos;
100  ulint buf_used;
103  ulint rows_added[FTS_NUM_AUX_INDEX];
107  dfield_t sort_field[FTS_NUM_FIELDS_SORT];
109 };
110 
111 typedef struct fts_tokenize_ctx fts_tokenize_ctx_t;
112 
119  CHARSET_INFO* charset;
121  ibool opt_doc_id_size;
123 };
124 
125 typedef struct fts_psort_insert fts_psort_insert_t;
126 
127 
129 #define FTS_PARENT_COMPLETE 1
130 #define FTS_PARENT_EXITING 2
131 #define FTS_CHILD_COMPLETE 1
132 #define FTS_CHILD_EXITING 2
133 
135 #define FTSORT_PRINT
136 
137 #ifdef FTSORT_PRINT
138 #define DEBUG_FTS_SORT_PRINT(str) \
139  do { \
140  ut_print_timestamp(stderr); \
141  fprintf(stderr, str); \
142  } while (0)
143 #else
144 #define DEBUG_FTS_SORT_PRINT(str)
145 #endif /* FTSORT_PRINT */
146 
147 /*************************************************************/
156 UNIV_INTERN
159 /*============================*/
160  dict_index_t* index,
163  const dict_table_t* table,
170 /********************************************************************/
173 UNIV_INTERN
174 ibool
176 /*====================*/
177  trx_t* trx,
178  row_merge_dup_t* dup,
180  const dict_table_t* new_table,
186  fts_psort_t** psort,
188  fts_psort_t** merge)
190  __attribute__((nonnull));
191 /********************************************************************/
194 UNIV_INTERN
195 void
197 /*=======================*/
198  fts_psort_t* psort_info,
199  fts_psort_t* merge_info);
200 /********************************************************************/
202 UNIV_INTERN
203 void
205 /*=======================*/
206  fts_psort_t* psort_info);
208 /*********************************************************************/
211 UNIV_INTERN
212 os_thread_ret_t
214 /*======================*/
215  void* arg);
216 /*********************************************************************/
218 UNIV_INTERN
219 void
221 /*================*/
222  fts_psort_t* psort_info);
223 /*********************************************************************/
226 UNIV_INTERN
227 os_thread_ret_t
229 /*===============*/
230  void* arg);
231 /*********************************************************************/
233 UNIV_INTERN
234 void
236 /*=========================*/
237  fts_psort_t* merge_info);
238 /********************************************************************/
241 UNIV_INTERN
242 void
244 /*=================*/
246  ins_ctx,
247  fts_tokenizer_word_t* word,
249  ib_vector_t* positions,
250  doc_id_t* in_doc_id,
251  dtuple_t* dtuple);
252 /********************************************************************/
255 UNIV_INTERN
256 int
258 /*========================*/
259  int propogated, /*<! in: tree node propagated */
260  int* sel_tree, /*<! in: selection tree */
261  ulint level, /*<! in: selection tree level */
262  const mrec_t** mrec, /*<! in: sort record */
263  ulint** offsets, /*<! in: record offsets */
264  dict_index_t* index); /*<! in: FTS index */
265 /********************************************************************/
269 UNIV_INTERN
270 dberr_t
272 /*=================*/
273  dict_index_t* index,
274  dict_table_t* table,
275  fts_psort_t* psort_info,
276  ulint id) /* !< in: which auxiliary table's data
277  to insert to */
278  __attribute__((nonnull));
279 #endif /* row0ftsort_h */