#include "univ.i"#include "dict0types.h"#include "dict0dict.h"#include "que0types.h"#include "row0types.h"#include "mtr0mtr.h"Include dependency graph for dict0crea.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| struct | tab_node_struct |
| struct | ind_node_struct |
Defines | |
| #define | TABLE_BUILD_TABLE_DEF 1 |
| #define | TABLE_BUILD_COL_DEF 2 |
| #define | TABLE_COMMIT_WORK 3 |
| #define | TABLE_ADD_TO_CACHE 4 |
| #define | TABLE_COMPLETED 5 |
| #define | INDEX_BUILD_INDEX_DEF 1 |
| #define | INDEX_BUILD_FIELD_DEF 2 |
| #define | INDEX_CREATE_INDEX_TREE 3 |
| #define | INDEX_COMMIT_WORK 4 |
| #define | INDEX_ADD_TO_CACHE 5 |
Functions | |
| tab_node_t * | tab_create_graph_create (dict_table_t *table, mem_heap_t *heap) |
| ind_node_t * | ind_create_graph_create (dict_index_t *index, mem_heap_t *heap) |
| que_thr_t * | dict_create_table_step (que_thr_t *thr) |
| que_thr_t * | dict_create_index_step (que_thr_t *thr) |
| ulint | dict_truncate_index_tree (dict_table_t *table, rec_t *rec, mtr_t *mtr) |
| void | dict_drop_index_tree (rec_t *rec, mtr_t *mtr) |
| ulint | dict_create_or_check_foreign_constraint_tables (void) |
| ulint | dict_create_add_foreigns_to_dictionary (ulint start_id, dict_table_t *table, trx_t *trx) |
| #define INDEX_ADD_TO_CACHE 5 |
| #define INDEX_BUILD_FIELD_DEF 2 |
| #define INDEX_BUILD_INDEX_DEF 1 |
Definition at line 167 of file dict0crea.h.
Referenced by dict_create_index_step(), and ind_create_graph_create().
| #define INDEX_COMMIT_WORK 4 |
| #define INDEX_CREATE_INDEX_TREE 3 |
| #define TABLE_ADD_TO_CACHE 4 |
| #define TABLE_BUILD_COL_DEF 2 |
| #define TABLE_BUILD_TABLE_DEF 1 |
Definition at line 135 of file dict0crea.h.
Referenced by dict_create_table_step(), and tab_create_graph_create().
| #define TABLE_COMMIT_WORK 3 |
| #define TABLE_COMPLETED 5 |
Definition at line 139 of file dict0crea.h.
| ulint dict_create_add_foreigns_to_dictionary | ( | ulint | start_id, | |
| dict_table_t * | table, | |||
| trx_t * | trx | |||
| ) |
Definition at line 1407 of file dict0crea.c.
References DB_ERROR, DB_SUCCESS, dict_create_add_foreign_to_dictionary(), dict_sys, dict_table_get_low(), error, dict_table_struct::foreign_list, dict_sys_struct::mutex, NULL, ut_ad, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.
Referenced by dict_create_foreign_constraints_low().
01409 : error code or DB_SUCCESS */ 01410 ulint start_id,/* in: if we are actually doing ALTER TABLE 01411 ADD CONSTRAINT, we want to generate constraint 01412 numbers which are bigger than in the table so 01413 far; we number the constraints from 01414 start_id + 1 up; start_id should be set to 0 if 01415 we are creating a new table, or if the table 01416 so far has no constraints for which the name 01417 was generated here */ 01418 dict_table_t* table, /* in: table */ 01419 trx_t* trx) /* in: transaction */ 01420 { 01421 dict_foreign_t* foreign; 01422 ulint number = start_id + 1; 01423 ulint error; 01424 01425 #ifdef UNIV_SYNC_DEBUG 01426 ut_ad(mutex_own(&(dict_sys->mutex))); 01427 #endif /* UNIV_SYNC_DEBUG */ 01428 01429 if (NULL == dict_table_get_low("SYS_FOREIGN")) { 01430 fprintf(stderr, 01431 "InnoDB: table SYS_FOREIGN not found from internal data dictionary\n"); 01432 01433 return(DB_ERROR); 01434 } 01435 01436 for (foreign = UT_LIST_GET_FIRST(table->foreign_list); 01437 foreign; 01438 foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) { 01439 01440 error = dict_create_add_foreign_to_dictionary(&number, 01441 table, foreign, trx); 01442 01443 if (error != DB_SUCCESS) { 01444 01445 return(error); 01446 } 01447 } 01448 01449 return(DB_SUCCESS); 01450 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1000 of file dict0crea.c.
References DB_ERROR, DB_LOCK_WAIT, DB_SUCCESS, dict_build_field_def_step(), dict_build_index_def_step(), dict_create_index_tree_step(), dict_index_add_to_cache(), dict_sys, err, trx_struct::error_state, ind_node_struct::field_def, ind_node_struct::field_no, ind_node_struct::ind_def, ind_node_struct::index, INDEX_ADD_TO_CACHE, INDEX_BUILD_FIELD_DEF, INDEX_BUILD_INDEX_DEF, INDEX_COMMIT_WORK, INDEX_CREATE_INDEX_TREE, dict_sys_struct::mutex, NULL, ind_node_struct::page_no, que_thr_struct::prev_node, QUE_NODE_CREATE_INDEX, que_node_get_parent(), que_node_get_type(), que_thr_struct::run_node, ind_node_struct::state, ind_node_struct::table, thr_get_trx(), ut_a, and ut_ad.
Referenced by que_thr_step().
01002 : query thread to run next or NULL */ 01003 que_thr_t* thr) /* in: query thread */ 01004 { 01005 ind_node_t* node; 01006 ibool success; 01007 ulint err = DB_ERROR; 01008 trx_t* trx; 01009 01010 ut_ad(thr); 01011 #ifdef UNIV_SYNC_DEBUG 01012 ut_ad(mutex_own(&(dict_sys->mutex))); 01013 #endif /* UNIV_SYNC_DEBUG */ 01014 01015 trx = thr_get_trx(thr); 01016 01017 node = thr->run_node; 01018 01019 ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_INDEX); 01020 01021 if (thr->prev_node == que_node_get_parent(node)) { 01022 node->state = INDEX_BUILD_INDEX_DEF; 01023 } 01024 01025 if (node->state == INDEX_BUILD_INDEX_DEF) { 01026 /* DO THE CHECKS OF THE CONSISTENCY CONSTRAINTS HERE */ 01027 err = dict_build_index_def_step(thr, node); 01028 01029 if (err != DB_SUCCESS) { 01030 01031 goto function_exit; 01032 } 01033 01034 node->state = INDEX_BUILD_FIELD_DEF; 01035 node->field_no = 0; 01036 01037 thr->run_node = node->ind_def; 01038 01039 return(thr); 01040 } 01041 01042 if (node->state == INDEX_BUILD_FIELD_DEF) { 01043 01044 if (node->field_no < (node->index)->n_fields) { 01045 01046 err = dict_build_field_def_step(node); 01047 01048 if (err != DB_SUCCESS) { 01049 01050 goto function_exit; 01051 } 01052 01053 node->field_no++; 01054 01055 thr->run_node = node->field_def; 01056 01057 return(thr); 01058 } else { 01059 node->state = INDEX_CREATE_INDEX_TREE; 01060 } 01061 } 01062 01063 if (node->state == INDEX_CREATE_INDEX_TREE) { 01064 01065 err = dict_create_index_tree_step(node); 01066 01067 if (err != DB_SUCCESS) { 01068 01069 goto function_exit; 01070 } 01071 01072 node->state = INDEX_COMMIT_WORK; 01073 } 01074 01075 if (node->state == INDEX_COMMIT_WORK) { 01076 01077 /* Index was correctly defined: do NOT commit the transaction 01078 (CREATE INDEX does NOT currently do an implicit commit of 01079 the current transaction) */ 01080 01081 node->state = INDEX_ADD_TO_CACHE; 01082 01083 /* thr->run_node = node->commit_node; 01084 01085 return(thr); */ 01086 } 01087 01088 if (node->state == INDEX_ADD_TO_CACHE) { 01089 01090 success = dict_index_add_to_cache(node->table, node->index, 01091 node->page_no); 01092 01093 ut_a(success); 01094 01095 err = DB_SUCCESS; 01096 } 01097 01098 function_exit: 01099 trx->error_state = err; 01100 01101 if (err == DB_SUCCESS) { 01102 /* Ok: do nothing */ 01103 01104 } else if (err == DB_LOCK_WAIT) { 01105 01106 return(NULL); 01107 } else { 01108 /* SQL error detected */ 01109 01110 return(NULL); 01111 } 01112 01113 thr->run_node = que_node_get_parent(node); 01114 01115 return(thr); 01116 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ulint dict_create_or_check_foreign_constraint_tables | ( | void | ) |
Definition at line 1124 of file dict0crea.c.
References DB_MUST_GET_MORE_FILE_SPACE, DB_OUT_OF_FILE_SPACE, DB_SUCCESS, dict_sys, dict_table_get_low(), error, FALSE, dict_table_struct::indexes, dict_sys_struct::mutex, mutex_enter, mutex_exit(), NULL, trx_struct::op_info, que_eval_sql(), row_drop_table_for_mysql(), row_mysql_lock_data_dictionary(), row_mysql_unlock_data_dictionary(), table2, TRUE, trx_allocate_for_mysql(), trx_free_for_mysql(), ut_a, and UT_LIST_GET_LEN.
Referenced by innobase_start_or_create_for_mysql().
01126 : DB_SUCCESS or error code */ 01127 { 01128 dict_table_t* table1; 01129 dict_table_t* table2; 01130 ulint error; 01131 trx_t* trx; 01132 01133 mutex_enter(&(dict_sys->mutex)); 01134 01135 table1 = dict_table_get_low("SYS_FOREIGN"); 01136 table2 = dict_table_get_low("SYS_FOREIGN_COLS"); 01137 01138 if (table1 && table2 01139 && UT_LIST_GET_LEN(table1->indexes) == 3 01140 && UT_LIST_GET_LEN(table2->indexes) == 1) { 01141 01142 /* Foreign constraint system tables have already been 01143 created, and they are ok */ 01144 01145 mutex_exit(&(dict_sys->mutex)); 01146 01147 return(DB_SUCCESS); 01148 } 01149 01150 mutex_exit(&(dict_sys->mutex)); 01151 01152 trx = trx_allocate_for_mysql(); 01153 01154 trx->op_info = "creating foreign key sys tables"; 01155 01156 row_mysql_lock_data_dictionary(trx); 01157 01158 if (table1) { 01159 fprintf(stderr, 01160 "InnoDB: dropping incompletely created SYS_FOREIGN table\n"); 01161 row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE); 01162 } 01163 01164 if (table2) { 01165 fprintf(stderr, 01166 "InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n"); 01167 row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE); 01168 } 01169 01170 fprintf(stderr, 01171 "InnoDB: Creating foreign key constraint system tables\n"); 01172 01173 /* NOTE: in dict_load_foreigns we use the fact that 01174 there are 2 secondary indexes on SYS_FOREIGN, and they 01175 are defined just like below */ 01176 01177 /* NOTE: when designing InnoDB's foreign key support in 2001, we made 01178 an error and made the table names and the foreign key id of type 01179 'CHAR' (internally, really a VARCHAR). We should have made the type 01180 VARBINARY, like in other InnoDB system tables, to get a clean 01181 design. */ 01182 01183 error = que_eval_sql(NULL, 01184 "PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n" 01185 "BEGIN\n" 01186 "CREATE TABLE\n" 01187 "SYS_FOREIGN(ID CHAR, FOR_NAME CHAR, REF_NAME CHAR, N_COLS INT);\n" 01188 "CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN (ID);\n" 01189 "CREATE INDEX FOR_IND ON SYS_FOREIGN (FOR_NAME);\n" 01190 "CREATE INDEX REF_IND ON SYS_FOREIGN (REF_NAME);\n" 01191 "CREATE TABLE\n" 01192 "SYS_FOREIGN_COLS(ID CHAR, POS INT, FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n" 01193 "CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n" 01194 "COMMIT WORK;\n" 01195 "END;\n" 01196 , FALSE, trx); 01197 01198 if (error != DB_SUCCESS) { 01199 fprintf(stderr, "InnoDB: error %lu in creation\n", 01200 (ulong) error); 01201 01202 ut_a(error == DB_OUT_OF_FILE_SPACE); 01203 01204 fprintf(stderr, "InnoDB: creation failed\n"); 01205 fprintf(stderr, "InnoDB: tablespace is full\n"); 01206 fprintf(stderr, 01207 "InnoDB: dropping incompletely created SYS_FOREIGN tables\n"); 01208 01209 row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE); 01210 row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE); 01211 01212 error = DB_MUST_GET_MORE_FILE_SPACE; 01213 } 01214 01215 trx->op_info = ""; 01216 01217 row_mysql_unlock_data_dictionary(trx); 01218 01219 trx_free_for_mysql(trx); 01220 01221 if (error == DB_SUCCESS) { 01222 fprintf(stderr, 01223 "InnoDB: Foreign key constraint system tables created\n"); 01224 } 01225 01226 return(error); 01227 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 891 of file dict0crea.c.
References tab_node_struct::col_def, tab_node_struct::col_no, DB_ERROR, DB_LOCK_WAIT, DB_SUCCESS, dict_build_col_def_step(), dict_build_table_def_step(), dict_sys, dict_table_add_to_cache(), err, trx_struct::error_state, dict_sys_struct::mutex, NULL, que_thr_struct::prev_node, QUE_NODE_CREATE_TABLE, que_node_get_parent(), que_node_get_type(), que_thr_struct::run_node, tab_node_struct::state, tab_node_struct::tab_def, tab_node_struct::table, TABLE_ADD_TO_CACHE, TABLE_BUILD_COL_DEF, TABLE_BUILD_TABLE_DEF, TABLE_COMMIT_WORK, thr_get_trx(), and ut_ad.
Referenced by que_thr_step().
00893 : query thread to run next or NULL */ 00894 que_thr_t* thr) /* in: query thread */ 00895 { 00896 tab_node_t* node; 00897 ulint err = DB_ERROR; 00898 trx_t* trx; 00899 00900 ut_ad(thr); 00901 #ifdef UNIV_SYNC_DEBUG 00902 ut_ad(mutex_own(&(dict_sys->mutex))); 00903 #endif /* UNIV_SYNC_DEBUG */ 00904 00905 trx = thr_get_trx(thr); 00906 00907 node = thr->run_node; 00908 00909 ut_ad(que_node_get_type(node) == QUE_NODE_CREATE_TABLE); 00910 00911 if (thr->prev_node == que_node_get_parent(node)) { 00912 node->state = TABLE_BUILD_TABLE_DEF; 00913 } 00914 00915 if (node->state == TABLE_BUILD_TABLE_DEF) { 00916 00917 /* DO THE CHECKS OF THE CONSISTENCY CONSTRAINTS HERE */ 00918 00919 err = dict_build_table_def_step(thr, node); 00920 00921 if (err != DB_SUCCESS) { 00922 00923 goto function_exit; 00924 } 00925 00926 node->state = TABLE_BUILD_COL_DEF; 00927 node->col_no = 0; 00928 00929 thr->run_node = node->tab_def; 00930 00931 return(thr); 00932 } 00933 00934 if (node->state == TABLE_BUILD_COL_DEF) { 00935 00936 if (node->col_no < (node->table)->n_def) { 00937 00938 err = dict_build_col_def_step(node); 00939 00940 if (err != DB_SUCCESS) { 00941 00942 goto function_exit; 00943 } 00944 00945 node->col_no++; 00946 00947 thr->run_node = node->col_def; 00948 00949 return(thr); 00950 } else { 00951 node->state = TABLE_COMMIT_WORK; 00952 } 00953 } 00954 00955 if (node->state == TABLE_COMMIT_WORK) { 00956 00957 /* Table was correctly defined: do NOT commit the transaction 00958 (CREATE TABLE does NOT do an implicit commit of the current 00959 transaction) */ 00960 00961 node->state = TABLE_ADD_TO_CACHE; 00962 00963 /* thr->run_node = node->commit_node; 00964 00965 return(thr); */ 00966 } 00967 00968 if (node->state == TABLE_ADD_TO_CACHE) { 00969 00970 dict_table_add_to_cache(node->table); 00971 00972 err = DB_SUCCESS; 00973 } 00974 00975 function_exit: 00976 trx->error_state = err; 00977 00978 if (err == DB_SUCCESS) { 00979 /* Ok: do nothing */ 00980 00981 } else if (err == DB_LOCK_WAIT) { 00982 00983 return(NULL); 00984 } else { 00985 /* SQL error detected */ 00986 00987 return(NULL); 00988 } 00989 00990 thr->run_node = que_node_get_parent(node); 00991 00992 return(thr); 00993 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 631 of file dict0crea.c.
References btr_free_but_not_root(), btr_free_root(), dict_sys, DICT_SYS_INDEXES_PAGE_NO_FIELD, DICT_SYS_INDEXES_SPACE_NO_FIELD, dict_table_is_comp(), FIL_NULL, fil_tablespace_exists_in_mem(), MLOG_4BYTES, mtr_read_ulint(), dict_sys_struct::mutex, page_rec_write_index_page_no(), rec_get_nth_field_old(), dict_sys_struct::sys_indexes, ut_a, and ut_ad.
Referenced by row_undo_ins_remove_clust_rec(), and row_upd_clust_step().
00633 : record in the clustered index of SYS_INDEXES 00634 table */ 00635 mtr_t* mtr) /* in: mtr having the latch on the record page */ 00636 { 00637 ulint root_page_no; 00638 ulint space; 00639 byte* ptr; 00640 ulint len; 00641 00642 #ifdef UNIV_SYNC_DEBUG 00643 ut_ad(mutex_own(&(dict_sys->mutex))); 00644 #endif /* UNIV_SYNC_DEBUG */ 00645 00646 ut_a(!dict_table_is_comp(dict_sys->sys_indexes)); 00647 ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len); 00648 00649 ut_ad(len == 4); 00650 00651 root_page_no = mtr_read_ulint(ptr, MLOG_4BYTES, mtr); 00652 00653 if (root_page_no == FIL_NULL) { 00654 /* The tree has already been freed */ 00655 00656 return; 00657 } 00658 00659 ptr = rec_get_nth_field_old(rec, 00660 DICT_SYS_INDEXES_SPACE_NO_FIELD, &len); 00661 00662 ut_ad(len == 4); 00663 00664 space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr); 00665 00666 if (!fil_tablespace_exists_in_mem(space)) { 00667 /* It is a single table tablespace and the .ibd file is 00668 missing: do nothing */ 00669 00670 return; 00671 } 00672 00673 /* We free all the pages but the root page first; this operation 00674 may span several mini-transactions */ 00675 00676 btr_free_but_not_root(space, root_page_no); 00677 00678 /* Then we free the root page in the same mini-transaction where 00679 we write FIL_NULL to the appropriate field in the SYS_INDEXES 00680 record: this mini-transaction marks the B-tree totally freed */ 00681 00682 /* printf("Dropping index tree in space %lu root page %lu\n", space, 00683 root_page_no); */ 00684 btr_free_root(space, root_page_no, mtr); 00685 00686 page_rec_write_index_page_no(rec, 00687 DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr); 00688 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ulint dict_truncate_index_tree | ( | dict_table_t * | table, | |
| rec_t * | rec, | |||
| mtr_t * | mtr | |||
| ) |
Definition at line 694 of file dict0crea.c.
References btr_create(), btr_free_but_not_root(), btr_free_root(), btr_page_get(), dict_sys, DICT_SYS_INDEXES_PAGE_NO_FIELD, DICT_SYS_INDEXES_SPACE_NO_FIELD, DICT_SYS_INDEXES_TYPE_FIELD, dict_table_is_comp(), FIL_NULL, fil_tablespace_exists_in_mem(), index(), dict_table_struct::indexes, mach_read_from_4(), mach_read_from_8(), MLOG_4BYTES, mtr_commit(), mtr_read_ulint(), mtr_start(), dict_sys_struct::mutex, dict_table_struct::name, NULL, page_is_comp(), page_rec_write_index_page_no(), rec_get_nth_field_old(), RW_X_LATCH, dict_sys_struct::sys_indexes, ut_a, ut_ad, ut_dulint_cmp(), ut_dulint_get_high(), ut_dulint_get_low(), UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and ut_print_timestamp().
Referenced by row_truncate_table_for_mysql().
00696 : new root page number, or 00697 FIL_NULL on failure */ 00698 dict_table_t* table, /* in: the table the index belongs to */ 00699 rec_t* rec, /* in: record in the clustered index of 00700 SYS_INDEXES table */ 00701 mtr_t* mtr) /* in: mtr having the latch 00702 on the record page. The mtr may be 00703 committed and restarted in this call. */ 00704 { 00705 ulint root_page_no; 00706 ulint space; 00707 ulint type; 00708 dulint index_id; 00709 byte* ptr; 00710 ulint len; 00711 ulint comp; 00712 dict_index_t* index; 00713 00714 #ifdef UNIV_SYNC_DEBUG 00715 ut_ad(mutex_own(&(dict_sys->mutex))); 00716 #endif /* UNIV_SYNC_DEBUG */ 00717 00718 ut_a(!dict_table_is_comp(dict_sys->sys_indexes)); 00719 ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len); 00720 00721 ut_ad(len == 4); 00722 00723 root_page_no = mtr_read_ulint(ptr, MLOG_4BYTES, mtr); 00724 00725 if (root_page_no == FIL_NULL) { 00726 /* The tree has been freed. */ 00727 00728 ut_print_timestamp(stderr); 00729 fprintf(stderr, " InnoDB: Trying to TRUNCATE" 00730 " a missing index of table %s!\n", table->name); 00731 return(FIL_NULL); 00732 } 00733 00734 ptr = rec_get_nth_field_old(rec, 00735 DICT_SYS_INDEXES_SPACE_NO_FIELD, &len); 00736 00737 ut_ad(len == 4); 00738 00739 space = mtr_read_ulint(ptr, MLOG_4BYTES, mtr); 00740 00741 if (!fil_tablespace_exists_in_mem(space)) { 00742 /* It is a single table tablespace and the .ibd file is 00743 missing: do nothing */ 00744 00745 ut_print_timestamp(stderr); 00746 fprintf(stderr, " InnoDB: Trying to TRUNCATE" 00747 " a missing .ibd file of table %s!\n", table->name); 00748 return(FIL_NULL); 00749 } 00750 00751 ptr = rec_get_nth_field_old(rec, 00752 DICT_SYS_INDEXES_TYPE_FIELD, &len); 00753 ut_ad(len == 4); 00754 type = mach_read_from_4(ptr); 00755 00756 ptr = rec_get_nth_field_old(rec, 1, &len); 00757 ut_ad(len == 8); 00758 index_id = mach_read_from_8(ptr); 00759 00760 /* We free all the pages but the root page first; this operation 00761 may span several mini-transactions */ 00762 00763 btr_free_but_not_root(space, root_page_no); 00764 00765 /* Then we free the root page in the same mini-transaction where 00766 we create the b-tree and write its new root page number to the 00767 appropriate field in the SYS_INDEXES record: this mini-transaction 00768 marks the B-tree totally truncated */ 00769 00770 comp = page_is_comp(btr_page_get( 00771 space, root_page_no, RW_X_LATCH, mtr)); 00772 00773 btr_free_root(space, root_page_no, mtr); 00774 /* We will temporarily write FIL_NULL to the PAGE_NO field 00775 in SYS_INDEXES, so that the database will not get into an 00776 inconsistent state in case it crashes between the mtr_commit() 00777 below and the following mtr_commit() call. */ 00778 page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, 00779 FIL_NULL, mtr); 00780 00781 /* We will need to commit the mini-transaction in order to avoid 00782 deadlocks in the btr_create() call, because otherwise we would 00783 be freeing and allocating pages in the same mini-transaction. */ 00784 mtr_commit(mtr); 00785 /* mtr_commit() will invalidate rec. */ 00786 rec = NULL; 00787 mtr_start(mtr); 00788 00789 /* Find the index corresponding to this SYS_INDEXES record. */ 00790 for (index = UT_LIST_GET_FIRST(table->indexes); 00791 index; 00792 index = UT_LIST_GET_NEXT(indexes, index)) { 00793 if (!ut_dulint_cmp(index->id, index_id)) { 00794 break; 00795 } 00796 } 00797 00798 root_page_no = btr_create(type, space, index_id, comp, mtr); 00799 if (index) { 00800 index->tree->page = root_page_no; 00801 } else { 00802 ut_print_timestamp(stderr); 00803 fprintf(stderr, 00804 " InnoDB: Index %lu %lu of table %s is missing\n" 00805 "InnoDB: from the data dictionary during TRUNCATE!\n", 00806 ut_dulint_get_high(index_id), 00807 ut_dulint_get_low(index_id), 00808 table->name); 00809 } 00810 00811 return(root_page_no); 00812 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ind_node_t* ind_create_graph_create | ( | dict_index_t * | index, | |
| mem_heap_t * | heap | |||
| ) |
Definition at line 854 of file dict0crea.c.
References ind_node_struct::commit_node, commit_node_create(), commit_node_struct::common, ins_node_struct::common, ind_node_struct::common, dict_sys, ind_node_struct::field_def, FIL_NULL, ind_node_struct::heap, ind_node_struct::ind_def, index(), ind_node_struct::index, INDEX_BUILD_INDEX_DEF, INS_DIRECT, ins_node_create(), mem_heap_alloc(), mem_heap_create, ind_node_struct::page_no, que_common_struct::parent, QUE_NODE_CREATE_INDEX, ind_node_struct::state, dict_sys_struct::sys_fields, dict_sys_struct::sys_indexes, and que_common_struct::type.
Referenced by pars_create_index(), and row_create_index_for_mysql().
00856 : index create node */ 00857 dict_index_t* index, /* in: index to create, built as a memory data 00858 structure */ 00859 mem_heap_t* heap) /* in: heap where created */ 00860 { 00861 ind_node_t* node; 00862 00863 node = mem_heap_alloc(heap, sizeof(ind_node_t)); 00864 00865 node->common.type = QUE_NODE_CREATE_INDEX; 00866 00867 node->index = index; 00868 00869 node->state = INDEX_BUILD_INDEX_DEF; 00870 node->page_no = FIL_NULL; 00871 node->heap = mem_heap_create(256); 00872 00873 node->ind_def = ins_node_create(INS_DIRECT, 00874 dict_sys->sys_indexes, heap); 00875 node->ind_def->common.parent = node; 00876 00877 node->field_def = ins_node_create(INS_DIRECT, 00878 dict_sys->sys_fields, heap); 00879 node->field_def->common.parent = node; 00880 00881 node->commit_node = commit_node_create(heap); 00882 node->commit_node->common.parent = node; 00883 00884 return(node); 00885 }
Here is the call graph for this function:

