Commit 73861167 authored by marko's avatar marko

Remove code related to clustered tables. They were never implemented, and

the implementation would be challenging with ROW_FORMAT=COMPACT.

Remove the table types DICT_TABLE_CLUSTER_MEMBER and DICT_TABLE_CLUSTER and
all related tests and functions.

dict_table_t: Remove mix_id, mix_len, mix_id_len, mix_id_buf, and
cluster_name.

plan_t: Remove mixed_index.

dict_create_sys_tables_tuple(): Set MIX_ID=0, MIX_LEN=0 and CLUSTER_NAME=NULL
when inserting into SYS_TABLES.

dict_tree_check_search_tuple(): Enclose in #ifdef UNIV_DEBUG.
parent e19af6d5
...@@ -144,7 +144,7 @@ btr_root_get( ...@@ -144,7 +144,7 @@ btr_root_get(
root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr); root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr);
ut_a((ibool)!!page_is_comp(root) == ut_a((ibool)!!page_is_comp(root) ==
dict_table_is_comp(UT_LIST_GET_FIRST(tree->tree_indexes)->table)); dict_table_is_comp(tree->tree_index->table));
return(root); return(root);
} }
...@@ -259,7 +259,7 @@ btr_page_create( ...@@ -259,7 +259,7 @@ btr_page_create(
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
page_create(page, mtr, page_create(page, mtr,
dict_table_is_comp(UT_LIST_GET_FIRST(tree->tree_indexes)->table)); dict_table_is_comp(tree->tree_index->table));
buf_block_align(page)->check_index_page_at_flush = TRUE; buf_block_align(page)->check_index_page_at_flush = TRUE;
btr_page_set_index_id(page, tree->id, mtr); btr_page_set_index_id(page, tree->id, mtr);
...@@ -574,7 +574,7 @@ btr_page_get_father_for_rec( ...@@ -574,7 +574,7 @@ btr_page_get_father_for_rec(
tuple = dict_tree_build_node_ptr(tree, user_rec, 0, heap, tuple = dict_tree_build_node_ptr(tree, user_rec, 0, heap,
btr_page_get_level(page, mtr)); btr_page_get_level(page, mtr));
index = UT_LIST_GET_FIRST(tree->tree_indexes); index = tree->tree_index;
/* In the following, we choose just any index from the tree as the /* In the following, we choose just any index from the tree as the
first parameter for btr_cur_search_to_nth_level. */ first parameter for btr_cur_search_to_nth_level. */
...@@ -1073,8 +1073,7 @@ btr_root_raise_and_insert( ...@@ -1073,8 +1073,7 @@ btr_root_raise_and_insert(
/* fprintf(stderr, "Root raise new page no %lu\n", /* fprintf(stderr, "Root raise new page no %lu\n",
buf_frame_get_page_no(new_page)); */ buf_frame_get_page_no(new_page)); */
ibuf_reset_free_bits(UT_LIST_GET_FIRST(tree->tree_indexes), ibuf_reset_free_bits(tree->tree_index, new_page);
new_page);
/* Reposition the cursor to the child node */ /* Reposition the cursor to the child node */
page_cur_search(new_page, cursor->index, tuple, page_cur_search(new_page, cursor->index, tuple,
PAGE_CUR_LE, page_cursor); PAGE_CUR_LE, page_cursor);
...@@ -1415,7 +1414,7 @@ btr_insert_on_non_leaf_level( ...@@ -1415,7 +1414,7 @@ btr_insert_on_non_leaf_level(
/* In the following, choose just any index from the tree as the /* In the following, choose just any index from the tree as the
first parameter for btr_cur_search_to_nth_level. */ first parameter for btr_cur_search_to_nth_level. */
btr_cur_search_to_nth_level(UT_LIST_GET_FIRST(tree->tree_indexes), btr_cur_search_to_nth_level(tree->tree_index,
level, tuple, PAGE_CUR_LE, BTR_CONT_MODIFY_TREE, level, tuple, PAGE_CUR_LE, BTR_CONT_MODIFY_TREE,
&cursor, 0, mtr); &cursor, 0, mtr);
...@@ -1479,7 +1478,7 @@ btr_attach_half_pages( ...@@ -1479,7 +1478,7 @@ btr_attach_half_pages(
btr_node_ptr_set_child_page_no(node_ptr, btr_node_ptr_set_child_page_no(node_ptr,
rec_get_offsets(node_ptr, rec_get_offsets(node_ptr,
UT_LIST_GET_FIRST(tree->tree_indexes), tree->tree_index,
NULL, ULINT_UNDEFINED, &heap), NULL, ULINT_UNDEFINED, &heap),
lower_page_no, mtr); lower_page_no, mtr);
mem_heap_empty(heap); mem_heap_empty(heap);
...@@ -1768,8 +1767,8 @@ btr_page_split_and_insert( ...@@ -1768,8 +1767,8 @@ btr_page_split_and_insert(
buf_frame_get_page_no(left_page), buf_frame_get_page_no(left_page),
buf_frame_get_page_no(right_page)); */ buf_frame_get_page_no(right_page)); */
ut_ad(page_validate(left_page, UT_LIST_GET_FIRST(tree->tree_indexes))); ut_ad(page_validate(left_page, tree->tree_index));
ut_ad(page_validate(right_page, UT_LIST_GET_FIRST(tree->tree_indexes))); ut_ad(page_validate(right_page, tree->tree_index));
mem_heap_free(heap); mem_heap_free(heap);
return(rec); return(rec);
...@@ -1910,8 +1909,7 @@ btr_node_ptr_delete( ...@@ -1910,8 +1909,7 @@ btr_node_ptr_delete(
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr); node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
btr_cur_position(UT_LIST_GET_FIRST(tree->tree_indexes), node_ptr, btr_cur_position(tree->tree_index, node_ptr, &cursor);
&cursor);
compressed = btr_cur_pessimistic_delete(&err, TRUE, &cursor, FALSE, compressed = btr_cur_pessimistic_delete(&err, TRUE, &cursor, FALSE,
mtr); mtr);
ut_a(err == DB_SUCCESS); ut_a(err == DB_SUCCESS);
...@@ -1947,7 +1945,7 @@ btr_lift_page_up( ...@@ -1947,7 +1945,7 @@ btr_lift_page_up(
btr_page_get_father_node_ptr(tree, page, mtr)); btr_page_get_father_node_ptr(tree, page, mtr));
page_level = btr_page_get_level(page, mtr); page_level = btr_page_get_level(page, mtr);
index = UT_LIST_GET_FIRST(tree->tree_indexes); index = tree->tree_index;
btr_search_drop_page_hash_index(page); btr_search_drop_page_hash_index(page);
...@@ -2180,8 +2178,7 @@ btr_discard_only_page_on_level( ...@@ -2180,8 +2178,7 @@ btr_discard_only_page_on_level(
btr_page_empty(father_page, mtr); btr_page_empty(father_page, mtr);
/* We play safe and reset the free bits for the father */ /* We play safe and reset the free bits for the father */
ibuf_reset_free_bits(UT_LIST_GET_FIRST(tree->tree_indexes), ibuf_reset_free_bits(tree->tree_index, father_page);
father_page);
} else { } else {
ut_ad(page_get_n_recs(father_page) == 1); ut_ad(page_get_n_recs(father_page) == 1);
...@@ -2449,7 +2446,7 @@ btr_check_node_ptr( ...@@ -2449,7 +2446,7 @@ btr_check_node_ptr(
ut_a(cmp_dtuple_rec(node_ptr_tuple, node_ptr, ut_a(cmp_dtuple_rec(node_ptr_tuple, node_ptr,
rec_get_offsets(node_ptr, rec_get_offsets(node_ptr,
dict_tree_find_index(tree, node_ptr), tree->tree_index,
NULL, ULINT_UNDEFINED, &heap)) == 0); NULL, ULINT_UNDEFINED, &heap)) == 0);
mem_heap_free(heap); mem_heap_free(heap);
...@@ -2692,7 +2689,7 @@ btr_validate_level( ...@@ -2692,7 +2689,7 @@ btr_validate_level(
space = buf_frame_get_space_id(page); space = buf_frame_get_space_id(page);
index = UT_LIST_GET_FIRST(tree->tree_indexes); index = tree->tree_index;
while (level != btr_page_get_level(page, &mtr)) { while (level != btr_page_get_level(page, &mtr)) {
......
...@@ -259,10 +259,7 @@ btr_pcur_restore_position( ...@@ -259,10 +259,7 @@ btr_pcur_restore_position(
cursor->latch_mode = latch_mode; cursor->latch_mode = latch_mode;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
rec = btr_pcur_get_rec(cursor); rec = btr_pcur_get_rec(cursor);
index = dict_tree_find_index( index = btr_pcur_get_btr_cur(cursor)->index;
btr_cur_get_tree(
btr_pcur_get_btr_cur(cursor)),
rec);
heap = mem_heap_create(256); heap = mem_heap_create(256);
offsets1 = rec_get_offsets(cursor->old_rec, offsets1 = rec_get_offsets(cursor->old_rec,
......
...@@ -82,7 +82,7 @@ dict_create_sys_tables_tuple( ...@@ -82,7 +82,7 @@ dict_create_sys_tables_tuple(
dfield = dtuple_get_nth_field(entry, 4); dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 8); ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, table->mix_id); memset(ptr, 0, 8);
dfield_set_data(dfield, ptr, 8); dfield_set_data(dfield, ptr, 8);
/* 7: MIX_LEN --------------------------*/ /* 7: MIX_LEN --------------------------*/
...@@ -90,19 +90,13 @@ dict_create_sys_tables_tuple( ...@@ -90,19 +90,13 @@ dict_create_sys_tables_tuple(
dfield = dtuple_get_nth_field(entry, 5); dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4); ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, table->mix_len); memset(ptr, 0, 4);
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/* 8: CLUSTER_NAME ---------------------*/ /* 8: CLUSTER_NAME ---------------------*/
dfield = dtuple_get_nth_field(entry, 6); dfield = dtuple_get_nth_field(entry, 6);
dfield_set_data(dfield, NULL, UNIV_SQL_NULL); /* not supported */
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
dfield_set_data(dfield, table->cluster_name,
ut_strlen(table->cluster_name));
ut_error; /* Oracle-style clusters are not supported yet */
} else {
dfield_set_data(dfield, NULL, UNIV_SQL_NULL);
}
/* 9: SPACE ----------------------------*/ /* 9: SPACE ----------------------------*/
dfield = dtuple_get_nth_field(entry, 7); dfield = dtuple_get_nth_field(entry, 7);
...@@ -208,7 +202,6 @@ dict_build_table_def_step( ...@@ -208,7 +202,6 @@ dict_build_table_def_step(
tab_node_t* node) /* in: table create node */ tab_node_t* node) /* in: table create node */
{ {
dict_table_t* table; dict_table_t* table;
dict_table_t* cluster_table;
dtuple_t* row; dtuple_t* row;
ulint error; ulint error;
const char* path_or_name; const char* path_or_name;
...@@ -236,23 +229,6 @@ dict_build_table_def_step( ...@@ -236,23 +229,6 @@ dict_build_table_def_step(
return(DB_TOO_BIG_RECORD); return(DB_TOO_BIG_RECORD);
} }
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
cluster_table = dict_table_get_low(table->cluster_name);
if (cluster_table == NULL) {
return(DB_CLUSTER_NOT_FOUND);
}
/* Inherit space and mix len from the cluster */
table->space = cluster_table->space;
table->mix_len = cluster_table->mix_len;
table->mix_id = dict_hdr_get_new_id(DICT_HDR_MIX_ID);
}
if (srv_file_per_table) { if (srv_file_per_table) {
/* We create a new single-table tablespace for the table. /* We create a new single-table tablespace for the table.
We initially let it be 4 pages: We initially let it be 4 pages:
...@@ -615,15 +591,6 @@ dict_create_index_tree_step( ...@@ -615,15 +591,6 @@ dict_create_index_tree_step(
sys_indexes = dict_sys->sys_indexes; sys_indexes = dict_sys->sys_indexes;
if (index->type & DICT_CLUSTERED
&& table->type == DICT_TABLE_CLUSTER_MEMBER) {
/* Do not create a new index tree: entries are put to the
cluster tree */
return(DB_SUCCESS);
}
/* Run a mini-transaction in which the index tree is allocated for /* Run a mini-transaction in which the index tree is allocated for
the index and its root address is written to the index entry in the index and its root address is written to the index entry in
sys_indexes */ sys_indexes */
......
...@@ -883,13 +883,6 @@ dict_table_add_to_cache( ...@@ -883,13 +883,6 @@ dict_table_add_to_cache(
ut_a(table2 == NULL); ut_a(table2 == NULL);
} }
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
table->mix_id_len = mach_dulint_get_compressed_size(
table->mix_id);
mach_dulint_write_compressed(table->mix_id_buf, table->mix_id);
}
/* Add the columns to the column hash table */ /* Add the columns to the column hash table */
for (i = 0; i < table->n_cols; i++) { for (i = 0; i < table->n_cols; i++) {
dict_col_add_to_cache(table, dict_table_get_nth_col(table, i)); dict_col_add_to_cache(table, dict_table_get_nth_col(table, i));
...@@ -1407,7 +1400,6 @@ dict_index_add_to_cache( ...@@ -1407,7 +1400,6 @@ dict_index_add_to_cache(
{ {
dict_index_t* new_index; dict_index_t* new_index;
dict_tree_t* tree; dict_tree_t* tree;
dict_table_t* cluster;
dict_field_t* field; dict_field_t* field;
ulint n_ord; ulint n_ord;
ibool success; ibool success;
...@@ -1481,21 +1473,11 @@ dict_index_add_to_cache( ...@@ -1481,21 +1473,11 @@ dict_index_add_to_cache(
dict_field_get_col(field)->ord_part++; dict_field_get_col(field)->ord_part++;
} }
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
/* The index tree is found from the cluster object */
cluster = dict_table_get_low(table->cluster_name);
tree = dict_index_get_tree(
UT_LIST_GET_FIRST(cluster->indexes));
new_index->tree = tree;
} else {
/* Create an index tree memory object for the index */ /* Create an index tree memory object for the index */
tree = dict_tree_create(new_index, page_no); tree = dict_tree_create(new_index, page_no);
ut_ad(tree); ut_ad(tree);
new_index->tree = tree; new_index->tree = tree;
}
if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) { if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) {
...@@ -1513,7 +1495,7 @@ dict_index_add_to_cache( ...@@ -1513,7 +1495,7 @@ dict_index_add_to_cache(
} }
/* Add the index to the list of indexes stored in the tree */ /* Add the index to the list of indexes stored in the tree */
UT_LIST_ADD_LAST(tree_indexes, tree->tree_indexes, new_index); tree->tree_index = new_index;
/* If the dictionary cache grows too big, trim the table LRU list */ /* If the dictionary cache grows too big, trim the table LRU list */
...@@ -1545,7 +1527,7 @@ dict_index_remove_from_cache( ...@@ -1545,7 +1527,7 @@ dict_index_remove_from_cache(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ut_ad(UT_LIST_GET_LEN((index->tree)->tree_indexes) == 1); ut_ad(index->tree->tree_index);
dict_tree_free(index->tree); dict_tree_free(index->tree);
/* Decrement the ord_part counts in columns which are ordering */ /* Decrement the ord_part counts in columns which are ordering */
...@@ -1762,22 +1744,10 @@ dict_index_build_internal_clust( ...@@ -1762,22 +1744,10 @@ dict_index_build_internal_clust(
new_index->id = index->id; new_index->id = index->id;
if (table->type != DICT_TABLE_ORDINARY) { ut_a(table->type == DICT_TABLE_ORDINARY);
/* The index is mixed: copy common key prefix fields */
dict_index_copy(new_index, index, 0, table->mix_len);
/* Add the mix id column */
dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_MIX_ID), 0);
/* Copy the rest of fields */
dict_index_copy(new_index, index, table->mix_len,
index->n_fields);
} else {
/* Copy the fields of index */ /* Copy the fields of index */
dict_index_copy(new_index, index, 0, index->n_fields); dict_index_copy(new_index, index, 0, index->n_fields);
}
if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) { if (UNIV_UNLIKELY(index->type & DICT_UNIVERSAL)) {
/* No fixed number of fields determines an entry uniquely */ /* No fixed number of fields determines an entry uniquely */
...@@ -3654,7 +3624,7 @@ dict_tree_create( ...@@ -3654,7 +3624,7 @@ dict_tree_create(
tree->id = index->id; tree->id = index->id;
UT_LIST_INIT(tree->tree_indexes); tree->tree_index = NULL;
tree->magic_n = DICT_TREE_MAGIC_N; tree->magic_n = DICT_TREE_MAGIC_N;
...@@ -3680,135 +3650,7 @@ dict_tree_free( ...@@ -3680,135 +3650,7 @@ dict_tree_free(
mem_free(tree); mem_free(tree);
} }
/************************************************************************** #ifdef UNIV_DEBUG
In an index tree, finds the index corresponding to a record in the tree. */
UNIV_INLINE
dict_index_t*
dict_tree_find_index_low(
/*=====================*/
/* out: index */
dict_tree_t* tree, /* in: index tree */
rec_t* rec) /* in: record for which to find correct
index */
{
dict_index_t* index;
dict_table_t* table;
dulint mix_id;
ulint len;
index = UT_LIST_GET_FIRST(tree->tree_indexes);
ut_ad(index);
table = index->table;
if ((index->type & DICT_CLUSTERED)
&& UNIV_UNLIKELY(table->type != DICT_TABLE_ORDINARY)) {
/* Get the mix id of the record */
ut_a(!dict_table_is_comp(table));
mix_id = mach_dulint_read_compressed(
rec_get_nth_field_old(rec, table->mix_len, &len));
while (ut_dulint_cmp(table->mix_id, mix_id) != 0) {
index = UT_LIST_GET_NEXT(tree_indexes, index);
table = index->table;
ut_ad(index);
}
}
return(index);
}
/**************************************************************************
In an index tree, finds the index corresponding to a record in the tree. */
dict_index_t*
dict_tree_find_index(
/*=================*/
/* out: index */
dict_tree_t* tree, /* in: index tree */
rec_t* rec) /* in: record for which to find correct
index */
{
dict_index_t* index;
index = dict_tree_find_index_low(tree, rec);
return(index);
}
/**************************************************************************
In an index tree, finds the index corresponding to a dtuple which is used
in a search to a tree. */
dict_index_t*
dict_tree_find_index_for_tuple(
/*===========================*/
/* out: index; NULL if the tuple does not
contain the mix id field in a mixed tree */
dict_tree_t* tree, /* in: index tree */
dtuple_t* tuple) /* in: tuple for which to find index */
{
dict_index_t* index;
dict_table_t* table;
dulint mix_id;
ut_ad(dtuple_check_typed(tuple));
if (UT_LIST_GET_LEN(tree->tree_indexes) == 1) {
return(UT_LIST_GET_FIRST(tree->tree_indexes));
}
index = UT_LIST_GET_FIRST(tree->tree_indexes);
ut_ad(index);
table = index->table;
if (dtuple_get_n_fields(tuple) <= table->mix_len) {
return(NULL);
}
/* Get the mix id of the record */
mix_id = mach_dulint_read_compressed(
dfield_get_data(
dtuple_get_nth_field(tuple, table->mix_len)));
while (ut_dulint_cmp(table->mix_id, mix_id) != 0) {
index = UT_LIST_GET_NEXT(tree_indexes, index);
table = index->table;
ut_ad(index);
}
return(index);
}
/***********************************************************************
Checks if a table which is a mixed cluster member owns a record. */
ibool
dict_is_mixed_table_rec(
/*====================*/
/* out: TRUE if the record belongs to this
table */
dict_table_t* table, /* in: table in a mixed cluster */
rec_t* rec) /* in: user record in the clustered index */
{
byte* mix_id_field;
ulint len;
ut_ad(!dict_table_is_comp(table));
mix_id_field = rec_get_nth_field_old(rec,
table->mix_len, &len);
return(len == table->mix_id_len
&& !ut_memcmp(table->mix_id_buf, mix_id_field, len));
}
/************************************************************************** /**************************************************************************
Checks that a tuple has n_fields_cmp value in a sensible range, so that Checks that a tuple has n_fields_cmp value in a sensible range, so that
no comparison can occur with the page number field in a node pointer. */ no comparison can occur with the page number field in a node pointer. */
...@@ -3820,19 +3662,14 @@ dict_tree_check_search_tuple( ...@@ -3820,19 +3662,14 @@ dict_tree_check_search_tuple(
dict_tree_t* tree, /* in: index tree */ dict_tree_t* tree, /* in: index tree */
dtuple_t* tuple) /* in: tuple used in a search */ dtuple_t* tuple) /* in: tuple used in a search */
{ {
dict_index_t* index; dict_index_t* index = tree->tree_index;
index = dict_tree_find_index_for_tuple(tree, tuple);
if (index == NULL) {
return(TRUE);
}
ut_a(index);
ut_a(dtuple_get_n_fields_cmp(tuple) ut_a(dtuple_get_n_fields_cmp(tuple)
<= dict_index_get_n_unique_in_tree(index)); <= dict_index_get_n_unique_in_tree(index));
return(TRUE); return(TRUE);
} }
#endif /* UNIV_DEBUG */
/************************************************************************** /**************************************************************************
Builds a node pointer out of a physical record and a page number. */ Builds a node pointer out of a physical record and a page number. */
...@@ -3855,7 +3692,7 @@ dict_tree_build_node_ptr( ...@@ -3855,7 +3692,7 @@ dict_tree_build_node_ptr(
byte* buf; byte* buf;
ulint n_unique; ulint n_unique;
ind = dict_tree_find_index_low(tree, rec); ind = tree->tree_index;
if (UNIV_UNLIKELY(tree->type & DICT_UNIVERSAL)) { if (UNIV_UNLIKELY(tree->type & DICT_UNIVERSAL)) {
/* In a universal index tree, we take the whole record as /* In a universal index tree, we take the whole record as
...@@ -3923,7 +3760,7 @@ dict_tree_copy_rec_order_prefix( ...@@ -3923,7 +3760,7 @@ dict_tree_copy_rec_order_prefix(
ulint n; ulint n;
UNIV_PREFETCH_R(rec); UNIV_PREFETCH_R(rec);
index = dict_tree_find_index_low(tree, rec); index = tree->tree_index;
if (UNIV_UNLIKELY(tree->type & DICT_UNIVERSAL)) { if (UNIV_UNLIKELY(tree->type & DICT_UNIVERSAL)) {
ut_a(!dict_table_is_comp(index->table)); ut_a(!dict_table_is_comp(index->table));
...@@ -3951,7 +3788,7 @@ dict_tree_build_data_tuple( ...@@ -3951,7 +3788,7 @@ dict_tree_build_data_tuple(
dtuple_t* tuple; dtuple_t* tuple;
dict_index_t* ind; dict_index_t* ind;
ind = dict_tree_find_index_low(tree, rec); ind = tree->tree_index;
ut_ad(dict_table_is_comp(ind->table) ut_ad(dict_table_is_comp(ind->table)
|| n_fields <= rec_get_n_fields_old(rec)); || n_fields <= rec_get_n_fields_old(rec));
......
...@@ -849,35 +849,11 @@ dict_load_table( ...@@ -849,35 +849,11 @@ dict_load_table(
field = rec_get_nth_field_old(rec, 5, &len); field = rec_get_nth_field_old(rec, 5, &len);
table->type = mach_read_from_4(field); table->type = mach_read_from_4(field);
ut_a(table->type == DICT_TABLE_ORDINARY);
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
ut_error;
#if 0 /* clustered tables have not been implemented yet */
field = rec_get_nth_field_old(rec, 6, &len);
table->mix_id = mach_read_from_8(field);
field = rec_get_nth_field_old(rec, 8, &len);
table->cluster_name = mem_heap_strdupl(heap, (char*) field, len);
#endif
}
if ((table->type == DICT_TABLE_CLUSTER)
|| (table->type == DICT_TABLE_CLUSTER_MEMBER)) {
field = rec_get_nth_field_old(rec, 7, &len);
ut_a(len == 4);
table->mix_len = mach_read_from_4(field);
}
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
/* Load the cluster table definition if not yet in
memory cache */
dict_table_get_low(table->cluster_name);
}
dict_load_columns(table, heap); dict_load_columns(table, heap);
dict_table_add_to_cache(table); dict_table_add_to_cache(table);
......
...@@ -66,9 +66,6 @@ dict_mem_table_create( ...@@ -66,9 +66,6 @@ dict_mem_table_create(
table->cached = FALSE; table->cached = FALSE;
table->mix_id = ut_dulint_zero;
table->mix_len = 0;
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS) table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
* sizeof(dict_col_t)); * sizeof(dict_col_t));
UT_LIST_INIT(table->indexes); UT_LIST_INIT(table->indexes);
...@@ -97,44 +94,6 @@ dict_mem_table_create( ...@@ -97,44 +94,6 @@ dict_mem_table_create(
return(table); return(table);
} }
/**************************************************************************
Creates a cluster memory object. */
dict_table_t*
dict_mem_cluster_create(
/*====================*/
/* out, own: cluster object */
const char* name, /* in: cluster name */
ulint space, /* in: space where the clustered indexes
of the member tables are placed */
ulint n_cols, /* in: number of columns */
ulint mix_len)/* in: length of the common key prefix in the
cluster */
{
dict_table_t* cluster;
/* Clustered tables cannot work with the compact record format. */
cluster = dict_mem_table_create(name, space, n_cols, 0);
cluster->type = DICT_TABLE_CLUSTER;
cluster->mix_len = mix_len;
return(cluster);
}
/**************************************************************************
Declares a non-published table as a member in a cluster. */
void
dict_mem_table_make_cluster_member(
/*===============================*/
dict_table_t* table, /* in: non-published table */
const char* cluster_name) /* in: cluster name */
{
table->type = DICT_TABLE_CLUSTER_MEMBER;
table->cluster_name = cluster_name;
}
/************************************************************************** /**************************************************************************
Adds a column definition to a table. */ Adds a column definition to a table. */
......
...@@ -734,33 +734,6 @@ dict_tree_free( ...@@ -734,33 +734,6 @@ dict_tree_free(
/************************************************************************** /**************************************************************************
In an index tree, finds the index corresponding to a record in the tree. */ In an index tree, finds the index corresponding to a record in the tree. */
dict_index_t*
dict_tree_find_index(
/*=================*/
/* out: index */
dict_tree_t* tree, /* in: index tree */
rec_t* rec); /* in: record for which to find correct index */
/**************************************************************************
In an index tree, finds the index corresponding to a dtuple which is used
in a search to a tree. */
dict_index_t*
dict_tree_find_index_for_tuple(
/*===========================*/
/* out: index; NULL if the tuple does not
contain the mix id field in a mixed tree */
dict_tree_t* tree, /* in: index tree */
dtuple_t* tuple); /* in: tuple for which to find index */
/***********************************************************************
Checks if a table which is a mixed cluster member owns a record. */
ibool
dict_is_mixed_table_rec(
/*====================*/
/* out: TRUE if the record belongs to this
table */
dict_table_t* table, /* in: table in a mixed cluster */
rec_t* rec); /* in: user record in the clustered index */
/************************************************************************** /**************************************************************************
Returns an index object if it is found in the dictionary cache. */ Returns an index object if it is found in the dictionary cache. */
...@@ -769,6 +742,7 @@ dict_index_get_if_in_cache( ...@@ -769,6 +742,7 @@ dict_index_get_if_in_cache(
/*=======================*/ /*=======================*/
/* out: index, NULL if not found */ /* out: index, NULL if not found */
dulint index_id); /* in: index id */ dulint index_id); /* in: index id */
#ifdef UNIV_DEBUG
/************************************************************************** /**************************************************************************
Checks that a tuple has n_fields_cmp value in a sensible range, so that Checks that a tuple has n_fields_cmp value in a sensible range, so that
no comparison can occur with the page number field in a node pointer. */ no comparison can occur with the page number field in a node pointer. */
...@@ -779,6 +753,7 @@ dict_tree_check_search_tuple( ...@@ -779,6 +753,7 @@ dict_tree_check_search_tuple(
/* out: TRUE if ok */ /* out: TRUE if ok */
dict_tree_t* tree, /* in: index tree */ dict_tree_t* tree, /* in: index tree */
dtuple_t* tuple); /* in: tuple used in a search */ dtuple_t* tuple); /* in: tuple used in a search */
#endif /* UNIV_DEBUG */
/************************************************************************** /**************************************************************************
Builds a node pointer out of a physical record and a page number. */ Builds a node pointer out of a physical record and a page number. */
......
...@@ -35,9 +35,11 @@ combination of types */ ...@@ -35,9 +35,11 @@ combination of types */
/* Types for a table object */ /* Types for a table object */
#define DICT_TABLE_ORDINARY 1 #define DICT_TABLE_ORDINARY 1
#if 0 /* not implemented */
#define DICT_TABLE_CLUSTER_MEMBER 2 #define DICT_TABLE_CLUSTER_MEMBER 2
#define DICT_TABLE_CLUSTER 3 /* this means that the table is #define DICT_TABLE_CLUSTER 3 /* this means that the table is
really a cluster definition */ really a cluster definition */
#endif
/* Table flags */ /* Table flags */
#define DICT_TF_COMPACT 1 /* compact page format */ #define DICT_TF_COMPACT 1 /* compact page format */
...@@ -57,29 +59,6 @@ dict_mem_table_create( ...@@ -57,29 +59,6 @@ dict_mem_table_create(
ulint n_cols, /* in: number of columns */ ulint n_cols, /* in: number of columns */
ulint flags); /* in: table flags */ ulint flags); /* in: table flags */
/************************************************************************** /**************************************************************************
Creates a cluster memory object. */
dict_cluster_t*
dict_mem_cluster_create(
/*====================*/
/* out, own: cluster object (where the
type dict_cluster_t == dict_table_t) */
const char* name, /* in: cluster name */
ulint space, /* in: space where the clustered
indexes of the member tables are
placed */
ulint n_cols, /* in: number of columns */
ulint mix_len); /* in: length of the common key prefix
in the cluster */
/**************************************************************************
Declares a non-published table as a member in a cluster. */
void
dict_mem_table_make_cluster_member(
/*===============================*/
dict_table_t* table, /* in: non-published table */
const char* cluster_name); /* in: cluster name */
/**************************************************************************
Adds a column definition to a table. */ Adds a column definition to a table. */
void void
...@@ -176,9 +155,7 @@ struct dict_field_struct{ ...@@ -176,9 +155,7 @@ struct dict_field_struct{
/* Data structure for an index tree */ /* Data structure for an index tree */
struct dict_tree_struct{ struct dict_tree_struct{
ulint type; /* tree type */ ulint type; /* tree type */
dulint id; /* id of the index stored in the tree, in the dulint id; /* id of the index stored in the tree */
case of a mixed index, the id of the clustered
index of the cluster table */
ulint space; /* space of index tree */ ulint space; /* space of index tree */
ulint page; /* index tree root page number */ ulint page; /* index tree root page number */
byte pad[64];/* Padding to prevent other memory hotspots on byte pad[64];/* Padding to prevent other memory hotspots on
...@@ -189,13 +166,8 @@ struct dict_tree_struct{ ...@@ -189,13 +166,8 @@ struct dict_tree_struct{
struct has been memoryfixed (by mini- struct has been memoryfixed (by mini-
transactions wanting to access the index transactions wanting to access the index
tree) */ tree) */
UT_LIST_BASE_NODE_T(dict_index_t) dict_index_t* tree_index; /* the index stored in the
tree_indexes; /* list of indexes stored in the index tree */
index tree: if the tree is not of the
mixed type there is only one index in
the list; if the tree is of the mixed
type, the first index in the list is the
index of the cluster which owns the tree */
ulint magic_n;/* magic number */ ulint magic_n;/* magic number */
}; };
...@@ -301,7 +273,7 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */ ...@@ -301,7 +273,7 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */
/* Data structure for a database table */ /* Data structure for a database table */
struct dict_table_struct{ struct dict_table_struct{
dulint id; /* id of the table or cluster */ dulint id; /* id of the table */
ulint type; /* DICT_TABLE_ORDINARY, ... */ ulint type; /* DICT_TABLE_ORDINARY, ... */
ulint flags; /* DICT_TF_COMPACT, ... */ ulint flags; /* DICT_TF_COMPACT, ... */
mem_heap_t* heap; /* memory heap */ mem_heap_t* heap; /* memory heap */
...@@ -371,17 +343,6 @@ struct dict_table_struct{ ...@@ -371,17 +343,6 @@ struct dict_table_struct{
UT_LIST_BASE_NODE_T(lock_t) UT_LIST_BASE_NODE_T(lock_t)
locks; /* list of locks on the table */ locks; /* list of locks on the table */
/*----------------------*/ /*----------------------*/
dulint mix_id; /* if the table is a member in a cluster,
this is its mix id */
ulint mix_len;/* if the table is a cluster or a member
this is the common key prefix lenght */
ulint mix_id_len;/* mix id length in a compressed form */
byte mix_id_buf[12];
/* mix id of a mixed table written in
a compressed form */
const char* cluster_name; /* if the table is a member in a
cluster, this is the name of the cluster */
/*----------------------*/
ibool does_not_fit_in_memory; ibool does_not_fit_in_memory;
/* this field is used to specify in simulations /* this field is used to specify in simulations
tables which are so big that disk should be tables which are so big that disk should be
......
...@@ -224,8 +224,6 @@ struct plan_struct{ ...@@ -224,8 +224,6 @@ struct plan_struct{
ulint first_prefetched;/* index of the first cached row in ulint first_prefetched;/* index of the first cached row in
select buffer arrays for each column */ select buffer arrays for each column */
ibool no_prefetch; /* no prefetch for this table */ ibool no_prefetch; /* no prefetch for this table */
ibool mixed_index; /* TRUE if index is a clustered index
in a mixed cluster */
sym_node_list_t columns; /* symbol table nodes for the columns sym_node_list_t columns; /* symbol table nodes for the columns
to retrieve from the table */ to retrieve from the table */
UT_LIST_BASE_NODE_T(func_node_t) UT_LIST_BASE_NODE_T(func_node_t)
......
...@@ -313,7 +313,6 @@ opt_calc_index_goodness( ...@@ -313,7 +313,6 @@ opt_calc_index_goodness(
ulint goodness; ulint goodness;
ulint n_fields; ulint n_fields;
ulint col_no; ulint col_no;
ulint mix_id_col_no;
ulint op; ulint op;
ulint j; ulint j;
...@@ -326,8 +325,6 @@ opt_calc_index_goodness( ...@@ -326,8 +325,6 @@ opt_calc_index_goodness(
n_fields = dict_index_get_n_unique_in_tree(index); n_fields = dict_index_get_n_unique_in_tree(index);
mix_id_col_no = dict_table_get_sys_col_no(index->table, DATA_MIX_ID);
for (j = 0; j < n_fields; j++) { for (j = 0; j < n_fields; j++) {
col_no = dict_index_get_nth_col_no(index, j); col_no = dict_index_get_nth_col_no(index, j);
...@@ -335,13 +332,7 @@ opt_calc_index_goodness( ...@@ -335,13 +332,7 @@ opt_calc_index_goodness(
exp = opt_look_for_col_in_cond_before(OPT_EQUAL, col_no, exp = opt_look_for_col_in_cond_before(OPT_EQUAL, col_no,
sel_node->search_cond, sel_node->search_cond,
sel_node, nth_table, &op); sel_node, nth_table, &op);
if (col_no == mix_id_col_no) { if (exp) {
ut_ad(exp == NULL);
index_plan[j] = NULL;
*last_op = '=';
goodness += 4;
} else if (exp) {
/* The value for this column is exactly known already /* The value for this column is exactly known already
at this stage of the join */ at this stage of the join */
...@@ -531,7 +522,6 @@ opt_search_plan_for_table( ...@@ -531,7 +522,6 @@ opt_search_plan_for_table(
warning */ warning */
ulint best_goodness; ulint best_goodness;
ulint best_last_op = 0; /* remove warning */ ulint best_last_op = 0; /* remove warning */
ulint mix_id_pos;
que_node_t* index_plan[256]; que_node_t* index_plan[256];
que_node_t* best_index_plan[256]; que_node_t* best_index_plan[256];
...@@ -601,26 +591,6 @@ opt_search_plan_for_table( ...@@ -601,26 +591,6 @@ opt_search_plan_for_table(
plan->unique_search = FALSE; plan->unique_search = FALSE;
} }
if ((table->type != DICT_TABLE_ORDINARY)
&& (best_index->type & DICT_CLUSTERED)) {
plan->mixed_index = TRUE;
mix_id_pos = table->mix_len;
if (mix_id_pos < n_fields) {
/* We have to add the mix id as a (string) literal
expression to the tuple_exps */
plan->tuple_exps[mix_id_pos] =
sym_tab_add_str_lit(pars_sym_tab_global,
table->mix_id_buf,
table->mix_id_len);
}
} else {
plan->mixed_index = FALSE;
}
plan->old_vers_heap = NULL; plan->old_vers_heap = NULL;
btr_pcur_init(&(plan->pcur)); btr_pcur_init(&(plan->pcur));
...@@ -1055,7 +1025,6 @@ opt_clust_access( ...@@ -1055,7 +1025,6 @@ opt_clust_access(
dict_table_t* table; dict_table_t* table;
dict_index_t* clust_index; dict_index_t* clust_index;
dict_index_t* index; dict_index_t* index;
dfield_t* dfield;
mem_heap_t* heap; mem_heap_t* heap;
ulint n_fields; ulint n_fields;
ulint pos; ulint pos;
...@@ -1109,22 +1078,7 @@ opt_clust_access( ...@@ -1109,22 +1078,7 @@ opt_clust_access(
*(plan->clust_map + i) = pos; *(plan->clust_map + i) = pos;
ut_ad((pos != ULINT_UNDEFINED) ut_ad(pos != ULINT_UNDEFINED);
|| ((table->type == DICT_TABLE_CLUSTER_MEMBER)
&& (i == table->mix_len)));
}
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
/* Preset the mix id field to the mix id constant */
dfield = dtuple_get_nth_field(plan->clust_ref, table->mix_len);
dfield_set_data(dfield, mem_heap_alloc(heap,
table->mix_id_len),
table->mix_id_len);
ut_memcpy(dfield_get_data(dfield), table->mix_id_buf,
table->mix_id_len);
} }
} }
......
...@@ -140,7 +140,6 @@ row_ins_alloc_sys_fields( ...@@ -140,7 +140,6 @@ row_ins_alloc_sys_fields(
mem_heap_t* heap; mem_heap_t* heap;
dict_col_t* col; dict_col_t* col;
dfield_t* dfield; dfield_t* dfield;
ulint len;
byte* ptr; byte* ptr;
row = node->row; row = node->row;
...@@ -162,21 +161,6 @@ row_ins_alloc_sys_fields( ...@@ -162,21 +161,6 @@ row_ins_alloc_sys_fields(
node->row_id_buf = ptr; node->row_id_buf = ptr;
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
/* 2. Fill in the dfield for mix id */
col = dict_table_get_sys_col(table, DATA_MIX_ID);
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
len = mach_dulint_get_compressed_size(table->mix_id);
ptr = mem_heap_alloc(heap, DATA_MIX_ID_LEN);
mach_dulint_write_compressed(ptr, table->mix_id);
dfield_set_data(dfield, ptr, len);
}
/* 3. Allocate buffer for trx id */ /* 3. Allocate buffer for trx id */
col = dict_table_get_sys_col(table, DATA_TRX_ID); col = dict_table_get_sys_col(table, DATA_TRX_ID);
......
...@@ -1430,14 +1430,6 @@ row_sel( ...@@ -1430,14 +1430,6 @@ row_sel(
/* Ok, no need to test end_conds or mix id */ /* Ok, no need to test end_conds or mix id */
} else if (plan->mixed_index) {
/* We have to check if the record in a mixed cluster belongs
to this table */
if (!dict_is_mixed_table_rec(plan->table, rec)) {
goto next_rec;
}
} }
/* We are ready to look at a possible new index entry in the result /* We are ready to look at a possible new index entry in the result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment