MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 {
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;
91 };
92 
95  ulint processed_len;
96  ulint init_pos;
97  ulint buf_used;
100  ulint rows_added[FTS_NUM_AUX_INDEX];
104  dfield_t sort_field[FTS_NUM_FIELDS_SORT];
106 };
107 
108 typedef struct fts_tokenize_ctx fts_tokenize_ctx_t;
109 
118  ibool opt_doc_id_size;
120 };
121 
122 typedef struct fts_psort_insert fts_psort_insert_t;
123 
124 
126 #define FTS_PARENT_COMPLETE 1
127 #define FTS_CHILD_COMPLETE 1
128 #define FTS_CHILD_EXITING 2
129 
131 #define FTSORT_PRINT
132 
133 #ifdef FTSORT_PRINT
134 #define DEBUG_FTS_SORT_PRINT(str) \
135  do { \
136  ut_print_timestamp(stderr); \
137  fprintf(stderr, str); \
138  } while (0)
139 #else
140 #define DEBUG_FTS_SORT_PRINT(str)
141 #endif /* FTSORT_PRINT */
142 
143 /*************************************************************/
152 UNIV_INTERN
155 /*============================*/
159  const dict_table_t* table,
161  ibool* opt_doc_id_size);
166 /********************************************************************/
169 UNIV_INTERN
170 ibool
172 /*====================*/
173  trx_t* trx,
174  row_merge_dup_t* dup,
176  const dict_table_t* new_table,
178  ibool opt_doc_id_size,
182  fts_psort_t** psort,
184  fts_psort_t** merge)
186  __attribute__((nonnull));
187 /********************************************************************/
190 UNIV_INTERN
191 void
193 /*=======================*/
194  fts_psort_t* psort_info,
195  fts_psort_t* merge_info);
196 /********************************************************************/
198 UNIV_INTERN
199 void
201 /*=======================*/
202  fts_psort_t* psort_info);
204 /*********************************************************************/
207 UNIV_INTERN
208 os_thread_ret_t
210 /*======================*/
211  void* arg);
212 /*********************************************************************/
214 UNIV_INTERN
215 void
217 /*================*/
218  fts_psort_t* psort_info);
219 /*********************************************************************/
222 UNIV_INTERN
223 os_thread_ret_t
225 /*===============*/
226  void* arg);
227 /*********************************************************************/
229 UNIV_INTERN
230 void
232 /*=========================*/
233  fts_psort_t* merge_info);
234 /********************************************************************/
237 UNIV_INTERN
238 void
240 /*=================*/
242  ins_ctx,
245  ib_vector_t* positions,
246  doc_id_t* in_doc_id,
247  dtuple_t* dtuple);
248 /********************************************************************/
251 UNIV_INTERN
252 int
254 /*========================*/
255  int propogated, /*<! in: tree node propagated */
256  int* sel_tree, /*<! in: selection tree */
257  ulint level, /*<! in: selection tree level */
258  const mrec_t** mrec, /*<! in: sort record */
259  ulint** offsets, /*<! in: record offsets */
260  dict_index_t* index); /*<! in: FTS index */
261 /********************************************************************/
265 UNIV_INTERN
266 dberr_t
268 /*=================*/
271  fts_psort_t* psort_info,
272  ulint id) /* !< in: which auxiliary table's data
273  to insert to */
274  __attribute__((nonnull));
275 #endif /* row0ftsort_h */