Here is the caller graph for this function:

| tab_node_t* tab_create_graph_create | ( | dict_table_t * | table, | |
| mem_heap_t * | heap | |||
| ) |
Definition at line 818 of file dict0crea.c.
References tab_node_struct::col_def, tab_node_struct::commit_node, commit_node_create(), commit_node_struct::common, ins_node_struct::common, tab_node_struct::common, dict_sys, tab_node_struct::heap, INS_DIRECT, ins_node_create(), mem_heap_alloc(), mem_heap_create, que_common_struct::parent, QUE_NODE_CREATE_TABLE, tab_node_struct::state, dict_sys_struct::sys_columns, dict_sys_struct::sys_tables, tab_node_struct::tab_def, tab_node_struct::table, TABLE_BUILD_TABLE_DEF, and que_common_struct::type.
Referenced by pars_create_table(), and row_create_table_for_mysql().
00820 : table create node */ 00821 dict_table_t* table, /* in: table to create, built as a memory data 00822 structure */ 00823 mem_heap_t* heap) /* in: heap where created */ 00824 { 00825 tab_node_t* node; 00826 00827 node = mem_heap_alloc(heap, sizeof(tab_node_t)); 00828 00829 node->common.type = QUE_NODE_CREATE_TABLE; 00830 00831 node->table = table; 00832 00833 node->state = TABLE_BUILD_TABLE_DEF; 00834 node->heap = mem_heap_create(256); 00835 00836 node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables, 00837 heap); 00838 node->tab_def->common.parent = node; 00839 00840 node->col_def = ins_node_create(INS_DIRECT, dict_sys->sys_columns, 00841 heap); 00842 node->col_def->common.parent = node; 00843 00844 node->commit_node = commit_node_create(heap); 00845 node->commit_node->common.parent = node; 00846 00847 return(node); 00848 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

