diff options
author | unknown <marko@hundin.mysql.fi> | 2005-01-14 13:54:23 +0200 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2005-01-14 13:54:23 +0200 |
commit | 4db9aaeea7e8ffce21740913071d58793340af3d (patch) | |
tree | d120530f84497dffd33fe530b9a42f36fe657b37 /innobase/dict | |
parent | c277421d06a7442aa7e25bf85b5b918fec1c45c0 (diff) | |
download | mariadb-git-4db9aaeea7e8ffce21740913071d58793340af3d.tar.gz |
InnoDB: Remove redundant page_no field from dict_index_t.
This completes the patch for fast TRUNCATE TABLE.
innobase/dict/dict0boot.c:
dict_boot(): Add page_no parameter to dict_index_add_to_cache()
innobase/dict/dict0crea.c:
Remove dict_index_t:page_no; add ind_node_t:page_no
innobase/dict/dict0dict.c:
dict_index_add_to_cache(): Add parameter page_no
dict_tree_create(): Add parameter page_no
innobase/dict/dict0load.c:
dict_load_indexes(): Add page_no to dict_index_add_to_cache() call
innobase/ibuf/ibuf0ibuf.c:
ibuf_data_init_for_space(): Move page_no to dict_index_add_to_cache()
innobase/include/dict0crea.h:
ind_node_t: Add page_no field
innobase/include/dict0dict.h:
dict_index_add_to_cache(): Add page_no
dict_tree_create(): Add page_no
innobase/include/dict0mem.h:
dict_index_t: Remove page_no, as dict_tree_t has "page" field
innobase/row/row0mysql.c:
row_truncate_table_for_mysql(): Improve the comments
Diffstat (limited to 'innobase/dict')
-rw-r--r-- | innobase/dict/dict0boot.c | 31 | ||||
-rw-r--r-- | innobase/dict/dict0crea.c | 16 | ||||
-rw-r--r-- | innobase/dict/dict0dict.c | 13 | ||||
-rw-r--r-- | innobase/dict/dict0load.c | 4 |
4 files changed, 31 insertions, 33 deletions
diff --git a/innobase/dict/dict0boot.c b/innobase/dict/dict0boot.c index 883c5464319..0f6d55c9341 100644 --- a/innobase/dict/dict0boot.c +++ b/innobase/dict/dict0boot.c @@ -223,6 +223,7 @@ dict_boot(void) dict_index_t* index; dict_hdr_t* dict_hdr; mtr_t mtr; + ibool success; mtr_start(&mtr); @@ -275,20 +276,20 @@ dict_boot(void) dict_mem_index_add_field(index, "NAME", 0, 0); - index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_TABLES, - MLOG_4BYTES, &mtr); index->id = DICT_TABLES_ID; - ut_a(dict_index_add_to_cache(table, index)); + success = dict_index_add_to_cache(table, index, mtr_read_ulint( + dict_hdr + DICT_HDR_TABLES, MLOG_4BYTES, &mtr)); + ut_a(success); /*-------------------------*/ index = dict_mem_index_create("SYS_TABLES", "ID_IND", DICT_HDR_SPACE, DICT_UNIQUE, 1); dict_mem_index_add_field(index, "ID", 0, 0); - index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_TABLE_IDS, - MLOG_4BYTES, &mtr); index->id = DICT_TABLE_IDS_ID; - ut_a(dict_index_add_to_cache(table, index)); + success = dict_index_add_to_cache(table, index, mtr_read_ulint( + dict_hdr + DICT_HDR_TABLE_IDS, MLOG_4BYTES, &mtr)); + ut_a(success); /*-------------------------*/ table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, FALSE); @@ -311,10 +312,10 @@ dict_boot(void) dict_mem_index_add_field(index, "TABLE_ID", 0, 0); dict_mem_index_add_field(index, "POS", 0, 0); - index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_COLUMNS, - MLOG_4BYTES, &mtr); index->id = DICT_COLUMNS_ID; - ut_a(dict_index_add_to_cache(table, index)); + success = dict_index_add_to_cache(table, index, mtr_read_ulint( + dict_hdr + DICT_HDR_COLUMNS, MLOG_4BYTES, &mtr)); + ut_a(success); /*-------------------------*/ table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, FALSE); @@ -347,10 +348,10 @@ dict_boot(void) dict_mem_index_add_field(index, "TABLE_ID", 0, 0); dict_mem_index_add_field(index, "ID", 0, 0); - index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_INDEXES, - MLOG_4BYTES, &mtr); index->id = DICT_INDEXES_ID; - ut_a(dict_index_add_to_cache(table, index)); + success = dict_index_add_to_cache(table, index, mtr_read_ulint( + dict_hdr + DICT_HDR_INDEXES, MLOG_4BYTES, &mtr)); + ut_a(success); /*-------------------------*/ table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, FALSE); @@ -368,10 +369,10 @@ dict_boot(void) dict_mem_index_add_field(index, "INDEX_ID", 0, 0); dict_mem_index_add_field(index, "POS", 0, 0); - index->page_no = mtr_read_ulint(dict_hdr + DICT_HDR_FIELDS, - MLOG_4BYTES, &mtr); index->id = DICT_FIELDS_ID; - ut_a(dict_index_add_to_cache(table, index)); + success = dict_index_add_to_cache(table, index, mtr_read_ulint( + dict_hdr + DICT_HDR_FIELDS, MLOG_4BYTES, &mtr)); + ut_a(success); mtr_commit(&mtr); /*-------------------------*/ diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c index e744ffda7a6..3c496bae5b4 100644 --- a/innobase/dict/dict0crea.c +++ b/innobase/dict/dict0crea.c @@ -544,9 +544,7 @@ dict_build_index_def_step( table in the same tablespace */ index->space = table->space; - - index->page_no = FIL_NULL; - + node->page_no = FIL_NULL; row = dict_create_sys_indexes_tuple(index, node->heap); node->ind_row = row; @@ -624,18 +622,18 @@ dict_create_index_tree_step( btr_pcur_move_to_next_user_rec(&pcur, &mtr); - index->page_no = btr_create(index->type, index->space, index->id, + node->page_no = btr_create(index->type, index->space, index->id, table->comp, &mtr); /* printf("Created a new index tree in space %lu root page %lu\n", index->space, index->page_no); */ page_rec_write_index_page_no(btr_pcur_get_rec(&pcur), DICT_SYS_INDEXES_PAGE_NO_FIELD, - index->page_no, &mtr); + node->page_no, &mtr); btr_pcur_close(&pcur); mtr_commit(&mtr); - if (index->page_no == FIL_NULL) { + if (node->page_no == FIL_NULL) { return(DB_OUT_OF_FILE_SPACE); } @@ -793,7 +791,7 @@ dict_truncate_index_tree( root_page_no = btr_create(type, space, index_id, comp, mtr); if (index) { - index->page_no = root_page_no; + index->tree->page = root_page_no; } page_rec_write_index_page_no(rec, @@ -857,6 +855,7 @@ ind_create_graph_create( node->index = index; node->state = INDEX_BUILD_INDEX_DEF; + node->page_no = FIL_NULL; node->heap = mem_heap_create(256); node->ind_def = ins_node_create(INS_DIRECT, @@ -1076,7 +1075,8 @@ dict_create_index_step( if (node->state == INDEX_ADD_TO_CACHE) { - success = dict_index_add_to_cache(node->table, node->index); + success = dict_index_add_to_cache(node->table, node->index, + node->page_no); ut_a(success); diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index d5e0a46fd39..12749f7704f 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -1374,8 +1374,9 @@ dict_index_add_to_cache( /*====================*/ /* out: TRUE if success */ dict_table_t* table, /* in: table on which the index is */ - dict_index_t* index) /* in, own: index; NOTE! The index memory + dict_index_t* index, /* in, own: index; NOTE! The index memory object is freed in this function! */ + ulint page_no)/* in: root page number of the index */ { dict_index_t* new_index; dict_tree_t* tree; @@ -1461,10 +1462,9 @@ dict_index_add_to_cache( tree = dict_index_get_tree( UT_LIST_GET_FIRST(cluster->indexes)); new_index->tree = tree; - new_index->page_no = tree->page; } else { /* Create an index tree memory object for the index */ - tree = dict_tree_create(new_index); + tree = dict_tree_create(new_index, page_no); ut_ad(tree); new_index->tree = tree; @@ -1749,7 +1749,6 @@ dict_index_build_internal_clust( new_index->n_user_defined_cols = index->n_fields; new_index->id = index->id; - new_index->page_no = index->page_no; if (table->type != DICT_TABLE_ORDINARY) { /* The index is mixed: copy common key prefix fields */ @@ -1928,7 +1927,6 @@ dict_index_build_internal_non_clust( new_index->n_user_defined_cols = index->n_fields; new_index->id = index->id; - new_index->page_no = index->page_no; /* Copy fields from index to new_index */ dict_index_copy(new_index, index, 0, index->n_fields); @@ -3565,9 +3563,10 @@ dict_tree_t* dict_tree_create( /*=============*/ /* out, own: created tree */ - dict_index_t* index) /* in: the index for which to create: in the + dict_index_t* index, /* in: the index for which to create: in the case of a mixed tree, this should be the index of the cluster object */ + ulint page_no)/* in: root page number of the index */ { dict_tree_t* tree; @@ -3577,7 +3576,7 @@ dict_tree_create( tree->type = index->type; tree->space = index->space; - tree->page = index->page_no; + tree->page = page_no; tree->id = index->id; diff --git a/innobase/dict/dict0load.c b/innobase/dict/dict0load.c index f835d1b949a..18910acb01d 100644 --- a/innobase/dict/dict0load.c +++ b/innobase/dict/dict0load.c @@ -681,12 +681,10 @@ dict_load_indexes( } else { index = dict_mem_index_create(table->name, name_buf, space, type, n_fields); - index->page_no = page_no; index->id = id; dict_load_fields(table, index, heap); - - dict_index_add_to_cache(table, index); + dict_index_add_to_cache(table, index, page_no); } btr_pcur_move_to_next_user_rec(&pcur, &mtr); |