InnoDB Plugin  1.0
dict0dict.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
4 Copyright (c) 2012, Facebook Inc.
5 
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free Software
8 Foundation; version 2 of the License.
9 
10 This program is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17 
18 *****************************************************************************/
19 
20 /**************************************************/
27 #ifndef dict0dict_h
28 #define dict0dict_h
29 
30 #include "univ.i"
31 #include "db0err.h"
32 #include "dict0types.h"
33 #include "dict0mem.h"
34 #include "data0type.h"
35 #include "data0data.h"
36 #include "mem0mem.h"
37 #include "rem0types.h"
38 #include "ut0mem.h"
39 #include "ut0lst.h"
40 #include "hash0hash.h"
41 #include "ut0rnd.h"
42 #include "ut0byte.h"
43 #include "trx0types.h"
44 #include "row0types.h"
45 
46 #ifndef UNIV_HOTBACKUP
47 # include "sync0sync.h"
48 # include "sync0rw.h"
49 /******************************************************************/
51 UNIV_INTERN
52 void
54 /*============*/
55  char* a)
56  __attribute__((nonnull));
57 /********************************************************************/
60 UNIV_INTERN
61 ulint
63 /*=================*/
64  const char* name)
66  __attribute__((nonnull, warn_unused_result));
67 /*********************************************************************/
72 UNIV_INTERN
73 char*
75 /*======================*/
76  const char* name,
77  const char* database_name,
78  ulint database_name_len,
79  const char* table_name,
80  ulint table_name_len,
81  dict_table_t** table,
82  mem_heap_t* heap);
83 /*********************************************************************/
86 void
88 /*==============*/
89  dict_foreign_t* foreign);
90 /*********************************************************************/
95 UNIV_INTERN
96 ulint
98 /*==============================*/
99  dict_table_t* table);
101 /********************************************************************/
104 UNIV_INTERN
105 const char*
107 /*================*/
108  const char* name)
110  __attribute__((nonnull, warn_unused_result));
111 
121 };
122 
123 /**********************************************************************/
126 UNIV_INTERN
129 /*==================*/
130  table_id_t table_id,
131  ibool dict_locked,
132  dict_table_op_t table_op)
133  __attribute__((warn_unused_result));
134 /********************************************************************/
136 UNIV_INTERN
137 void
139 /*=============*/
140  dict_table_t* table,
141  ibool dict_locked,
142  ibool try_drop)
145  __attribute__((nonnull));
146 /**********************************************************************/
148 UNIV_INTERN
149 void
150 dict_init(void);
151 /*===========*/
152 /********************************************************************/
158 UNIV_INTERN
159 void
161 /*=========================*/
162 /*********************************************************************/
165 UNIV_INLINE
166 ulint
168 /*==================*/
169  const dict_col_t* col)
170  __attribute__((nonnull, warn_unused_result));
171 /*********************************************************************/
174 UNIV_INLINE
175 ulint
177 /*==================*/
178  const dict_col_t* col)
179  __attribute__((nonnull, warn_unused_result));
180 /*********************************************************************/
182 UNIV_INLINE
183 void
185 /*=====================*/
186  dict_col_t* col,
187  ulint mbminlen,
189  ulint mbmaxlen)
191  __attribute__((nonnull));
192 /*********************************************************************/
194 UNIV_INLINE
195 void
197 /*===============*/
198  const dict_col_t* col,
199  dtype_t* type)
200  __attribute__((nonnull));
201 /**********************************************************************/
206 UNIV_INLINE
207 ulint
209 /*==========================*/
210  dict_table_t* table,
211  const dict_col_t* col)
213  __attribute__((nonnull, warn_unused_result));
214 #endif /* !UNIV_HOTBACKUP */
215 #ifdef UNIV_DEBUG
216 /*********************************************************************/
219 UNIV_INLINE
220 ibool
222 /*=======================*/
223  const dict_col_t* col,
224  const dtype_t* type)
225  __attribute__((nonnull, warn_unused_result));
226 #endif /* UNIV_DEBUG */
227 #ifndef UNIV_HOTBACKUP
228 /***********************************************************************/
231 UNIV_INLINE
232 ulint
234 /*==================*/
235  const dict_col_t* col)
236  __attribute__((nonnull, warn_unused_result));
237 /***********************************************************************/
240 UNIV_INLINE
241 ulint
243 /*==================*/
244  const dict_col_t* col)
245  __attribute__((nonnull, warn_unused_result));
246 /***********************************************************************/
249 UNIV_INLINE
250 ulint
252 /*====================*/
253  const dict_col_t* col,
254  ulint comp)
255  __attribute__((nonnull, warn_unused_result));
256 /***********************************************************************/
260 UNIV_INLINE
261 ulint
263 /*=======================*/
264  const dict_col_t* col,
265  ulint comp)
266  __attribute__((nonnull, warn_unused_result));
267 /*********************************************************************/
270 UNIV_INLINE
271 ulint
273 /*============*/
274  const dict_col_t* col)
275  __attribute__((nonnull, warn_unused_result));
276 /*********************************************************************/
278 UNIV_INLINE
279 ulint
281 /*===================*/
282  const dict_col_t* col,
283  const dict_index_t* clust_index)
284  __attribute__((nonnull, warn_unused_result));
285 /****************************************************************/
289 UNIV_INTERN
290 ibool
292 /*======================*/
293  const char* name)
294  __attribute__((nonnull, warn_unused_result));
295 /********************************************************************/
297 UNIV_INTERN
298 void
300 /*====================*/
301  dict_table_t* table)
302  __attribute__((nonnull));
303 /********************************************************************/
305 UNIV_INTERN
306 void
308 /*==========================*/
309  dict_table_t* table,
310  ib_uint64_t value)
311  __attribute__((nonnull));
312 /********************************************************************/
316 UNIV_INTERN
317 ib_uint64_t
319 /*====================*/
320  const dict_table_t* table)
321  __attribute__((nonnull, warn_unused_result));
322 /********************************************************************/
325 UNIV_INTERN
326 void
328 /*=================================*/
329 
330  dict_table_t* table,
331  ib_uint64_t value)
332  __attribute__((nonnull));
333 /********************************************************************/
335 UNIV_INTERN
336 void
338 /*======================*/
339  dict_table_t* table)
340  __attribute__((nonnull));
341 #endif /* !UNIV_HOTBACKUP */
342 /**********************************************************************/
344 UNIV_INTERN
345 void
347 /*==========================*/
348  dict_table_t* table,
349  mem_heap_t* heap)
350  __attribute__((nonnull));
351 #ifndef UNIV_HOTBACKUP
352 /**********************************************************************/
354 UNIV_INTERN
355 void
357 /*====================*/
358  dict_table_t* table,
359  ibool can_be_evicted,
360  mem_heap_t* heap)
361  __attribute__((nonnull));
362 /**********************************************************************/
364 UNIV_INTERN
365 void
367 /*=========================*/
368  dict_table_t* table)
369  __attribute__((nonnull));
370 /**********************************************************************/
373 UNIV_INTERN
374 dberr_t
376 /*=======================*/
377  dict_table_t* table,
378  const char* new_name,
379  ibool rename_also_foreigns)
383  __attribute__((nonnull, warn_unused_result));
384 /**********************************************************************/
386 UNIV_INTERN
387 void
389 /*=========================*/
390  dict_table_t* table,
391  dict_index_t* index)
392  __attribute__((nonnull));
393 /**********************************************************************/
396 UNIV_INTERN
397 void
399 /*==========================*/
400  dict_table_t* table,
401  table_id_t new_id)
402  __attribute__((nonnull));
403 /**********************************************************************/
405 UNIV_INTERN
406 void
408 /*===========================*/
409  dict_foreign_t* foreign)
410  __attribute__((nonnull));
411 /**********************************************************************/
417 UNIV_INTERN
418 dberr_t
420 /*======================*/
421  dict_foreign_t* foreign,
423  const char** col_names,
426  bool check_charsets,
429  dict_err_ignore_t ignore_err)
431  __attribute__((nonnull(1), warn_unused_result));
432 /*********************************************************************/
437 UNIV_INTERN
440 /*=================================*/
441  dict_table_t* table,
442  dict_index_t* index)
443  __attribute__((nonnull, warn_unused_result));
444 /*********************************************************************/
447 UNIV_INTERN
448 ibool
450 /*====================================*/
451  const dict_table_t* table)
452  __attribute__((nonnull, warn_unused_result));
453 /**********************************************************************/
457 UNIV_INTERN
458 bool
460 /*=======================*/
461  dict_table_t* table,
462  const char** col_names,
465  const dict_index_t* index)
466  __attribute__((nonnull(1,3), warn_unused_result));
467 /**********************************************************************/
470 UNIV_INTERN
471 ibool
473 /*=========================*/
474  THD* thd,
475  const char* str,
476  const char* keyword)
477  __attribute__((nonnull, warn_unused_result));
478 /*********************************************************************/
484 UNIV_INTERN
487 /*==============================*/
488  dict_table_t* table,
489  dict_index_t* index)
490  __attribute__((nonnull, warn_unused_result));
491 /*********************************************************************/
499 UNIV_INTERN
500 dberr_t
502 /*============================*/
503  trx_t* trx,
504  const char* sql_string,
512  size_t sql_length,
513  const char* name,
516  ibool reject_fks)
519  __attribute__((nonnull, warn_unused_result));
520 /**********************************************************************/
524 UNIV_INTERN
525 dberr_t
527 /*================================*/
528  mem_heap_t* heap,
530  trx_t* trx,
531  dict_table_t* table,
532  ulint* n,
534  const char*** constraints_to_drop)
536  __attribute__((nonnull, warn_unused_result));
537 /**********************************************************************/
543 UNIV_INTERN
546 /*====================*/
547  const char* table_name,
548  ibool dict_locked,
549  ibool try_drop,
553  ignore_err)
555  __attribute__((nonnull, warn_unused_result));
556 
557 /*********************************************************************/
562 UNIV_INTERN
565 /*====================*/
566  const dict_table_t* table,
567  const char** col_names,
570  const char** columns,
571  ulint n_cols,
572  const dict_index_t* types_idx,
576  bool check_charsets,
580  ulint check_null)
584  __attribute__((nonnull(1,3), warn_unused_result));
585 /**********************************************************************/
589 UNIV_INTERN
590 const char*
592 /*====================*/
593  const dict_table_t* table,
594  ulint col_nr)
595  __attribute__((nonnull, warn_unused_result));
596 /**********************************************************************/
598 UNIV_INTERN
599 void
601 /*=============*/
602  dict_table_t* table)
603  __attribute__((nonnull));
604 /**********************************************************************/
606 UNIV_INTERN
607 void
609 /*============================*/
610  ibool create_table_format,
614  FILE* file,
615  trx_t* trx,
616  dict_table_t* table)
617  __attribute__((nonnull));
618 /**********************************************************************/
621 UNIV_INTERN
622 void
624 /*============================================*/
625  FILE* file,
626  trx_t* trx,
627  dict_foreign_t* foreign,
628  ibool add_newline)
629  __attribute__((nonnull(1,3)));
630 /********************************************************************/
632 UNIV_INTERN
633 void
635 /*==================*/
636  FILE* file,
637  const trx_t* trx,
638  const dict_index_t* index)
639  __attribute__((nonnull(1,3)));
640 /*********************************************************************/
645 UNIV_INTERN
646 bool
648 /*====================*/
649  const dict_table_t* table,
650  const char** col_names,
653  const char** columns,
654  ulint n_cols,
655  const dict_index_t* index,
656  const dict_index_t* types_idx,
660  bool check_charsets,
664  ulint check_null)
668  __attribute__((nonnull(1,3), warn_unused_result));
669 #ifdef UNIV_DEBUG
670 /********************************************************************/
673 UNIV_INLINE
676 /*=======================*/
677  const dict_table_t* table)
678  __attribute__((nonnull, warn_unused_result));
679 /********************************************************************/
682 UNIV_INLINE
685 /*=======================*/
686  const dict_table_t* table)
687  __attribute__((nonnull, warn_unused_result));
688 /********************************************************************/
691 UNIV_INLINE
694 /*======================*/
695  const dict_index_t* index)
696  __attribute__((nonnull, warn_unused_result));
697 #else /* UNIV_DEBUG */
698 # define dict_table_get_first_index(table) UT_LIST_GET_FIRST((table)->indexes)
699 # define dict_table_get_last_index(table) UT_LIST_GET_LAST((table)->indexes)
700 # define dict_table_get_next_index(index) UT_LIST_GET_NEXT(indexes, index)
701 #endif /* UNIV_DEBUG */
702 #endif /* !UNIV_HOTBACKUP */
703 
704 /* Skip corrupted index */
705 #define dict_table_skip_corrupt_index(index) \
706  while (index && dict_index_is_corrupted(index)) { \
707  index = dict_table_get_next_index(index); \
708  }
709 
710 /* Get the next non-corrupt index */
711 #define dict_table_next_uncorrupted_index(index) \
712 do { \
713  index = dict_table_get_next_index(index); \
714  dict_table_skip_corrupt_index(index); \
715 } while (0)
716 
717 /********************************************************************/
720 UNIV_INLINE
721 ulint
723 /*================*/
724  const dict_index_t* index)
725  __attribute__((nonnull, pure, warn_unused_result));
726 /********************************************************************/
729 UNIV_INLINE
730 ulint
732 /*=================*/
733  const dict_index_t* index)
734  __attribute__((nonnull, pure, warn_unused_result));
735 /********************************************************************/
738 UNIV_INLINE
739 ulint
741 /*===============*/
742  const dict_index_t* index)
743  __attribute__((nonnull, pure, warn_unused_result));
744 /********************************************************************/
747 UNIV_INLINE
748 ulint
750 /*======================*/
751  const dict_index_t* index)
752  __attribute__((nonnull, pure, warn_unused_result));
753 
754 /************************************************************************
755 Gets the all the FTS indexes for the table. NOTE: must not be called for
756 tables which do not have an FTS-index. */
757 UNIV_INTERN
758 ulint
759 dict_table_get_all_fts_indexes(
760 /*===========================*/
761  /* out: number of indexes collected */
762  dict_table_t* table, /* in: table */
763  ib_vector_t* indexes)/* out: vector for collecting FTS indexes */
764  __attribute__((nonnull));
765 /********************************************************************/
769 UNIV_INLINE
770 ulint
772 /*=======================*/
773  const dict_table_t* table)
774  __attribute__((nonnull, pure, warn_unused_result));
775 /********************************************************************/
778 UNIV_INLINE
779 ulint
781 /*======================*/
782  const dict_table_t* table)
783  __attribute__((nonnull, pure, warn_unused_result));
784 /********************************************************************/
788 UNIV_INLINE
789 ulint
791 /*==================*/
792  const dict_table_t* table)
793  __attribute__((nonnull, pure, warn_unused_result));
794 /********************************************************************/
797 UNIV_INLINE
798 ib_uint64_t
800 /*==================*/
801  const dict_table_t* table)
802  __attribute__((nonnull, warn_unused_result));
803 /********************************************************************/
807 UNIV_INLINE
808 void
810 /*==================*/
811  dict_table_t* table)
812  __attribute__((nonnull));
813 /********************************************************************/
817 UNIV_INLINE
818 void
820 /*==================*/
821  dict_table_t* table)
822  __attribute__((nonnull));
823 #ifdef UNIV_DEBUG
824 /********************************************************************/
827 UNIV_INLINE
828 dict_col_t*
830 /*===================*/
831  const dict_table_t* table,
832  ulint pos)
833  __attribute__((nonnull, warn_unused_result));
834 /********************************************************************/
837 UNIV_INLINE
838 dict_col_t*
840 /*===================*/
841  const dict_table_t* table,
842  ulint sys)
843  __attribute__((nonnull, warn_unused_result));
844 #else /* UNIV_DEBUG */
845 #define dict_table_get_nth_col(table, pos) \
846 ((table)->cols + (pos))
847 #define dict_table_get_sys_col(table, sys) \
848 ((table)->cols + (table)->n_cols + (sys) - DATA_N_SYS_COLS)
849 #endif /* UNIV_DEBUG */
850 /********************************************************************/
853 UNIV_INLINE
854 ulint
856 /*======================*/
857  const dict_table_t* table,
858  ulint sys)
859  __attribute__((nonnull, warn_unused_result));
860 #ifndef UNIV_HOTBACKUP
861 /********************************************************************/
864 UNIV_INLINE
865 ulint
867 /*====================*/
868  const dict_index_t* index)
869  __attribute__((nonnull, warn_unused_result));
870 #endif /* !UNIV_HOTBACKUP */
871 /********************************************************************/
874 UNIV_INLINE
875 ibool
877 /*===============*/
878  const dict_table_t* table)
879  __attribute__((nonnull, warn_unused_result));
880 /********************************************************************/
883 UNIV_INLINE
884 ulint
886 /*==================*/
887  const dict_table_t* table)
888  __attribute__((nonnull, warn_unused_result));
889 /********************************************************************/
892 UNIV_INLINE
893 ulint
895 /*===============*/
896  ulint flags)
897  __attribute__((warn_unused_result));
898 /********************************************************************/
900 UNIV_INLINE
901 void
903 /*========*/
904  ulint* flags,
905  rec_format_t format,
906  ulint zip_ssize,
907  bool remote_path)
908  __attribute__((nonnull));
909 /********************************************************************/
920 UNIV_INLINE
921 ulint
923 /*=================*/
924  ulint flags)
925  __attribute__((const));
926 /********************************************************************/
929 UNIV_INLINE
930 ulint
932 /*=================*/
933  ulint flags)
934  __attribute__((const));
935 /********************************************************************/
938 UNIV_INLINE
939 ulint
941 /*================*/
942  const dict_table_t* table)
943  __attribute__((nonnull, warn_unused_result));
944 #ifndef UNIV_HOTBACKUP
945 /*********************************************************************/
949 UNIV_INLINE
950 void
952 /*======================*/
953  dict_table_t* table)
954  __attribute__((nonnull));
955 /*********************************************************************/
957 UNIV_INLINE
958 void
960 /*========================*/
961  dict_table_t* table)
962  __attribute__((nonnull));
963 /********************************************************************/
967 UNIV_INTERN
968 ibool
970 /*============================*/
971  const dict_table_t* table,
972  ulint n)
973  __attribute__((nonnull, warn_unused_result));
974 /*******************************************************************/
977 UNIV_INLINE
978 ibool
980 /*=====================*/
981  dict_table_t* table)
982  __attribute__((nonnull, warn_unused_result));
983 /*******************************************************************/
987 UNIV_INTERN
988 void
990 /*==================*/
991  dtuple_t* tuple,
992  const dict_table_t* table)
993  __attribute__((nonnull));
994 /********************************************************************
995 Wait until all the background threads of the given table have exited, i.e.,
996 bg_threads == 0. Note: bg_threads_mutex must be reserved when
997 calling this. */
998 UNIV_INTERN
999 void
1000 dict_table_wait_for_bg_threads_to_exit(
1001 /*===================================*/
1002  dict_table_t* table, /* in: table */
1003  ulint delay) /* in: time in microseconds to wait between
1004  checks of bg_threads. */
1005  __attribute__((nonnull));
1006 /**********************************************************************/
1011 UNIV_INTERN
1012 dict_index_t*
1014 /*======================*/
1015  index_id_t id)
1016  __attribute__((warn_unused_result));
1017 /**********************************************************************/
1022 UNIV_INTERN
1023 ulint
1025 /*====================*/
1026  ulint max_tables,
1027  ulint pct_check);
1028 /**********************************************************************/
1031 UNIV_INTERN
1032 dberr_t
1034 /*====================*/
1035  dict_table_t* table,
1036  dict_index_t* index,
1038  ulint page_no,
1039  ibool strict)
1042  __attribute__((nonnull, warn_unused_result));
1043 /**********************************************************************/
1045 UNIV_INTERN
1046 void
1048 /*=========================*/
1049  dict_table_t* table,
1050  dict_index_t* index)
1051  __attribute__((nonnull));
1052 #endif /* !UNIV_HOTBACKUP */
1053 /********************************************************************/
1057 UNIV_INLINE
1058 ulint
1060 /*====================*/
1061  const dict_index_t* index)
1064  __attribute__((nonnull, warn_unused_result));
1065 /********************************************************************/
1071 UNIV_INLINE
1072 ulint
1074 /*====================*/
1075  const dict_index_t* index)
1077  __attribute__((nonnull, warn_unused_result));
1078 /********************************************************************/
1083 UNIV_INLINE
1084 ulint
1086 /*============================*/
1087  const dict_index_t* index)
1089  __attribute__((nonnull, warn_unused_result));
1090 /********************************************************************/
1096 UNIV_INLINE
1097 ulint
1099 /*======================================*/
1100  const dict_index_t* index)
1102  __attribute__((nonnull, warn_unused_result));
1103 #ifdef UNIV_DEBUG
1104 /********************************************************************/
1107 UNIV_INLINE
1108 dict_field_t*
1110 /*=====================*/
1111  const dict_index_t* index,
1112  ulint pos)
1113  __attribute__((nonnull, warn_unused_result));
1114 #else /* UNIV_DEBUG */
1115 # define dict_index_get_nth_field(index, pos) ((index)->fields + (pos))
1116 #endif /* UNIV_DEBUG */
1117 /********************************************************************/
1120 UNIV_INLINE
1121 const dict_col_t*
1123 /*===================*/
1124  const dict_index_t* index,
1125  ulint pos)
1126  __attribute__((nonnull, warn_unused_result));
1127 /********************************************************************/
1130 UNIV_INLINE
1131 ulint
1133 /*======================*/
1134  const dict_index_t* index,
1135  ulint pos)
1136  __attribute__((nonnull, warn_unused_result));
1137 /********************************************************************/
1141 UNIV_INLINE
1142 ulint
1144 /*=======================*/
1145  const dict_index_t* index,
1146  ulint n)
1147  __attribute__((nonnull, warn_unused_result));
1148 /********************************************************************/
1152 UNIV_INTERN
1153 ulint
1155 /*=================================*/
1156  const dict_index_t* index,
1157  ulint n,
1158  ibool inc_prefix)
1160  __attribute__((nonnull, warn_unused_result));
1161 /********************************************************************/
1164 UNIV_INTERN
1165 ibool
1167 /*==============================*/
1168  const dict_index_t* index,
1169  ulint n)
1170  __attribute__((nonnull, warn_unused_result));
1171 /********************************************************************/
1178 UNIV_INTERN
1179 ulint
1181 /*=========================*/
1182  const dict_index_t* index,
1183  const dict_index_t* index2,
1184  ulint n)
1185  __attribute__((nonnull, warn_unused_result));
1186 /********************************************************************/
1189 UNIV_INTERN
1190 ulint
1192 /*=======================*/
1193  const dict_table_t* table,
1194  ulint n)
1195  __attribute__((nonnull, warn_unused_result));
1196 /********************************************************************/
1199 UNIV_INLINE
1200 ulint
1202 /*=======================*/
1203  const dict_index_t* index,
1204  ulint type)
1205  __attribute__((nonnull, warn_unused_result));
1206 /*******************************************************************/
1208 UNIV_INTERN
1209 void
1211 /*===============*/
1212  dict_index_t* index,
1213  const dict_table_t* table,
1214  dict_col_t* col,
1215  ulint prefix_len)
1216  __attribute__((nonnull));
1217 #ifndef UNIV_HOTBACKUP
1218 /*******************************************************************/
1220 UNIV_INTERN
1221 void
1223 /*==================*/
1224  dtuple_t* tuple,
1225  const dict_index_t* index,
1226  ulint n_fields)
1228  __attribute__((nonnull));
1229 #endif /* !UNIV_HOTBACKUP */
1230 /*********************************************************************/
1233 UNIV_INLINE
1234 const dict_col_t*
1236 /*===============*/
1237  const dict_field_t* field)
1238  __attribute__((nonnull, warn_unused_result));
1239 #ifndef UNIV_HOTBACKUP
1240 /**********************************************************************/
1244 UNIV_INTERN
1245 dict_index_t*
1247 /*===========================*/
1248  index_id_t index_id)
1249  __attribute__((warn_unused_result));
1250 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1251 /**********************************************************************/
1254 UNIV_INTERN
1255 dict_index_t*
1257 /*=======================*/
1258  index_id_t index_id)
1259  __attribute__((warn_unused_result));
1260 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
1261 #ifdef UNIV_DEBUG
1262 /**********************************************************************/
1266 UNIV_INTERN
1267 ibool
1269 /*==========================*/
1270  const dict_index_t* index,
1271  const dtuple_t* tuple)
1272  __attribute__((nonnull, warn_unused_result));
1281 };
1282 /**********************************************************************/
1284 UNIV_INTERN
1285 void
1287 /*=============================*/
1288  const dict_table_t* table,
1290  enum check_name check)
1292  __attribute__((nonnull));
1293 #endif /* UNIV_DEBUG */
1294 /**********************************************************************/
1297 UNIV_INTERN
1298 dtuple_t*
1300 /*======================*/
1301  const dict_index_t* index,
1302  const rec_t* rec,
1304  ulint page_no,
1306  mem_heap_t* heap,
1308  ulint level)
1310  __attribute__((nonnull, warn_unused_result));
1311 /**********************************************************************/
1315 UNIV_INTERN
1316 rec_t*
1318 /*=============================*/
1319  const dict_index_t* index,
1320  const rec_t* rec,
1322  ulint* n_fields,
1323  byte** buf,
1325  ulint* buf_size)
1326  __attribute__((nonnull, warn_unused_result));
1327 /**********************************************************************/
1330 UNIV_INTERN
1331 dtuple_t*
1333 /*========================*/
1334  dict_index_t* index,
1335  rec_t* rec,
1336  ulint n_fields,
1337  mem_heap_t* heap)
1338  __attribute__((nonnull, warn_unused_result));
1339 /*********************************************************************/
1342 UNIV_INLINE
1343 ulint
1345 /*=================*/
1346  const dict_index_t* index)
1347  __attribute__((nonnull, warn_unused_result));
1348 /*********************************************************************/
1350 UNIV_INLINE
1351 void
1353 /*=================*/
1354  dict_index_t* index,
1355  ulint space)
1356  __attribute__((nonnull));
1357 /*********************************************************************/
1360 UNIV_INLINE
1361 ulint
1363 /*================*/
1364  const dict_index_t* tree)
1365  __attribute__((nonnull, warn_unused_result));
1366 /*********************************************************************/
1369 UNIV_INLINE
1370 rw_lock_t*
1372 /*================*/
1373  dict_index_t* index)
1374  __attribute__((nonnull, warn_unused_result));
1375 /********************************************************************/
1380 UNIV_INLINE
1381 ulint
1383 /*==============================*/
1384 
1385 /* Online index creation @{ */
1386 /********************************************************************/
1389 UNIV_INLINE
1392 /*=========================*/
1393  const dict_index_t* index)
1394  __attribute__((nonnull, warn_unused_result));
1395 /********************************************************************/
1397 UNIV_INLINE
1398 void
1400 /*=========================*/
1401  dict_index_t* index,
1402  enum online_index_status status)
1403  __attribute__((nonnull));
1404 /********************************************************************/
1412 UNIV_INLINE
1413 bool
1415 /*=====================*/
1416  const dict_index_t* index)
1417  __attribute__((nonnull, warn_unused_result));
1418 /*********************************************************************/
1420 UNIV_INTERN
1421 ulint
1423 /*========================*/
1424  const dict_index_t* index)
1425  __attribute__((nonnull, warn_unused_result));
1426 /********************************************************************/
1428 UNIV_INTERN
1429 void
1431 /*============================*/
1432 /********************************************************************/
1434 UNIV_INTERN
1435 void
1437 /*===========================*/
1438 
1446 void
1448  dict_table_t* table,
1449  bool enabled);
1450 
1456 void
1458  dict_table_t* table);
1459 
1460 /**********************************************************************/
1464 UNIV_INTERN
1465 void
1467 /*==================*/
1468  dict_table_t* table,
1469  ulint latch_mode);
1470 /**********************************************************************/
1472 UNIV_INTERN
1473 void
1475 /*====================*/
1476  dict_table_t* table,
1477  ulint latch_mode);
1478 /********************************************************************/
1481 UNIV_INTERN
1482 ibool
1484 /*=====================*/
1485  const char* name1,
1487  const char* name2)
1489  __attribute__((nonnull, warn_unused_result));
1490 /*********************************************************************/
1492 UNIV_INTERN
1493 void
1495 /*=========================*/
1496  dict_table_t* table,
1497  dict_index_t* index)
1498  __attribute__((nonnull));
1499 /**********************************************************************/
1502 UNIV_INTERN
1503 dict_index_t*
1505 /*=========================*/
1506  dict_table_t* table,
1507  const char* name)
1508  __attribute__((nonnull, warn_unused_result));
1509 /**********************************************************************/
1513 UNIV_INTERN
1514 dict_index_t*
1516 /*====================================*/
1517  dict_table_t* table,
1518  const char* name)
1519  __attribute__((nonnull, warn_unused_result));
1520 /***************************************************************
1521 Check whether a column exists in an FTS index. */
1522 UNIV_INLINE
1523 ulint
1525 /*=====================*/
1526  /* out: ULINT_UNDEFINED if no match else
1527  the offset within the vector */
1528  ib_vector_t* indexes,/* in: vector containing only FTS indexes */
1529  ulint col_no) /* in: col number to search for */
1530  __attribute__((nonnull, warn_unused_result));
1531 /**********************************************************************/
1533 UNIV_INTERN
1534 void
1536 /*================================*/
1537  dict_table_t* table)
1538  __attribute__((nonnull));
1539 /**********************************************************************/
1541 UNIV_INTERN
1542 void
1544 /*================================*/
1545  dict_table_t* table)
1546  __attribute__((nonnull));
1547 /**********************************************************************/
1549 UNIV_INTERN
1550 void
1552 /*=============*/
1553  dict_table_t* table)
1554  __attribute__((nonnull));
1555 
1559 #define MAX_NUM_FK_COLUMNS 500
1560 
1561 /* Buffers for storing detailed information about the latest foreign key
1562 and unique key errors */
1563 extern FILE* dict_foreign_err_file;
1564 extern ib_mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */
1565 
1567 extern dict_sys_t* dict_sys;
1570 
1571 /* Dictionary system struct */
1572 struct dict_sys_t{
1590  ulint size;
1598  /*=============================*/
1599  UT_LIST_BASE_NODE_T(dict_table_t)
1602  UT_LIST_BASE_NODE_T(dict_table_t)
1605 };
1606 #endif /* !UNIV_HOTBACKUP */
1607 
1612 
1613 /**********************************************************************/
1615 UNIV_INTERN
1616 void
1617 dict_ind_init(void);
1618 /*===============*/
1619 
1620 /* Auxiliary structs for checking a table definition @{ */
1621 
1622 /* This struct is used to specify the name and type that a column must
1623 have when checking a table's schema. */
1625  const char* name; /* column name */
1626  ulint mtype; /* required column main type */
1627  ulint prtype_mask; /* required column precise type mask;
1628  if this is non-zero then all the
1629  bits it has set must also be set
1630  in the column's prtype */
1631  ulint len; /* required column length */
1632 };
1633 
1634 /* This struct is used for checking whether a given table exists and
1635 whether it has a predefined schema (number of columns and columns names
1636 and types) */
1638  const char* table_name; /* the name of the table whose
1639  structure we are checking */
1640  ulint n_cols; /* the number of columns the
1641  table must have */
1642  dict_col_meta_t* columns; /* metadata for the columns;
1643  this array has n_cols
1644  elements */
1645  ulint n_foreign; /* number of foreign keys this
1646  table has, pointing to other
1647  tables (where this table is
1648  FK child) */
1649  ulint n_referenced; /* number of foreign keys other
1650  tables have, pointing to this
1651  table (where this table is
1652  parent) */
1653 };
1654 /* @} */
1655 
1656 /*********************************************************************/
1663 UNIV_INTERN
1664 dberr_t
1666 /*====================*/
1667  dict_table_schema_t* req_schema,
1669  char* errstr,
1673  size_t errstr_sz)
1674  __attribute__((nonnull, warn_unused_result));
1675 /* @} */
1676 
1677 /*********************************************************************/
1682 UNIV_INTERN
1683 void
1684 dict_fs2utf8(
1685 /*=========*/
1686  const char* db_and_table,
1688  char* db_utf8,
1689  size_t db_utf8_size,
1690  char* table_utf8,
1691  size_t table_utf8_size)
1692  __attribute__((nonnull));
1693 
1694 /**********************************************************************/
1696 UNIV_INTERN
1697 void
1698 dict_close(void);
1699 /*============*/
1700 #ifndef UNIV_HOTBACKUP
1701 /**********************************************************************/
1704 UNIV_INLINE
1705 ulint
1707 /*====================*/
1708  const dict_table_t* table)
1709  __attribute__((nonnull, warn_unused_result));
1710 
1711 /**********************************************************************/
1714 UNIV_INLINE
1715 ulint
1717 /*====================*/
1718  const dict_index_t* index)
1719  __attribute__((nonnull, warn_unused_result));
1720 
1721 #endif /* !UNIV_HOTBACKUP */
1722 /**********************************************************************/
1725 UNIV_INTERN
1726 void
1728 /*===============*/
1729  dict_index_t* index,
1730  trx_t* trx,
1731  const char* ctx)
1732  UNIV_COLD __attribute__((nonnull));
1733 
1734 /**********************************************************************/
1738 UNIV_INTERN
1739 void
1741 /*================================*/
1742  dict_index_t* index,
1743  dict_table_t* table)
1744  __attribute__((nonnull));
1745 
1746 /**********************************************************************/
1750 UNIV_INTERN
1751 ibool
1753 /*========================*/
1754  ulint space_id);
1756 /********************************************************************/
1759 UNIV_INLINE
1760 bool
1762 /*=============*/
1763  ulint flags)
1764  __attribute__((warn_unused_result));
1765 
1766 /********************************************************************/
1769 UNIV_INLINE
1770 bool
1772 /*====================*/
1773  const dict_table_t* table)
1774  __attribute__((nonnull, pure, warn_unused_result));
1775 
1776 /********************************************************************/
1779 UNIV_INLINE
1780 bool
1782 /*====================*/
1783  const dict_table_t* table)
1784  __attribute__((nonnull, pure, warn_unused_result));
1785 
1786 #ifndef UNIV_HOTBACKUP
1787 /*********************************************************************/
1790 UNIV_INTERN
1791 void
1793 /*===================*/
1794  dict_index_t* index)
1795  __attribute__((nonnull));
1796 /*********************************************************************/
1799 UNIV_INTERN
1800 void
1802 /*===================*/
1803  dict_index_t* index)
1804  __attribute__((nonnull));
1805 /*********************************************************************/
1808 UNIV_INTERN
1809 ulint
1811 /*=================================*/
1812  dict_index_t* index)
1814  __attribute__((nonnull, warn_unused_result));
1815 /*************************************************************/
1818 UNIV_INTERN
1819 const char*
1821 /*=========================*/
1822  ulint table_flag);
1823 /*****************************************************************/
1827 UNIV_INLINE
1828 dict_index_t*
1830 /*==============================*/
1831  const dict_table_t* table,
1832  ulint col_index);
1835 #endif /* !UNIV_HOTBACKUP */
1836 
1837 #ifndef UNIV_NONINL
1838 #include "dict0dict.ic"
1839 #endif
1840 
1841 #endif