29 #include "dict0dict.ic"
37 #ifndef UNIV_HOTBACKUP
59 #include <drizzled/session.h>
75 #ifdef UNIV_PFS_RWLOCK
76 UNIV_INTERN mysql_pfs_key_t dict_operation_lock_key;
77 UNIV_INTERN mysql_pfs_key_t index_tree_rw_lock_key;
81 UNIV_INTERN mysql_pfs_key_t dict_sys_mutex_key;
82 UNIV_INTERN mysql_pfs_key_t dict_foreign_err_mutex_key;
85 #define DICT_HEAP_SIZE 100
87 #define DICT_POOL_PER_TABLE_HASH 512
89 #define DICT_POOL_PER_VARYING 4
93 static char dict_ibfk[] = "_ibfk_";
105 #define DICT_TABLE_STATS_LATCHES_SIZE 64
106 static rw_lock_t dict_table_stats_latches[DICT_TABLE_STATS_LATCHES_SIZE];
114 dict_index_find_cols(
124 dict_index_build_internal_clust(
135 dict_index_build_internal_non_clust(
144 dict_foreign_remove_from_cache(
159 dict_index_print_low(
166 dict_field_print_low(
179 UNIV_INTERN FILE* dict_foreign_err_file = NULL;
181 UNIV_INTERN
mutex_t dict_foreign_err_mutex;
199 dict_tables_have_same_db(
206 for (; *name1 == *name2; name1++, name2++) {
225 const char* s = strchr(name,
'/');
236 dict_get_db_name_len(
242 s = strchr(name,
'/');
251 dict_mutex_enter_for_mysql(
void)
254 mutex_enter(&(dict_sys->
mutex));
261 dict_mutex_exit_for_mysql(
void)
264 mutex_exit(&(dict_sys->
mutex));
268 #define GET_TABLE_STATS_LATCH(table) \
269 (&dict_table_stats_latches[ut_fold_ull(table->id) \
270 % DICT_TABLE_STATS_LATCHES_SIZE])
278 dict_table_stats_lock(
284 ut_ad(table != NULL);
285 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
287 switch (latch_mode) {
292 rw_lock_x_lock(GET_TABLE_STATS_LATCH(table));
305 dict_table_stats_unlock(
311 ut_ad(table != NULL);
312 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
314 switch (latch_mode) {
316 rw_lock_s_unlock(GET_TABLE_STATS_LATCH(table));
319 rw_lock_x_unlock(GET_TABLE_STATS_LATCH(table));
332 dict_table_decrement_handle_count(
338 mutex_enter(&dict_sys->
mutex);
347 mutex_exit(&dict_sys->
mutex);
358 dict_table_get_col_name(
367 ut_ad(col_nr < table->n_def);
368 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
372 for (i = 0; i < col_nr; i++) {
380 #ifndef UNIV_HOTBACKUP
385 dict_table_autoinc_lock(
396 dict_table_autoinc_initialize(
412 dict_table_autoinc_read(
426 dict_table_autoinc_update_if_greater(
444 dict_table_autoinc_unlock(
457 dict_index_get_on_id_low(
464 index = dict_table_get_first_index(table);
467 if (
id == index->
id) {
473 index = dict_table_get_next_index(index);
486 dict_index_get_nth_col_pos(
497 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
499 col = dict_table_get_nth_col(index->
table, n);
508 for (pos = 0; pos < n_fields; pos++) {
509 field = dict_index_get_nth_field(index, pos);
517 return(ULINT_UNDEFINED);
520 #ifndef UNIV_HOTBACKUP
526 dict_index_contains_col_or_prefix(
537 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
544 col = dict_table_get_nth_col(index->
table, n);
548 for (pos = 0; pos < n_fields; pos++) {
549 field = dict_index_get_nth_field(index, pos);
551 if (col == field->
col) {
569 dict_index_get_nth_field_pos(
581 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
583 field2 = dict_index_get_nth_field(index2, n);
587 for (pos = 0; pos < n_fields; pos++) {
588 field = dict_index_get_nth_field(index, pos);
590 if (field->
col == field2->
col
599 return(ULINT_UNDEFINED);
607 dict_table_get_on_id(
624 mutex_enter(&(dict_sys->
mutex));
628 mutex_exit(&(dict_sys->
mutex));
638 dict_table_get_nth_col_pos(
643 return(dict_index_get_nth_col_pos(dict_table_get_first_index(table),
653 dict_table_col_in_clustered_key(
666 col = dict_table_get_nth_col(table, n);
668 index = dict_table_get_first_index(table);
672 for (pos = 0; pos < n_fields; pos++) {
673 field = dict_index_get_nth_field(index, pos);
675 if (col == field->
col) {
695 mutex_create(dict_sys_mutex_key, &dict_sys->
mutex, SYNC_DICT);
698 / (DICT_POOL_PER_TABLE_HASH
701 / (DICT_POOL_PER_TABLE_HASH
708 &dict_operation_lock, SYNC_DICT_OPERATION);
711 ut_a(dict_foreign_err_file);
713 mutex_create(dict_foreign_err_mutex_key,
714 &dict_foreign_err_mutex, SYNC_ANY_LATCH);
716 for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) {
718 &dict_table_stats_latches[i], SYNC_INDEX_TREE);
732 const char* table_name,
733 ibool inc_mysql_count)
738 mutex_enter(&(dict_sys->
mutex));
742 if (inc_mysql_count && table) {
746 mutex_exit(&(dict_sys->
mutex));
752 dict_update_statistics(table, TRUE
764 dict_table_add_system_columns(
771 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
780 dict_mem_table_add_col(table, heap,
"DB_ROW_ID", DATA_SYS,
781 DATA_ROW_ID | DATA_NOT_NULL,
784 #error "DATA_ROW_ID != 0"
786 dict_mem_table_add_col(table, heap,
"DB_TRX_ID", DATA_SYS,
787 DATA_TRX_ID | DATA_NOT_NULL,
790 #error "DATA_TRX_ID != 1"
792 dict_mem_table_add_col(table, heap,
"DB_ROLL_PTR", DATA_SYS,
793 DATA_ROLL_PTR | DATA_NOT_NULL,
795 #if DATA_ROLL_PTR != 2
796 #error "DATA_ROLL_PTR != 2"
801 #if DATA_N_SYS_COLS != 3
802 #error "DATA_N_SYS_COLS != 3"
806 #ifndef UNIV_HOTBACKUP
811 dict_table_add_to_cache(
822 #define BIG_ROW_SIZE 1024
826 dict_table_add_system_columns(table, heap);
834 for (i = 0; i < table->
n_def; i++) {
836 dict_table_get_nth_col(table, i));
842 if (row_len >= BIG_ROW_SIZE || col_len >= BIG_ROW_SIZE) {
843 row_len = BIG_ROW_SIZE;
849 table->
big_rows = row_len >= BIG_ROW_SIZE;
857 ut_a(table2 == NULL);
864 ut_ad(table2 == NULL);
873 table2->
id == table->
id);
874 ut_a(table2 == NULL);
881 ut_ad(table2 == NULL);
896 + strlen(table->
name) + 1;
906 dict_index_find_on_id_low(
916 index = dict_table_get_first_index(table);
919 if (
id == index->
id) {
925 index = dict_table_get_next_index(index);
939 dict_table_rename_in_cache(
942 const char* new_name,
943 ibool rename_also_foreigns)
950 char old_name[MAX_TABLE_NAME_LEN + 1];
956 if (strlen(table->
name) + 1 <=
sizeof(old_name)) {
957 memcpy(old_name, table->
name, strlen(table->
name) + 1);
960 fprintf(stderr,
"InnoDB: too long table name: '%s', "
961 "max length is %d\n", table->
name,
974 if (UNIV_LIKELY_NULL(table2)) {
976 fputs(
" InnoDB: Error: dictionary cache"
977 " already contains a table ", stderr);
980 "InnoDB: cannot rename table ", stderr);
990 if (table->
space != 0) {
993 fputs(
" InnoDB: Error: trying to rename a"
994 " TEMPORARY TABLE ", stderr);
999 fputs(
" )\n", stderr);
1001 }
else if (!fil_rename_tablespace(old_name, table->
space,
1011 if (strlen(new_name) > strlen(table->
name)) {
1015 ut_a(strlen(new_name) <= MAX_TABLE_NAME_LEN);
1018 memcpy(table->
name, new_name, strlen(new_name) + 1);
1024 dict_sys->
size += strlen(new_name) - strlen(old_name);
1028 index = dict_table_get_first_index(table);
1030 while (index != NULL) {
1033 index = dict_table_get_next_index(index);
1036 if (!rename_also_foreigns) {
1048 while (foreign != NULL) {
1049 dict_foreign_remove_from_cache(foreign);
1057 while (foreign != NULL) {
1077 while (foreign != NULL) {
1090 if (strchr(foreign->
id,
'/')) {
1099 + ((
sizeof dict_ibfk) - 1)
1100 && !memcmp(foreign->
id, old_name,
1103 dict_ibfk, (
sizeof dict_ibfk) - 1)) {
1107 if (strlen(table->
name) > strlen(old_name)) {
1111 + strlen(old_id) + 1));
1116 strcpy(foreign->
id, table->
name);
1122 db_len = dict_get_db_name_len(table->
name) + 1;
1124 if (dict_get_db_name_len(table->
name)
1125 > dict_get_db_name_len(foreign->
id)) {
1129 db_len + strlen(old_id) + 1));
1137 strcpy(foreign->
id + db_len,
1138 dict_remove_db_name(old_id));
1149 while (foreign != NULL) {
1156 foreign->
heap, strlen(table->
name) + 1));
1172 dict_table_change_id_in_cache(
1179 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
1196 dict_table_remove_from_cache(
1206 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
1209 fputs(
"Removing table ", stderr);
1211 fputs(
" from dictionary cache\n", stderr);
1217 while (foreign != NULL) {
1218 dict_foreign_remove_from_cache(foreign);
1226 while (foreign != NULL) {
1236 while (index != NULL) {
1237 dict_index_remove_from_cache(table, index);
1254 dict_sys->
size -= size;
1256 dict_mem_table_free(table);
1265 dict_col_name_is_reserved(
1271 #if DATA_N_SYS_COLS != 3
1272 #error "DATA_N_SYS_COLS != 3"
1275 static const char* reserved_names[] = {
1276 "DB_ROW_ID",
"DB_TRX_ID",
"DB_ROLL_PTR"
1281 for (i = 0; i < UT_ARR_SIZE(reserved_names); i++) {
1297 dict_index_too_big_for_undo(
1307 = dict_table_get_first_index(table);
1319 if (UNIV_UNLIKELY(!clust_index)) {
1321 clust_index = new_index;
1326 for (i = 0; i < clust_index->
n_uniq; i++) {
1344 for (i = 0; i < clust_index->
n_def; i++) {
1355 max_size = fixed_size;
1363 for (j = 0; j < new_index->
n_uniq; j++) {
1365 new_index, j) == col) {
1380 if (max_size > REC_MAX_INDEX_COL_LEN) {
1381 max_size = REC_MAX_INDEX_COL_LEN;
1387 undo_page_len += 5 + max_size;
1390 return(undo_page_len >= UNIV_PAGE_SIZE);
1399 dict_index_too_big_for_tree(
1417 if (zip_size && zip_size < UNIV_PAGE_SIZE) {
1429 page_ptr_max = page_rec_max / 2;
1439 page_ptr_max = page_rec_max;
1442 ? REC_N_NEW_EXTRA_BYTES
1443 : REC_N_OLD_EXTRA_BYTES;
1456 rec_max_size += 2 * new_index->
n_fields;
1460 for (i = 0; i < new_index->
n_fields; i++) {
1462 = dict_index_get_nth_field(new_index, i);
1465 ulint field_max_size;
1466 ulint field_ext_max_size;
1481 if (field_max_size) {
1487 field_ext_max_size = 0;
1488 goto add_field_size;
1492 field_ext_max_size = field_max_size < 256 ? 1 : 2;
1508 field_ext_max_size = 1;
1515 rec_max_size += field_ext_max_size;
1518 rec_max_size += field_max_size;
1521 if (UNIV_UNLIKELY(rec_max_size >= page_rec_max)) {
1533 && rec_max_size + REC_NODE_PTR_SIZE >= page_ptr_max) {
1547 dict_index_add_to_cache(
1564 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
1570 if (!dict_index_find_cols(table, index)) {
1572 dict_mem_index_free(index);
1573 return(DB_CORRUPTION);
1580 new_index = dict_index_build_internal_clust(table, index);
1582 new_index = dict_index_build_internal_non_clust(table, index);
1590 if (strict && dict_index_too_big_for_tree(table, new_index)) {
1592 dict_mem_index_free(new_index);
1593 dict_mem_index_free(index);
1594 return(DB_TOO_BIG_RECORD);
1600 n_ord = new_index->
n_uniq;
1621 #if DICT_TF_FORMAT_ZIP != DICT_TF_FORMAT_MAX
1622 # error "DICT_TF_FORMAT_ZIP != DICT_TF_FORMAT_MAX"
1626 for (i = 0; i < n_ord; i++) {
1628 = dict_index_get_nth_field(new_index, i);
1648 if (dict_index_too_big_for_undo(table, new_index)) {
1662 for (i = 0; i < n_ord; i++) {
1664 dict_index_get_nth_field(new_index, i)->col->ord_part = 1;
1670 new_index->
table = table;
1678 new_index->
page = page_no;
1687 *
sizeof(ib_int64_t)));
1699 dict_mem_index_free(index);
1708 dict_index_remove_from_cache(
1717 ut_ad(table && index);
1718 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
1719 ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
1737 ulint ref_count = btr_search_info_get_ref_count(info);
1738 if (ref_count == 0) {
1746 if (retries % 500 == 0) {
1748 fprintf(stderr,
"InnoDB: Error: Waited for"
1749 " %lu secs for hash index"
1750 " ref_count (%lu) to drop"
1762 if (retries >= 60000) {
1767 rw_lock_free(&index->
lock);
1776 dict_sys->
size -= size;
1778 dict_mem_index_free(index);
1787 dict_index_find_cols(
1794 ut_ad(table && index);
1795 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
1798 for (i = 0; i < index->
n_fields; i++) {
1800 dict_field_t* field = dict_index_get_nth_field(index, i);
1802 for (j = 0; j < table->
n_cols; j++) {
1803 if (!strcmp(dict_table_get_col_name(table, j),
1805 field->
col = dict_table_get_nth_col(table, j);
1813 fputs(
"InnoDB: Error: no matching column for ", stderr);
1815 fputs(
" in ", stderr);
1816 dict_index_name_print(stderr, NULL, index);
1817 fputs(
"!\n", stderr);
1841 const char* col_name;
1845 dict_mem_index_add_field(index, col_name, prefix_len);
1847 field = dict_index_get_nth_field(index, index->
n_def - 1);
1853 if (prefix_len && field->
fixed_len > prefix_len) {
1854 field->
fixed_len = (
unsigned int) prefix_len;
1864 #if DICT_MAX_INDEX_COL_LEN != 1024
1868 # error "DICT_MAX_INDEX_COL_LEN != 1024"
1871 if (!(col->
prtype & DATA_NOT_NULL)) {
1876 #ifndef UNIV_HOTBACKUP
1894 for (i = start; i < end; i++) {
1896 field = dict_index_get_nth_field(index2, i);
1897 dict_index_add_col(index1, table, field->
col,
1906 dict_index_copy_types(
1921 for (i = 0; i < n_fields; i++) {
1925 ifield = dict_index_get_nth_field(index, i);
1926 dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
1937 dict_table_copy_types(
1946 dfield_t* dfield = dtuple_get_nth_field(tuple, i);
1947 dtype_t* dtype = dfield_get_type(dfield);
1960 dict_index_build_internal_clust(
1973 ut_ad(table && index);
1976 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
1979 new_index = dict_mem_index_create(table->
name,
1989 new_index->
id = index->
id;
1992 dict_index_copy(new_index, index, table, 0, index->
n_fields);
1997 new_index->
n_uniq = REC_MAX_N_FIELDS;
2014 trx_id_pos = new_index->
n_def;
2016 #if DATA_ROW_ID != 0
2017 # error "DATA_ROW_ID != 0"
2019 #if DATA_TRX_ID != 1
2020 # error "DATA_TRX_ID != 1"
2022 #if DATA_ROLL_PTR != 2
2023 # error "DATA_ROLL_PTR != 2"
2027 dict_index_add_col(new_index, table,
2028 dict_table_get_sys_col(
2029 table, DATA_ROW_ID),
2034 dict_index_add_col(new_index, table,
2035 dict_table_get_sys_col(table, DATA_TRX_ID),
2038 dict_index_add_col(new_index, table,
2039 dict_table_get_sys_col(table,
2043 for (i = 0; i < trx_id_pos; i++) {
2049 if (fixed_size == 0) {
2055 if (dict_index_get_nth_field(new_index, i)->prefix_len
2069 indexed =
static_cast<unsigned long *
>(indexed_ptr);
2072 for (i = 0; i < new_index->
n_def; i++) {
2074 field = dict_index_get_nth_field(new_index, i);
2081 indexed[field->
col->
ind] = TRUE;
2087 for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->
n_cols; i++) {
2089 dict_col_t* col = dict_table_get_nth_col(table, i);
2092 if (!indexed[col->
ind]) {
2093 dict_index_add_col(new_index, table, col, 0);
2102 new_index->
cached = TRUE;
2113 dict_index_build_internal_non_clust(
2125 ut_ad(table && index);
2128 ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
2138 new_index = dict_mem_index_create(
2147 new_index->
id = index->
id;
2150 dict_index_copy(new_index, index, table, 0, index->
n_fields);
2154 indexed =
static_cast<unsigned long *
>(indexed_ptr);
2157 for (i = 0; i < new_index->
n_def; i++) {
2159 field = dict_index_get_nth_field(new_index, i);
2166 indexed[field->
col->
ind] = TRUE;
2173 for (i = 0; i < clust_index->
n_uniq; i++) {
2175 field = dict_index_get_nth_field(clust_index, i);
2177 if (!indexed[field->
col->
ind]) {
2178 dict_index_add_col(new_index, table, field->
col,
2196 new_index->
cached = TRUE;
2208 dict_table_is_referenced_by_foreign_key(
2222 dict_table_get_referenced_constraint(
2229 ut_ad(index != NULL);
2230 ut_ad(table != NULL);
2253 dict_table_get_foreign_constraint(
2260 ut_ad(index != NULL);
2261 ut_ad(table != NULL);
2292 dict_foreign_remove_from_cache(
2311 dict_foreign_free(foreign);
2361 dict_foreign_find_index(
2364 const char** columns,
2368 ibool check_charsets,
2377 index = dict_table_get_first_index(table);
2379 while (index != NULL) {
2389 for (i = 0; i < n_cols; i++) {
2391 const char* col_name;
2393 field = dict_index_get_nth_field(index, i);
2395 col_name = dict_table_get_col_name(
2411 && (field->
col->
prtype & DATA_NOT_NULL)) {
2434 index = dict_table_get_next_index(index);
2446 dict_foreign_find_equiv_index(
2450 ut_a(foreign != NULL);
2456 return(dict_foreign_find_index(
2469 dict_table_get_index_by_max_id(
2473 const char** columns,
2480 index = dict_table_get_first_index(table);
2482 while (index != NULL) {
2489 for (i = 0; i < n_cols; i++) {
2491 const char* col_name;
2493 field = dict_index_get_nth_field(index, i);
2495 col_name = dict_table_get_col_name(
2499 columns[i], col_name)) {
2509 if (!found || index->
id > found->
id) {
2516 index = dict_table_get_next_index(index);
2526 dict_foreign_error_report_low(
2533 fprintf(file,
" Error in foreign key constraint of table %s:\n",
2541 dict_foreign_error_report(
2547 mutex_enter(&dict_foreign_err_mutex);
2550 fputs(
" Constraint:\n", file);
2551 dict_print_info_on_foreign_key_in_create_format(file, NULL, fk, TRUE);
2554 fputs(
"The index in the foreign key in table is ", file);
2557 "See " REFMAN
"innodb-foreign-key-constraints.html\n"
2558 "for correct foreign key definition.\n",
2561 mutex_exit(&dict_foreign_err_mutex);
2572 dict_foreign_add_to_cache(
2575 ibool check_charsets)
2582 ibool added_to_referenced_list= FALSE;
2583 FILE* ef = dict_foreign_err_file;
2592 ut_a(for_table || ref_table);
2595 for_in_cache = dict_foreign_find(for_table, foreign->
id);
2598 if (!for_in_cache && ref_table) {
2599 for_in_cache = dict_foreign_find(ref_table, foreign->
id);
2606 for_in_cache = foreign;
2610 index = dict_foreign_find_index(
2614 check_charsets, FALSE);
2616 if (index == NULL) {
2617 dict_foreign_error_report(
2619 "there is no index in referenced table"
2620 " which would contain\n"
2621 "the columns as the first columns,"
2622 " or the data types in the\n"
2623 "referenced table do not match"
2624 " the ones in table.");
2626 if (for_in_cache == foreign) {
2630 return(DB_CANNOT_ADD_CONSTRAINT);
2638 added_to_referenced_list = TRUE;
2642 index = dict_foreign_find_index(
2651 if (index == NULL) {
2652 dict_foreign_error_report(
2654 "there is no index in the table"
2655 " which would contain\n"
2656 "the columns as the first columns,"
2657 " or the data types in the\n"
2658 "table do not match"
2659 " the ones in the referenced table\n"
2660 "or one of the ON ... SET NULL columns"
2661 " is declared NOT NULL.");
2663 if (for_in_cache == foreign) {
2664 if (added_to_referenced_list) {
2674 return(DB_CANNOT_ADD_CONSTRAINT);
2701 for (; *ptr; ptr++) {
2702 if (*ptr == quote) {
2708 }
else if (*ptr ==
'`' || *ptr ==
'"') {
2714 for (i = 0;
string[i]; i++) {
2715 if (toupper((
int)(
unsigned char)(ptr[i]))
2716 != toupper((
int)(
unsigned char)
2744 const char* old_ptr = ptr;
2745 const char* old_ptr2;
2749 while (innobase_isspace(cs, *ptr)) {
2755 ptr = dict_scan_to(ptr,
string);
2757 if (*ptr ==
'\0' || old_ptr2 != ptr) {
2783 ibool accept_also_dot)
2796 while (innobase_isspace(cs, *ptr)) {
2805 if (*ptr ==
'`' || *ptr ==
'"') {
2817 if (*ptr == quote) {
2819 if (*ptr != quote) {
2827 while (!innobase_isspace(cs, *ptr) && *ptr !=
'(' && *ptr !=
')'
2828 && (accept_also_dot || *ptr !=
'.')
2829 && *ptr !=
',' && *ptr !=
'\0') {
2837 if (UNIV_UNLIKELY(!heap)) {
2847 if ((*d++ = *s++) == quote) {
2854 ut_ad(s + 1 == ptr);
2906 ptr = dict_scan_id(cs, ptr, heap, name, FALSE, TRUE);
2908 if (*name == NULL) {
2913 if (table == NULL) {
2919 const char* col_name = dict_table_get_col_name(
2926 *column = dict_table_get_nth_col(table, i);
2927 strcpy((
char*) *name, col_name);
2942 dict_scan_table_name(
2950 const char** ref_name)
2953 const char* database_name = NULL;
2954 ulint database_name_len = 0;
2955 const char* table_name = NULL;
2956 ulint table_name_len;
2957 const char* scan_name;
2963 ptr = dict_scan_id(cs, ptr, heap, &scan_name, TRUE, FALSE);
2965 if (scan_name == NULL) {
2975 database_name = scan_name;
2976 database_name_len = strlen(database_name);
2978 ptr = dict_scan_id(cs, ptr, heap, &table_name, TRUE, FALSE);
2980 if (table_name == NULL) {
2994 for (s = scan_name; *s; s++) {
2996 database_name = scan_name;
2997 database_name_len = s - scan_name;
3003 table_name = scan_name;
3006 if (database_name == NULL) {
3009 database_name = name;
3010 database_name_len = dict_get_db_name_len(name);
3013 table_name_len = strlen(table_name);
3016 ref =
static_cast<char *
>(
mem_heap_alloc(heap, database_name_len + table_name_len + 2));
3017 memcpy(ref, database_name, database_name_len);
3018 ref[database_name_len] =
'/';
3019 memcpy(ref + database_name_len + 1, table_name, table_name_len + 1);
3021 if (srv_lower_case_table_names) {
3052 ptr = dict_scan_id(cs, ptr, NULL, &start, FALSE, TRUE);
3071 dict_strip_comments(
3073 const char* sql_string,
3078 const char* eptr = sql_string + sql_length;
3083 str =
static_cast<char *
>(mem_alloc(sql_length + 1));
3090 if (sptr >= eptr || *sptr ==
'\0') {
3094 ut_a(ptr <= str + sql_length);
3099 if (*sptr == quote) {
3106 }
else if (*sptr ==
'"' || *sptr ==
'`' || *sptr ==
'\'') {
3109 }
else if (*sptr ==
'#'
3110 || (sptr[0] ==
'-' && sptr[1] ==
'-'
3111 && sptr[2] ==
' ')) {
3113 if (++sptr >= eptr) {
3127 }
else if (!quote && *sptr ==
'/' && *(sptr + 1) ==
'*') {
3138 if (sptr[1] ==
'/') {
3162 dict_table_get_highest_foreign_id(
3168 ulint biggest_id = 0;
3178 if (
ut_strlen(foreign->
id) > ((
sizeof dict_ibfk) - 1) + len
3181 dict_ibfk, (
sizeof dict_ibfk) - 1)
3182 && foreign->
id[len + ((
sizeof dict_ibfk) - 1)] !=
'0') {
3185 id = strtoul(foreign->
id + len
3186 + ((
sizeof dict_ibfk) - 1),
3188 if (*endp ==
'\0') {
3189 ut_a(
id != biggest_id);
3191 if (
id > biggest_id) {
3207 dict_foreign_report_syntax_err(
3210 const char* start_of_latest_foreign,
3215 FILE* ef = dict_foreign_err_file;
3217 mutex_enter(&dict_foreign_err_mutex);
3218 dict_foreign_error_report_low(ef, name);
3219 fprintf(ef,
"%s:\nSyntax error close to:\n%s\n",
3220 start_of_latest_foreign, ptr);
3221 mutex_exit(&dict_foreign_err_mutex);
3233 dict_create_foreign_constraints_low(
3238 const char* sql_string,
3255 ulint highest_id_so_far = 0;
3258 const char* ptr = sql_string;
3259 const char* start_of_latest_foreign = sql_string;
3260 FILE* ef = dict_foreign_err_file;
3261 const char* constraint_name;
3272 const char* column_names[500];
3273 const char* referenced_table_name;
3279 if (table == NULL) {
3280 mutex_enter(&dict_foreign_err_mutex);
3281 dict_foreign_error_report_low(ef, name);
3283 "Cannot find the table in the internal"
3284 " data dictionary of InnoDB.\n"
3285 "Create table statement:\n%s\n", sql_string);
3286 mutex_exit(&dict_foreign_err_mutex);
3294 ptr = dict_accept(cs, ptr,
"ALTER", &success);
3301 ptr = dict_accept(cs, ptr,
"TABLE", &success);
3310 ptr = dict_scan_table_name(cs, ptr, &table_to_alter, name,
3311 &success, heap, &referenced_table_name);
3314 "InnoDB: Error: could not find"
3315 " the table being ALTERED in:\n%s\n",
3330 if (table_to_alter == NULL) {
3331 highest_id_so_far = 0;
3333 highest_id_so_far = dict_table_get_highest_foreign_id(
3341 ptr1 = dict_scan_to(ptr,
"CONSTRAINT");
3342 ptr2 = dict_scan_to(ptr,
"FOREIGN");
3344 constraint_name = NULL;
3352 ptr = dict_accept(cs, ptr,
"CONSTRAINT", &success);
3356 if (!innobase_isspace(cs, *ptr) && *ptr !=
'"' && *ptr !=
'`') {
3360 while (innobase_isspace(cs, *ptr)) {
3366 ptr = dict_scan_id(cs, ptr, heap,
3367 &constraint_name, FALSE, FALSE);
3383 return(DB_CANNOT_ADD_CONSTRAINT);
3390 error = dict_create_add_foreigns_to_dictionary(
3391 highest_id_so_far, table, trx);
3395 start_of_latest_foreign = ptr;
3397 ptr = dict_accept(cs, ptr,
"FOREIGN", &success);
3403 if (!innobase_isspace(cs, *ptr)) {
3407 ptr = dict_accept(cs, ptr,
"KEY", &success);
3413 ptr = dict_accept(cs, ptr,
"(", &success);
3418 ptr = dict_skip_word(cs, ptr, &success);
3421 dict_foreign_report_syntax_err(
3422 name, start_of_latest_foreign, ptr);
3424 return(DB_CANNOT_ADD_CONSTRAINT);
3427 ptr = dict_accept(cs, ptr,
"(", &success);
3441 ut_a(i < (
sizeof column_names) /
sizeof *column_names);
3442 ptr = dict_scan_col(cs, ptr, &success, table, columns + i,
3443 heap, column_names + i);
3445 mutex_enter(&dict_foreign_err_mutex);
3446 dict_foreign_error_report_low(ef, name);
3447 fprintf(ef,
"%s:\nCannot resolve column name close to:\n%s\n",
3448 start_of_latest_foreign, ptr);
3449 mutex_exit(&dict_foreign_err_mutex);
3451 return(DB_CANNOT_ADD_CONSTRAINT);
3456 ptr = dict_accept(cs, ptr,
",", &success);
3462 ptr = dict_accept(cs, ptr,
")", &success);
3465 dict_foreign_report_syntax_err(
3466 name, start_of_latest_foreign, ptr);
3467 return(DB_CANNOT_ADD_CONSTRAINT);
3473 index = dict_foreign_find_index(table, column_names, i,
3477 mutex_enter(&dict_foreign_err_mutex);
3478 dict_foreign_error_report_low(ef, name);
3479 fputs(
"There is no index in table ", ef);
3481 fprintf(ef,
" where the columns appear\n"
3482 "as the first columns. Constraint:\n%s\n"
3483 "See " REFMAN
"innodb-foreign-key-constraints.html\n"
3484 "for correct foreign key definition.\n",
3485 start_of_latest_foreign);
3486 mutex_exit(&dict_foreign_err_mutex);
3488 return(DB_CHILD_NO_INDEX);
3490 ptr = dict_accept(cs, ptr,
"REFERENCES", &success);
3492 if (!success || !innobase_isspace(cs, *ptr)) {
3493 dict_foreign_report_syntax_err(
3494 name, start_of_latest_foreign, ptr);
3495 return(DB_CANNOT_ADD_CONSTRAINT);
3500 foreign = dict_mem_foreign_create();
3502 if (constraint_name) {
3510 db_len = dict_get_db_name_len(table->
name);
3513 foreign->
heap, db_len + strlen(constraint_name) + 2));
3516 foreign->
id[db_len] =
'/';
3517 strcpy(foreign->
id + db_len + 1, constraint_name);
3524 foreign->
n_fields = (
unsigned int) i;
3526 i *
sizeof(
void*)));
3527 for (i = 0; i < foreign->
n_fields; i++) {
3530 dict_table_get_col_name(table,
3534 ptr = dict_scan_table_name(cs, ptr, &referenced_table, name,
3535 &success, heap, &referenced_table_name);
3540 if (!success || (!referenced_table && trx->check_foreigns)) {
3541 dict_foreign_free(foreign);
3543 mutex_enter(&dict_foreign_err_mutex);
3544 dict_foreign_error_report_low(ef, name);
3545 fprintf(ef,
"%s:\nCannot resolve table name close to:\n"
3547 start_of_latest_foreign, ptr);
3548 mutex_exit(&dict_foreign_err_mutex);
3550 return(DB_CANNOT_ADD_CONSTRAINT);
3553 ptr = dict_accept(cs, ptr,
"(", &success);
3556 dict_foreign_free(foreign);
3557 dict_foreign_report_syntax_err(name, start_of_latest_foreign,
3559 return(DB_CANNOT_ADD_CONSTRAINT);
3566 ptr = dict_scan_col(cs, ptr, &success, referenced_table, columns + i,
3567 heap, column_names + i);
3571 dict_foreign_free(foreign);
3573 mutex_enter(&dict_foreign_err_mutex);
3574 dict_foreign_error_report_low(ef, name);
3575 fprintf(ef,
"%s:\nCannot resolve column name close to:\n"
3577 start_of_latest_foreign, ptr);
3578 mutex_exit(&dict_foreign_err_mutex);
3580 return(DB_CANNOT_ADD_CONSTRAINT);
3583 ptr = dict_accept(cs, ptr,
",", &success);
3589 ptr = dict_accept(cs, ptr,
")", &success);
3591 if (!success || foreign->
n_fields != i) {
3592 dict_foreign_free(foreign);
3594 dict_foreign_report_syntax_err(name, start_of_latest_foreign,
3596 return(DB_CANNOT_ADD_CONSTRAINT);
3605 ptr = dict_accept(cs, ptr,
"ON", &success);
3609 goto try_find_index;
3612 ptr = dict_accept(cs, ptr,
"DELETE", &success);
3615 ptr = dict_accept(cs, ptr,
"UPDATE", &success);
3618 dict_foreign_free(foreign);
3620 dict_foreign_report_syntax_err(
3621 name, start_of_latest_foreign, ptr);
3622 return(DB_CANNOT_ADD_CONSTRAINT);
3625 is_on_delete = FALSE;
3628 is_on_delete = TRUE;
3632 ptr = dict_accept(cs, ptr,
"RESTRICT", &success);
3635 goto scan_on_conditions;
3638 ptr = dict_accept(cs, ptr,
"CASCADE", &success);
3647 goto scan_on_conditions;
3650 ptr = dict_accept(cs, ptr,
"NO", &success);
3653 ptr = dict_accept(cs, ptr,
"ACTION", &success);
3656 dict_foreign_free(foreign);
3657 dict_foreign_report_syntax_err(
3658 name, start_of_latest_foreign, ptr);
3660 return(DB_CANNOT_ADD_CONSTRAINT);
3669 goto scan_on_conditions;
3672 ptr = dict_accept(cs, ptr,
"SET", &success);
3675 dict_foreign_free(foreign);
3676 dict_foreign_report_syntax_err(name, start_of_latest_foreign,
3678 return(DB_CANNOT_ADD_CONSTRAINT);
3681 ptr = dict_accept(cs, ptr,
"NULL", &success);
3684 dict_foreign_free(foreign);
3685 dict_foreign_report_syntax_err(name, start_of_latest_foreign,
3687 return(DB_CANNOT_ADD_CONSTRAINT);
3690 for (j = 0; j < foreign->
n_fields; j++) {
3697 dict_foreign_free(foreign);
3699 mutex_enter(&dict_foreign_err_mutex);
3700 dict_foreign_error_report_low(ef, name);
3702 "You have defined a SET NULL condition"
3703 " though some of the\n"
3704 "columns are defined as NOT NULL.\n",
3705 start_of_latest_foreign);
3706 mutex_exit(&dict_foreign_err_mutex);
3708 return(DB_CANNOT_ADD_CONSTRAINT);
3718 goto scan_on_conditions;
3721 if (n_on_deletes > 1 || n_on_updates > 1) {
3724 dict_foreign_free(foreign);
3726 mutex_enter(&dict_foreign_err_mutex);
3727 dict_foreign_error_report_low(ef, name);
3729 "You have twice an ON DELETE clause"
3730 " or twice an ON UPDATE clause.\n",
3731 start_of_latest_foreign);
3732 mutex_exit(&dict_foreign_err_mutex);
3734 return(DB_CANNOT_ADD_CONSTRAINT);
3741 if (referenced_table) {
3742 index = dict_foreign_find_index(referenced_table,
3747 dict_foreign_free(foreign);
3748 mutex_enter(&dict_foreign_err_mutex);
3749 dict_foreign_error_report_low(ef, name);
3751 "Cannot find an index in the"
3752 " referenced table where the\n"
3753 "referenced columns appear as the"
3754 " first columns, or column types\n"
3755 "in the table and the referenced table"
3756 " do not match for constraint.\n"
3757 "Note that the internal storage type of"
3758 " ENUM and SET changed in\n"
3759 "tables created with >= InnoDB-4.1.12,"
3760 " and such columns in old tables\n"
3761 "cannot be referenced by such columns"
3764 "innodb-foreign-key-constraints.html\n"
3765 "for correct foreign key definition.\n",
3766 start_of_latest_foreign);
3767 mutex_exit(&dict_foreign_err_mutex);
3769 return(DB_PARENT_NO_INDEX);
3772 ut_a(trx->check_foreigns == FALSE);
3783 i *
sizeof(
void*)));
3784 for (i = 0; i < foreign->
n_fields; i++) {
3793 if (referenced_table) {
3811 dict_create_foreign_constraints(
3814 const char* sql_string,
3837 str = dict_strip_comments(sql_string, sql_length);
3840 err = dict_create_foreign_constraints_low(
3841 trx, heap, trx->session()->charset(), str, name,
3856 dict_foreign_parse_drop_constraints(
3864 const char*** constraints_to_drop)
3873 FILE* ef = dict_foreign_err_file;
3879 cs = trx->session()->charset();
3883 *constraints_to_drop =
static_cast<const char **
>(
mem_heap_alloc(heap, 1000 *
sizeof(
char*)));
3885 ptr= trx->session()->getQueryStringCopy(len);
3887 str = dict_strip_comments(ptr, len);
3893 ptr = dict_scan_to(ptr,
"DROP");
3901 ptr = dict_accept(cs, ptr,
"DROP", &success);
3903 if (!innobase_isspace(cs, *ptr)) {
3908 ptr = dict_accept(cs, ptr,
"FOREIGN", &success);
3910 if (!success || !innobase_isspace(cs, *ptr)) {
3915 ptr = dict_accept(cs, ptr,
"KEY", &success);
3922 ptr = dict_scan_id(cs, ptr, heap, &
id, FALSE, TRUE);
3930 (*constraints_to_drop)[*n] = id;
3937 while (foreign != NULL) {
3938 if (0 == strcmp(foreign->
id,
id)
3939 || (strchr(foreign->
id,
'/')
3941 dict_remove_db_name(foreign->
id)))) {
3949 if (foreign == NULL) {
3950 mutex_enter(&dict_foreign_err_mutex);
3953 fputs(
" Error in dropping of a foreign key constraint"
3957 "in SQL command\n", ef);
3959 fputs(
"\nCannot find a constraint with the given id ", ef);
3962 mutex_exit(&dict_foreign_err_mutex);
3966 return(DB_CANNOT_DROP_CONSTRAINT);
3972 mutex_enter(&dict_foreign_err_mutex);
3975 fputs(
" Syntax error in dropping of a"
3976 " foreign key constraint of table ", ef);
3979 "close to:\n%s\n in SQL command\n%s\n", ptr, str);
3980 mutex_exit(&dict_foreign_err_mutex);
3984 return(DB_CANNOT_DROP_CONSTRAINT);
3995 dict_index_get_if_in_cache_low(
3997 index_id_t index_id)
4001 return(dict_index_find_on_id_low(index_id));
4004 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
4010 dict_index_get_if_in_cache(
4012 index_id_t index_id)
4016 if (dict_sys == NULL) {
4020 mutex_enter(&(dict_sys->
mutex));
4022 index = dict_index_get_if_in_cache_low(index_id);
4024 mutex_exit(&(dict_sys->
mutex));
4037 dict_index_check_search_tuple(
4054 dict_index_build_node_ptr(
4098 dict_index_copy_types(tuple, index, n_unique);
4104 field = dtuple_get_nth_field(tuple, n_unique);
4107 dtype_set(dfield_get_type(field), DATA_SYS_CHILD, DATA_NOT_NULL, 4);
4111 | REC_STATUS_NODE_PTR);
4124 dict_index_copy_rec_order_prefix(
4136 UNIV_PREFETCH_R(rec);
4154 dict_index_build_data_tuple(
4168 dict_index_copy_types(tuple, index, n_fields);
4181 dict_index_calc_min_rec_len(
4191 sum = REC_N_NEW_EXTRA_BYTES;
4199 sum += size < 128 ? 1 : 2;
4201 if (!(col->
prtype & DATA_NOT_NULL)) {
4223 sum += REC_N_OLD_EXTRA_BYTES;
4233 dict_update_statistics(
4236 ibool only_calc_if_missing_stats)
4242 ulint sum_of_index_sizes = 0;
4247 " InnoDB: cannot calculate statistics for table %s\n"
4248 "InnoDB: because the .ibd file is missing. For help,"
4249 " please refer to\n"
4250 "InnoDB: " REFMAN
"innodb-troubleshooting.html\n",
4259 index = dict_table_get_first_index(table);
4261 if (index == NULL) {
4267 dict_table_stats_lock(table, RW_X_LATCH);
4270 dict_table_stats_unlock(table, RW_X_LATCH);
4280 size = btr_get_size(index, BTR_TOTAL_SIZE);
4284 sum_of_index_sizes += size;
4286 size = btr_get_size(index, BTR_N_LEAF_PAGES);
4295 btr_estimate_number_of_different_key_vals(index);
4305 sum_of_index_sizes++;
4313 index = dict_table_get_next_index(index);
4316 index = dict_table_get_first_index(table);
4330 dict_table_stats_unlock(table, RW_X_LATCH);
4337 dict_foreign_print_low(
4345 fprintf(stderr,
" FOREIGN KEY CONSTRAINT %s: %s (",
4348 for (i = 0; i < foreign->
n_fields; i++) {
4352 fprintf(stderr,
" )\n"
4356 for (i = 0; i < foreign->
n_fields; i++) {
4360 fputs(
" )\n", stderr);
4371 mutex_enter(&(dict_sys->
mutex));
4372 dict_table_print_low(table);
4373 mutex_exit(&(dict_sys->
mutex));
4380 dict_table_print_by_name(
4386 mutex_enter(&(dict_sys->
mutex));
4392 dict_table_print_low(table);
4393 mutex_exit(&(dict_sys->
mutex));
4400 dict_table_print_low(
4410 dict_update_statistics(table, FALSE );
4412 dict_table_stats_lock(table, RW_S_LATCH);
4415 "--------------------------------------\n"
4416 "TABLE: name %s, id %llu, flags %lx, columns %lu,"
4417 " indexes %lu, appr.rows %lu\n"
4421 (ulong) table->
flags,
4426 for (i = 0; i < (ulint) table->
n_cols; i++) {
4427 dict_col_print_low(table, dict_table_get_nth_col(table, i));
4428 fputs(
"; ", stderr);
4435 while (index != NULL) {
4436 dict_index_print_low(index);
4440 dict_table_stats_unlock(table, RW_S_LATCH);
4444 while (foreign != NULL) {
4445 dict_foreign_print_low(foreign);
4451 while (foreign != NULL) {
4452 dict_foreign_print_low(foreign);
4471 fprintf(stderr,
"%s: ", dict_table_get_col_name(table,
4481 dict_index_print_low(
4498 " INDEX: name %s, id %llu, fields %lu/%lu,"
4499 " uniq %lu, type %lu\n"
4500 " root page %lu, appr.key vals %lu,"
4501 " leaf pages %lu, size pages %lu\n"
4508 (ulong) index->
type,
4509 (ulong) index->
page,
4514 for (i = 0; i < index->
n_fields; i++) {
4515 dict_field_print_low(dict_index_get_nth_field(index, i));
4520 #ifdef UNIV_BTR_PRINT
4521 btr_print_size(index);
4523 btr_print_index(index, 7);
4531 dict_field_print_low(
4537 fprintf(stderr,
" %s", field->
name);
4540 fprintf(stderr,
"(%lu)", (ulong) field->
prefix_len);
4549 dict_print_info_on_foreign_key_in_create_format(
4556 const char* stripped_id;
4559 if (strchr(foreign->
id,
'/')) {
4561 stripped_id = foreign->
id + 1
4562 + dict_get_db_name_len(foreign->
id);
4564 stripped_id = foreign->
id;
4576 fputs(
" CONSTRAINT ", file);
4578 fputs(
" FOREIGN KEY (", file);
4582 if (++i < foreign->n_fields) {
4589 fputs(
") REFERENCES ", file);
4595 dict_remove_db_name(
4608 if (++i < foreign->n_fields) {
4618 fputs(
" ON DELETE CASCADE", file);
4622 fputs(
" ON DELETE SET NULL", file);
4626 fputs(
" ON DELETE NO ACTION", file);
4630 fputs(
" ON UPDATE CASCADE", file);
4634 fputs(
" ON UPDATE SET NULL", file);
4638 fputs(
" ON UPDATE NO ACTION", file);
4646 dict_print_info_on_foreign_keys(
4648 ibool create_table_format,
4658 mutex_enter(&(dict_sys->
mutex));
4662 if (foreign == NULL) {
4663 mutex_exit(&(dict_sys->
mutex));
4668 while (foreign != NULL) {
4669 if (create_table_format) {
4670 dict_print_info_on_foreign_key_in_create_format(
4671 file, trx, foreign, TRUE);
4676 for (i = 0; i < foreign->
n_fields; i++) {
4685 fputs(
") REFER ", file);
4690 for (i = 0; i < foreign->
n_fields; i++) {
4702 fputs(
" ON DELETE CASCADE", file);
4706 fputs(
" ON DELETE SET NULL", file);
4710 fputs(
" ON DELETE NO ACTION", file);
4714 fputs(
" ON UPDATE CASCADE", file);
4718 fputs(
" ON UPDATE SET NULL", file);
4722 fputs(
" ON UPDATE NO ACTION", file);
4729 mutex_exit(&(dict_sys->
mutex));
4736 dict_index_name_print(
4742 fputs(
"index ", file);
4744 fputs(
" of table ", file);
4759 table = dict_mem_table_create(
"SYS_DUMMY1", DICT_HDR_SPACE, 1, 0);
4760 dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
4761 DATA_ENGLISH | DATA_NOT_NULL, 8);
4763 dict_ind_redundant = dict_mem_index_create(
"SYS_DUMMY1",
"SYS_DUMMY1",
4764 DICT_HDR_SPACE, 0, 1);
4765 dict_index_add_col(dict_ind_redundant, table,
4766 dict_table_get_nth_col(table, 0), 0);
4767 dict_ind_redundant->
table = table;
4769 table = dict_mem_table_create(
"SYS_DUMMY2",
4771 dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR,
4772 DATA_ENGLISH | DATA_NOT_NULL, 8);
4773 dict_ind_compact = dict_mem_index_create(
"SYS_DUMMY2",
"SYS_DUMMY2",
4774 DICT_HDR_SPACE, 0, 1);
4775 dict_index_add_col(dict_ind_compact, table,
4776 dict_table_get_nth_col(table, 0), 0);
4777 dict_ind_compact->
table = table;
4780 dict_ind_redundant->
cached = dict_ind_compact->
cached = TRUE;
4792 table = dict_ind_compact->
table;
4793 dict_mem_index_free(dict_ind_compact);
4794 dict_ind_compact = NULL;
4795 dict_mem_table_free(table);
4797 table = dict_ind_redundant->
table;
4798 dict_mem_index_free(dict_ind_redundant);
4799 dict_ind_redundant = NULL;
4800 dict_mem_table_free(table);
4803 #ifndef UNIV_HOTBACKUP
4809 dict_table_get_index_on_name(
4816 index = dict_table_get_first_index(table);
4818 while (index != NULL) {
4824 index = dict_table_get_next_index(index);
4836 dict_table_replace_index_in_foreign_list(
4850 = dict_foreign_find_equiv_index(foreign);
4857 ut_a(new_index || !trx->check_foreigns);
4870 dict_table_get_index_on_name_and_min_id(
4879 index = dict_table_get_first_index(table);
4881 while (index != NULL) {
4883 if (!min_index || index->
id < min_index->
id) {
4889 index = dict_table_get_next_index(index);
4901 dict_table_check_for_dup_indexes(
4961 ut_a(prev_table->magic_n == DICT_TABLE_MAGIC_N);
4964 mutex_enter(&dict_sys->
mutex);
4966 dict_table_remove_from_cache(prev_table);
4968 mutex_exit(&dict_sys->
mutex);
4980 mutex_free(&dict_sys->
mutex);
4982 rw_lock_free(&dict_operation_lock);
4983 memset(&dict_operation_lock, 0x0,
sizeof(dict_operation_lock));
4985 mutex_free(&dict_foreign_err_mutex);
4990 for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) {
4991 rw_lock_free(&dict_table_stats_latches[i]);