summaryrefslogtreecommitdiff
path: root/innobase/dict/dict0dict.c
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/dict/dict0dict.c')
-rw-r--r--innobase/dict/dict0dict.c64
1 files changed, 57 insertions, 7 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 13ed5bd9af1..bf60567ceaa 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -209,7 +209,7 @@ dict_tables_have_same_db(
}
}
- ut_a(0);
+ ut_error;
return(FALSE);
}
@@ -232,7 +232,7 @@ dict_remove_db_name(
}
}
- ut_a(0);
+ ut_error;
return(NULL);
}
@@ -255,7 +255,7 @@ dict_get_db_name_len(
}
}
- ut_a(0);
+ ut_error;
return(0);
}
@@ -616,7 +616,9 @@ dict_table_get_on_id(
if we are doing a rollback to handle an error in TABLE
CREATE, for example, we already have the mutex! */
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
return(dict_table_get_on_id_low(table_id, trx));
}
@@ -762,7 +764,9 @@ dict_table_add_to_cache(
ulint i;
ut_ad(table);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->n_def == table->n_cols - DATA_N_SYS_COLS);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(table->cached == FALSE);
@@ -898,8 +902,10 @@ dict_table_rename_in_cache(
ulint i;
ut_ad(table);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-
+#endif /* UNIV_SYNC_DEBUG */
+
old_size = mem_heap_get_size(table->heap);
fold = ut_fold_string(new_name);
@@ -1136,7 +1142,9 @@ dict_table_remove_from_cache(
ulint i;
ut_ad(table);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* printf("Removing table %s from dictionary cache\n", table->name); */
@@ -1205,9 +1213,11 @@ dict_table_LRU_trim(void)
dict_table_t* table;
dict_table_t* prev_table;
- ut_a(0);
+ ut_error;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
table = UT_LIST_GET_LAST(dict_sys->table_LRU);
@@ -1236,7 +1246,9 @@ dict_col_add_to_cache(
ulint fold;
ut_ad(table && col);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
@@ -1267,7 +1279,9 @@ dict_col_remove_from_cache(
ulint fold;
ut_ad(table && col);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
@@ -1290,7 +1304,9 @@ dict_col_reposition_in_cache(
ulint fold;
ut_ad(table && col);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
@@ -1324,7 +1340,9 @@ dict_index_add_to_cache(
ulint i;
ut_ad(index);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(index->n_def == index->n_fields);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
@@ -1450,7 +1468,9 @@ dict_index_remove_from_cache(
ut_ad(table && index);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(UT_LIST_GET_LEN((index->tree)->tree_indexes) == 1);
dict_tree_free(index->tree);
@@ -1494,7 +1514,9 @@ dict_index_find_cols(
ut_ad(table && index);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < index->n_fields; i++) {
field = dict_index_get_nth_field(index, i);
@@ -1635,7 +1657,9 @@ dict_index_build_internal_clust(
ut_ad(table && index);
ut_ad(index->type & DICT_CLUSTERED);
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* Create a new index object with certainly enough fields */
@@ -1804,7 +1828,9 @@ dict_index_build_internal_non_clust(
ut_ad(table && index);
ut_ad(0 == (index->type & DICT_CLUSTERED));
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* The clustered index should be the first in the list of indexes */
@@ -1923,7 +1949,9 @@ dict_foreign_remove_from_cache(
/*===========================*/
dict_foreign_t* foreign) /* in, own: foreign constraint */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
ut_a(foreign);
if (foreign->referenced_table) {
@@ -1952,7 +1980,9 @@ dict_foreign_find(
{
dict_foreign_t* foreign;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
foreign = UT_LIST_GET_FIRST(table->foreign_list);
@@ -2061,7 +2091,9 @@ dict_foreign_add_to_cache(
ibool added_to_referenced_list = FALSE;
char* buf = dict_foreign_err_buf;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
for_table = dict_table_check_if_in_cache_low(
foreign->foreign_table_name);
@@ -2732,7 +2764,9 @@ dict_create_foreign_constraints_low(
ulint column_name_lens[500];
char referenced_table_name[2500];
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
table = dict_table_get_low(name);
@@ -3312,7 +3346,9 @@ dict_foreign_parse_drop_constraints(
str = dict_strip_comments(*(trx->mysql_query_str));
ptr = str;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
loop:
ptr = dict_scan_to(ptr, (char *) "DROP");
@@ -3452,7 +3488,9 @@ dict_procedure_reserve_parsed_copy(
que_t* graph;
proc_node_t* proc_node;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(dict_sys->mutex));
@@ -3500,7 +3538,9 @@ dict_procedure_release_parsed_copy(
{
proc_node_t* proc_node;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
+#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(dict_sys->mutex));
@@ -3577,9 +3617,9 @@ dict_tree_create(
tree->id = index->id;
UT_LIST_INIT(tree->tree_indexes);
-
+#ifdef UNIV_DEBUG
tree->magic_n = DICT_TREE_MAGIC_N;
-
+#endif /* UNIV_DEBUG */
rw_lock_create(&(tree->lock));
rw_lock_set_level(&(tree->lock), SYNC_INDEX_TREE);
@@ -3990,7 +4030,9 @@ dict_foreign_print_low(
{
ulint i;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
printf(" FOREIGN KEY CONSTRAINT %s: %s (", foreign->id,
foreign->foreign_table_name);
@@ -4055,7 +4097,9 @@ dict_table_print_low(
dict_foreign_t* foreign;
ulint i;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
dict_update_statistics_low(table, TRUE);
@@ -4109,7 +4153,9 @@ dict_col_print_low(
{
dtype_t* type;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
type = dict_col_get_type(col);
printf("%s: ", col->name);
@@ -4129,7 +4175,9 @@ dict_index_print_low(
ib_longlong n_vals;
ulint i;
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
tree = index->tree;
@@ -4175,7 +4223,9 @@ dict_field_print_low(
/*=================*/
dict_field_t* field) /* in: field */
{
+#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#endif /* UNIV_SYNC_DEBUG */
printf(" %s", field->name);