InnoDB Plugin  1.0
fts0priv.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2011, 2013, 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 INNOBASE_FTS0PRIV_H
27 #define INNOBASE_FTS0PRIV_H
28 
29 #include "dict0dict.h"
30 #include "pars0pars.h"
31 #include "que0que.h"
32 #include "que0types.h"
33 #include "fts0types.h"
34 
35 /* The various states of the FTS sub system pertaining to a table with
36 FTS indexes defined on it. */
38  /* !<This must be 0 since we insert
39  a hard coded '0' at create time
40  to the config table */
41 
48 };
49 
50 typedef enum fts_table_state_enum fts_table_state_t;
51 
53 #define FTS_MAX_BACKGROUND_THREAD_WAIT 10000
54 
56 #define FTS_BACKGROUND_THREAD_WAIT_COUNT 1000
57 
59 #define FTS_MAX_CONFIG_NAME_LEN 64
60 
62 #define FTS_MAX_CONFIG_VALUE_LEN 1024
63 
65 #define FTS_ILIST_MAX_SIZE (64 * 1024)
66 
70 #define FTS_OPTIMIZE_LIMIT_IN_SECS "optimize_checkpoint_limit"
71 
73 #define FTS_SYNCED_DOC_ID "synced_doc_id"
74 
76 #define FTS_LAST_OPTIMIZED_WORD "last_optimized_word"
77 
80 #define FTS_TOTAL_DELETED_COUNT "deleted_doc_count"
81 
83 #define FTS_TOTAL_WORD_COUNT "total_word_count"
84 
86 #define FTS_OPTIMIZE_START_TIME "optimize_start_time"
87 
89 #define FTS_OPTIMIZE_END_TIME "optimize_end_time"
90 
92 #define FTS_STOPWORD_TABLE_NAME "stopword_table_name"
93 
95 #define FTS_USE_STOPWORD "use_stopword"
96 
99 #define FTS_TABLE_STATE "table_state"
100 
109 #define FTS_AUX_MIN_TABLE_ID_LENGTH 48
110 
112 #define FTS_MAX_INT_LEN 32
113 
114 /******************************************************************/
117 UNIV_INTERN
118 que_t*
120 /*==========*/
121  fts_table_t* fts_table,
122  pars_info_t* info,
123  const char* sql)
124  __attribute__((nonnull(3), malloc, warn_unused_result));
125 /******************************************************************/
128 UNIV_INTERN
129 dberr_t
131 /*=========*/
132  trx_t* trx,
133  que_t* graph)
134  __attribute__((nonnull, warn_unused_result));
135 /******************************************************************/
138 UNIV_INTERN
139 char*
141 /*===============*/
142  const fts_table_t*
143  fts_table)
144  __attribute__((nonnull, malloc, warn_unused_result));
145 /******************************************************************/
160 UNIV_INTERN
161 const char*
163 /*=======================*/
164  dict_index_t* index,
165  pars_info_t* info,
166  mem_heap_t* heap)
167  __attribute__((nonnull, warn_unused_result));
168 
172 #define FTS_FETCH_DOC_BY_ID_EQUAL 1
173 #define FTS_FETCH_DOC_BY_ID_LARGE 2
174 #define FTS_FETCH_DOC_BY_ID_SMALL 3
175 
176 /*************************************************************/
180 UNIV_INTERN
181 dberr_t
183 /*====================*/
184  fts_get_doc_t* get_doc,
185  doc_id_t doc_id,
186  dict_index_t* index_to_use,
188  ulint option,
191  callback,
193  void* arg)
194  __attribute__((nonnull(6)));
195 
196 /*******************************************************************/
200 UNIV_INTERN
201 ibool
203 /*==========================*/
204  void* row,
205  void* user_arg)
206  __attribute__((nonnull));
207 /********************************************************************
208 Write out a single word's data as new entry/entries in the INDEX table.
209 @return DB_SUCCESS if all OK. */
210 UNIV_INTERN
211 dberr_t
213 /*===========*/
214  trx_t* trx,
215  que_t** graph,
216  fts_table_t* fts_table,
217  fts_string_t* word,
218  fts_node_t* node)
219  __attribute__((nonnull, warn_unused_result));
220 /*******************************************************************/
222 UNIV_INTERN
223 void
225 /*==================*/
226  fts_doc_t* doc,
228  fts_doc_t* result)
230  __attribute__((nonnull(1)));
231 
232 /*******************************************************************/
234 UNIV_INTERN
235 void
237 /*=======================*/
238  fts_doc_t* doc,
240  ulint add_pos,
242  fts_doc_t* result)
244  __attribute__((nonnull(1)));
245 /******************************************************************/
247 UNIV_INTERN
248 void
250 /*=========*/
251  fts_doc_t* doc)
252  __attribute__((nonnull));
253 
254 /******************************************************************/
258 UNIV_INTERN
259 int
261 /*========*/
262  fts_update_t* array,
263  int lower,
264  int upper,
265  doc_id_t doc_id)
266  __attribute__((nonnull, warn_unused_result));
267 /******************************************************************/
269 UNIV_INTERN
270 void
272 /*=========*/
273  fts_doc_t* doc)
274  __attribute__((nonnull));
275 /******************************************************************/
277 UNIV_INTERN
278 void
280 /*==========*/
281  fts_word_t* word)
282  __attribute__((nonnull));
283 /******************************************************************/
286 UNIV_INTERN
287 dberr_t
289 /*==================*/
290  trx_t* trx,
291  que_t** graph,
292  fts_table_t* fts_table,
293  const fts_string_t*
294  word,
295  fts_fetch_t* fetch)
296  __attribute__((nonnull));
297 /******************************************************************/
300 UNIV_INTERN
301 fts_word_t*
303 /*==========*/
304  fts_word_t* word,
305  byte* utf8,
306  ulint len)
307  __attribute__((nonnull));
308 /******************************************************************/
312 UNIV_INLINE
313 int
315 /*==============*/
316  const void* v1,
317  const void* v2)
318  __attribute__((nonnull, warn_unused_result));
319 /******************************************************************/
322 UNIV_INLINE
323 int
325 /*=================*/
326  const void* p1,
327  const void* p2)
328  __attribute__((nonnull, warn_unused_result));
329 /******************************************************************/
332 UNIV_INTERN
333 dberr_t
335 /*===========*/
336  trx_t* trx)
337  __attribute__((nonnull));
338 /******************************************************************/
341 UNIV_INTERN
342 dberr_t
344 /*=============*/
345  trx_t* trx)
346  __attribute__((nonnull));
347 /******************************************************************/
351 UNIV_INTERN
352 que_t*
354 /*=======================*/
355  fts_table_t* fts_table,
356  pars_info_t* info,
357  const char* sql)
358  __attribute__((nonnull(3), malloc, warn_unused_result));
359 /******************************************************************/
363 UNIV_INTERN
364 dberr_t
366 /*=================*/
367  trx_t* trx, /* transaction */
368  fts_table_t* fts_table,
369  const char* name,
371  fts_string_t* value)
373  __attribute__((nonnull));
374 /******************************************************************/
379 UNIV_INTERN
380 dberr_t
382 /*=======================*/
383  trx_t* trx,
384  dict_index_t* index,
385  const char* param,
387  fts_string_t* value)
389  __attribute__((nonnull, warn_unused_result));
390 /******************************************************************/
393 UNIV_INTERN
394 dberr_t
396 /*=================*/
397  trx_t* trx,
398  fts_table_t* fts_table,
399  const char* name,
401  const fts_string_t*
402  value)
403  __attribute__((nonnull));
404 /****************************************************************/
407 UNIV_INTERN
408 dberr_t
410 /*=================*/
411  trx_t* trx,
412  fts_table_t* fts_table,
413  const char* name,
414  ulint int_value)
415  __attribute__((nonnull, warn_unused_result));
416 /******************************************************************/
419 UNIV_INTERN
420 dberr_t
422 /*=======================*/
423  trx_t* trx,
424  dict_index_t* index,
425  const char* param,
427  fts_string_t* value)
429  __attribute__((nonnull, warn_unused_result));
430 /******************************************************************/
433 UNIV_INTERN
434 dberr_t
436 /*=======================*/
437  trx_t* trx,
438  fts_table_t* fts_table,
439  const char* name,
441  ulint delta)
442  __attribute__((nonnull, warn_unused_result));
443 /******************************************************************/
446 UNIV_INTERN
447 dberr_t
449 /*=============================*/
450  trx_t* trx,
451  dict_index_t* index,
452  const char* name,
454  ulint delta)
455  __attribute__((nonnull));
456 /******************************************************************/
459 UNIV_INTERN
460 dberr_t
462 /*=======================*/
463  trx_t* trx,
464  dict_index_t* index,
465  const char* name,
466  ulint* int_value)
467  __attribute__((nonnull, warn_unused_result));
468 /******************************************************************/
471 UNIV_INTERN
472 dberr_t
474 /*=======================*/
475  trx_t* trx,
476  dict_index_t* index,
477  const char* name,
478  ulint int_value)
479  __attribute__((nonnull, warn_unused_result));
480 /******************************************************************/
483 UNIV_INTERN
484 dberr_t
486 /*=================*/
487  trx_t* trx,
488  fts_table_t* fts_table,
489  const char* name,
490  ulint* int_value)
491  __attribute__((nonnull));
492 /******************************************************************/
495 UNIV_INTERN
496 const ib_vector_t*
498 /*================*/
499  const fts_index_cache_t*
500  index_cache,
501  const fts_string_t*
502  text)
503  __attribute__((nonnull, warn_unused_result));
504 /******************************************************************/
507 UNIV_INTERN
508 ibool
510 /*========================*/
511  const fts_cache_t*
512  cache,
513  doc_id_t doc_id)
514  __attribute__((nonnull, warn_unused_result));
515 /******************************************************************/
517 UNIV_INTERN
518 void
520 /*=============================*/
521  const fts_cache_t*
522  cache,
523  ib_vector_t* vector);
524 /******************************************************************/
529 UNIV_INTERN
530 ibool
532 /*====================================*/
533  dict_table_t* table,
535  ulint max_wait);
538 #ifdef FTS_DOC_STATS_DEBUG
539 /******************************************************************/
542 UNIV_INTERN
543 dberr_t
544 fts_get_total_word_count(
545 /*=====================*/
546  trx_t* trx,
547  dict_index_t* index,
548  ulint* total)
549  __attribute__((nonnull, warn_unused_result));
550 #endif
551 /******************************************************************/
554 UNIV_INTERN
557 /*================*/
558  const fts_cache_t*
559  cache,
560  const dict_index_t*
561  index)
562  __attribute__((nonnull, warn_unused_result));
563 /******************************************************************/
567 UNIV_INLINE
568 int
570 /*================*/
571  ib_id_t id,
572  char* str,
573  bool hex_format __attribute__((unused)))
576  __attribute__((nonnull));
577 /******************************************************************/
580 UNIV_INLINE
581 ibool
583 /*===============*/
584  ib_id_t* id,
585  const char* str)
586  __attribute__((nonnull, warn_unused_result));
587 /******************************************************************/
590 UNIV_INTERN
591 int
593 /*=============*/
594  const fts_table_t*
595  fts_table,
596  char* table_id)
599  __attribute__((nonnull, warn_unused_result));
600 /******************************************************************/
602 UNIV_INTERN
603 void
605 /*===================*/
606  dict_table_t* table)
607  __attribute__((nonnull));
608 /******************************************************************/
610 UNIV_INTERN
611 void
613 /*==================*/
614  dict_table_t* table)
615  __attribute__((nonnull));
616 /******************************************************************/
619 UNIV_INTERN
620 char*
622 /*======================*/
623  const fts_table_t*
624  fts_table)
625  __attribute__((nonnull, malloc, warn_unused_result));
626 /******************************************************************/
628 UNIV_INTERN
629 void
631 /*=========================*/
632  fts_cache_t* cache,
633  fts_node_t* node,
634  doc_id_t doc_id,
635  ib_vector_t* positions)
636  __attribute__((nonnull(2,4)));
637 
638 /******************************************************************/
641 UNIV_INTERN
642 char*
644 /*===============================*/
645  const char* param,
646  const dict_index_t* index)
647  __attribute__((nonnull, malloc, warn_unused_result));
648 
649 #ifndef UNIV_NONINL
650 #include "fts0priv.ic"
651 #endif
652 
653 #endif /* INNOBASE_FTS0PRIV_H */