Commit 460042ef authored by osku's avatar osku

Remove the concept of "field order", as we will not support descending order

indexes.
parent 44a14a17
...@@ -265,7 +265,7 @@ dict_boot(void) ...@@ -265,7 +265,7 @@ dict_boot(void)
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND", index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1); DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1);
dict_mem_index_add_field(index, "NAME", 0, 0); dict_mem_index_add_field(index, "NAME", 0);
index->id = DICT_TABLES_ID; index->id = DICT_TABLES_ID;
...@@ -275,7 +275,7 @@ dict_boot(void) ...@@ -275,7 +275,7 @@ dict_boot(void)
/*-------------------------*/ /*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND", index = dict_mem_index_create("SYS_TABLES", "ID_IND",
DICT_HDR_SPACE, DICT_UNIQUE, 1); DICT_HDR_SPACE, DICT_UNIQUE, 1);
dict_mem_index_add_field(index, "ID", 0, 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID; index->id = DICT_TABLE_IDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint(
...@@ -300,8 +300,8 @@ dict_boot(void) ...@@ -300,8 +300,8 @@ dict_boot(void)
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND", index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2); DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0, 0); dict_mem_index_add_field(index, "TABLE_ID", 0);
dict_mem_index_add_field(index, "POS", 0, 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID; index->id = DICT_COLUMNS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint(
...@@ -336,8 +336,8 @@ dict_boot(void) ...@@ -336,8 +336,8 @@ dict_boot(void)
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND", index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2); DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0, 0); dict_mem_index_add_field(index, "TABLE_ID", 0);
dict_mem_index_add_field(index, "ID", 0, 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID; index->id = DICT_INDEXES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint(
...@@ -357,8 +357,8 @@ dict_boot(void) ...@@ -357,8 +357,8 @@ dict_boot(void)
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND", index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2); DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "INDEX_ID", 0, 0); dict_mem_index_add_field(index, "INDEX_ID", 0);
dict_mem_index_add_field(index, "POS", 0, 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID; index->id = DICT_FIELDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint( success = dict_index_add_to_cache(table, index, mtr_read_ulint(
......
...@@ -1605,12 +1605,11 @@ dict_index_add_col( ...@@ -1605,12 +1605,11 @@ dict_index_add_col(
/*===============*/ /*===============*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
dict_col_t* col, /* in: column */ dict_col_t* col, /* in: column */
ulint order, /* in: order criterion */
ulint prefix_len) /* in: column prefix length */ ulint prefix_len) /* in: column prefix length */
{ {
dict_field_t* field; dict_field_t* field;
dict_mem_index_add_field(index, col->name, order, prefix_len); dict_mem_index_add_field(index, col->name, prefix_len);
field = dict_index_get_nth_field(index, index->n_def - 1); field = dict_index_get_nth_field(index, index->n_def - 1);
...@@ -1653,8 +1652,7 @@ dict_index_copy( ...@@ -1653,8 +1652,7 @@ dict_index_copy(
for (i = start; i < end; i++) { for (i = start; i < end; i++) {
field = dict_index_get_nth_field(index2, i); field = dict_index_get_nth_field(index2, i);
dict_index_add_col(index1, field->col, field->order, dict_index_add_col(index1, field->col, field->prefix_len);
field->prefix_len);
} }
} }
...@@ -1758,7 +1756,7 @@ dict_index_build_internal_clust( ...@@ -1758,7 +1756,7 @@ dict_index_build_internal_clust(
/* Add the mix id column */ /* Add the mix id column */
dict_index_add_col(new_index, dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_MIX_ID), 0, 0); dict_table_get_sys_col(table, DATA_MIX_ID), 0);
/* Copy the rest of fields */ /* Copy the rest of fields */
dict_index_copy(new_index, index, table->mix_len, dict_index_copy(new_index, index, table->mix_len,
...@@ -1802,15 +1800,15 @@ dict_index_build_internal_clust( ...@@ -1802,15 +1800,15 @@ dict_index_build_internal_clust(
if (!(index->type & DICT_UNIQUE)) { if (!(index->type & DICT_UNIQUE)) {
dict_index_add_col(new_index, dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_ROW_ID), 0, 0); dict_table_get_sys_col(table, DATA_ROW_ID), 0);
trx_id_pos++; trx_id_pos++;
} }
dict_index_add_col(new_index, dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_TRX_ID), 0, 0); dict_table_get_sys_col(table, DATA_TRX_ID), 0);
dict_index_add_col(new_index, dict_index_add_col(new_index,
dict_table_get_sys_col(table, DATA_ROLL_PTR), 0, 0); dict_table_get_sys_col(table, DATA_ROLL_PTR), 0);
for (i = 0; i < trx_id_pos; i++) { for (i = 0; i < trx_id_pos; i++) {
...@@ -1864,7 +1862,7 @@ dict_index_build_internal_clust( ...@@ -1864,7 +1862,7 @@ dict_index_build_internal_clust(
ut_ad(col->type.mtype != DATA_SYS); ut_ad(col->type.mtype != DATA_SYS);
if (col->aux == ULINT_UNDEFINED) { if (col->aux == ULINT_UNDEFINED) {
dict_index_add_col(new_index, col, 0, 0); dict_index_add_col(new_index, col, 0);
} }
} }
...@@ -1968,7 +1966,7 @@ dict_index_build_internal_non_clust( ...@@ -1968,7 +1966,7 @@ dict_index_build_internal_non_clust(
field = dict_index_get_nth_field(clust_index, i); field = dict_index_get_nth_field(clust_index, i);
if (field->col->aux == ULINT_UNDEFINED) { if (field->col->aux == ULINT_UNDEFINED) {
dict_index_add_col(new_index, field->col, 0, dict_index_add_col(new_index, field->col,
field->prefix_len); field->prefix_len);
} }
} }
......
...@@ -533,7 +533,7 @@ dict_load_fields( ...@@ -533,7 +533,7 @@ dict_load_fields(
field = rec_get_nth_field_old(rec, 4, &len); field = rec_get_nth_field_old(rec, 4, &len);
dict_mem_index_add_field(index, dict_mem_index_add_field(index,
mem_heap_strdupl(heap, (char*) field, len), 0, prefix_len); mem_heap_strdupl(heap, (char*) field, len), prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
} }
......
...@@ -261,8 +261,6 @@ dict_mem_index_add_field( ...@@ -261,8 +261,6 @@ dict_mem_index_add_field(
/*=====================*/ /*=====================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
const char* name, /* in: column name */ const char* name, /* in: column name */
ulint order, /* in: order criterion; 0 means an
ascending order */
ulint prefix_len) /* in: 0 or the column prefix length ulint prefix_len) /* in: 0 or the column prefix length
in a MySQL index like in a MySQL index like
INDEX (textcol(25)) */ INDEX (textcol(25)) */
...@@ -277,8 +275,6 @@ dict_mem_index_add_field( ...@@ -277,8 +275,6 @@ dict_mem_index_add_field(
field = dict_index_get_nth_field(index, index->n_def - 1); field = dict_index_get_nth_field(index, index->n_def - 1);
field->name = name; field->name = name;
field->order = order;
field->prefix_len = prefix_len; field->prefix_len = prefix_len;
} }
......
...@@ -4781,12 +4781,8 @@ create_index( ...@@ -4781,12 +4781,8 @@ create_index(
field_lengths[i] = key_part->length; field_lengths[i] = key_part->length;
/* We assume all fields should be sorted in ascending
order, hence the '0': */
dict_mem_index_add_field(index, dict_mem_index_add_field(index,
(char*) key_part->field->field_name, (char*) key_part->field->field_name, prefix_len);
0, prefix_len);
} }
/* Even though we've defined max_supported_key_part_length, we /* Even though we've defined max_supported_key_part_length, we
......
...@@ -545,8 +545,8 @@ ibuf_data_init_for_space( ...@@ -545,8 +545,8 @@ ibuf_data_init_for_space(
index = dict_mem_index_create(buf, "CLUST_IND", space, index = dict_mem_index_create(buf, "CLUST_IND", space,
DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,2); DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,2);
dict_mem_index_add_field(index, "PAGE_NO", 0, 0); dict_mem_index_add_field(index, "PAGE_NO", 0);
dict_mem_index_add_field(index, "TYPES", 0, 0); dict_mem_index_add_field(index, "TYPES", 0);
index->id = ut_dulint_add(DICT_IBUF_ID_MIN, space); index->id = ut_dulint_add(DICT_IBUF_ID_MIN, space);
...@@ -1152,7 +1152,7 @@ ibuf_dummy_index_add_col( ...@@ -1152,7 +1152,7 @@ ibuf_dummy_index_add_col(
dtype_get_len(type), dtype_get_len(type),
dtype_get_prec(type)); dtype_get_prec(type));
dict_index_add_col(index, dict_index_add_col(index,
dict_table_get_nth_col(index->table, i), 0, len); dict_table_get_nth_col(index->table, i), len);
} }
/************************************************************************ /************************************************************************
Deallocates a dummy index for inserting a record to a non-clustered index. Deallocates a dummy index for inserting a record to a non-clustered index.
......
...@@ -660,7 +660,6 @@ dict_index_add_col( ...@@ -660,7 +660,6 @@ dict_index_add_col(
/*===============*/ /*===============*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
dict_col_t* col, /* in: column */ dict_col_t* col, /* in: column */
ulint order, /* in: order criterion */
ulint prefix_len); /* in: column prefix length */ ulint prefix_len); /* in: column prefix length */
/*********************************************************************** /***********************************************************************
Copies types of fields contained in index to tuple. */ Copies types of fields contained in index to tuple. */
...@@ -680,13 +679,6 @@ dict_index_get_tree( ...@@ -680,13 +679,6 @@ dict_index_get_tree(
/* out: index tree */ /* out: index tree */
dict_index_t* index); /* in: index */ dict_index_t* index); /* in: index */
/************************************************************************* /*************************************************************************
Gets the field order criterion. */
UNIV_INLINE
ulint
dict_field_get_order(
/*=================*/
dict_field_t* field);
/*************************************************************************
Gets the field column. */ Gets the field column. */
UNIV_INLINE UNIV_INLINE
dict_col_t* dict_col_t*
......
...@@ -326,19 +326,6 @@ dict_index_get_tree( ...@@ -326,19 +326,6 @@ dict_index_get_tree(
return(index->tree); return(index->tree);
} }
/*************************************************************************
Gets the field order criterion. */
UNIV_INLINE
ulint
dict_field_get_order(
/*=================*/
dict_field_t* field)
{
ut_ad(field);
return(field->order);
}
/************************************************************************* /*************************************************************************
Gets the field column. */ Gets the field column. */
UNIV_INLINE UNIV_INLINE
......
...@@ -33,9 +33,6 @@ combination of types */ ...@@ -33,9 +33,6 @@ combination of types */
other index */ other index */
#define DICT_IBUF 8 /* insert buffer tree */ #define DICT_IBUF 8 /* insert buffer tree */
/* Flags for ordering an index field: OR'ing of the flags allowed */
#define DICT_DESCEND 1 /* in descending order (default ascending) */
/* Types for a table object */ /* Types for a table object */
#define DICT_TABLE_ORDINARY 1 #define DICT_TABLE_ORDINARY 1
#define DICT_TABLE_CLUSTER_MEMBER 2 #define DICT_TABLE_CLUSTER_MEMBER 2
...@@ -116,8 +113,6 @@ dict_mem_index_add_field( ...@@ -116,8 +113,6 @@ dict_mem_index_add_field(
/*=====================*/ /*=====================*/
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
const char* name, /* in: column name */ const char* name, /* in: column name */
ulint order, /* in: order criterion; 0 means an
ascending order */
ulint prefix_len); /* in: 0 or the column prefix length ulint prefix_len); /* in: 0 or the column prefix length
in a MySQL index like in a MySQL index like
INDEX (textcol(25)) */ INDEX (textcol(25)) */
...@@ -163,8 +158,6 @@ UTF-8 charset. In that charset, a character may take at most 3 bytes. */ ...@@ -163,8 +158,6 @@ UTF-8 charset. In that charset, a character may take at most 3 bytes. */
struct dict_field_struct{ struct dict_field_struct{
dict_col_t* col; /* pointer to the table column */ dict_col_t* col; /* pointer to the table column */
const char* name; /* name of the column */ const char* name; /* name of the column */
ulint order; /* flags for ordering this field:
DICT_DESCEND, ... */
ulint prefix_len; /* 0 or the length of the column ulint prefix_len; /* 0 or the length of the column
prefix in bytes in a MySQL index of prefix in bytes in a MySQL index of
type, e.g., INDEX (textcol(25)); type, e.g., INDEX (textcol(25));
......
...@@ -541,7 +541,7 @@ mlog_parse_index( ...@@ -541,7 +541,7 @@ mlog_parse_index(
len & 0x8000 ? DATA_NOT_NULL : 0, len & 0x8000 ? DATA_NOT_NULL : 0,
len & 0x7fff, 0); len & 0x7fff, 0);
dict_index_add_col(ind, dict_index_add_col(ind,
dict_table_get_nth_col(table, i), 0, 0); dict_table_get_nth_col(table, i), 0);
} }
ptr += 2; ptr += 2;
} }
......
...@@ -1643,7 +1643,7 @@ pars_create_index( ...@@ -1643,7 +1643,7 @@ pars_create_index(
column = column_list; column = column_list;
while (column) { while (column) {
dict_mem_index_add_field(index, column->name, 0, 0); dict_mem_index_add_field(index, column->name, 0);
column->resolved = TRUE; column->resolved = TRUE;
column->token_type = SYM_COLUMN; column->token_type = SYM_COLUMN;
......
...@@ -922,7 +922,7 @@ srv_init(void) ...@@ -922,7 +922,7 @@ srv_init(void)
srv_sys->dummy_ind1 = dict_mem_index_create("SYS_DUMMY1", srv_sys->dummy_ind1 = dict_mem_index_create("SYS_DUMMY1",
"SYS_DUMMY1", DICT_HDR_SPACE, 0, 1); "SYS_DUMMY1", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind1, dict_index_add_col(srv_sys->dummy_ind1,
dict_table_get_nth_col(table, 0), 0, 0); dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind1->table = table; srv_sys->dummy_ind1->table = table;
/* create dummy table and index for new-style infimum and supremum */ /* create dummy table and index for new-style infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY2", table = dict_mem_table_create("SYS_DUMMY2",
...@@ -932,7 +932,7 @@ srv_init(void) ...@@ -932,7 +932,7 @@ srv_init(void)
srv_sys->dummy_ind2 = dict_mem_index_create("SYS_DUMMY2", srv_sys->dummy_ind2 = dict_mem_index_create("SYS_DUMMY2",
"SYS_DUMMY2", DICT_HDR_SPACE, 0, 1); "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind2, dict_index_add_col(srv_sys->dummy_ind2,
dict_table_get_nth_col(table, 0), 0, 0); dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind2->table = table; srv_sys->dummy_ind2->table = table;
/* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */ /* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */
......
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