Commit d8aa49be authored by marko's avatar marko

branches/zip: Merge revisions 765:767 from trunk.

parent 38e09b2f
...@@ -1785,6 +1785,7 @@ dict_index_build_internal_clust( ...@@ -1785,6 +1785,7 @@ dict_index_build_internal_clust(
ulint fixed_size; ulint fixed_size;
ulint trx_id_pos; ulint trx_id_pos;
ulint i; ulint i;
ibool* indexed;
ut_ad(table && index); ut_ad(table && index);
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
...@@ -1879,12 +1880,9 @@ dict_index_build_internal_clust( ...@@ -1879,12 +1880,9 @@ dict_index_build_internal_clust(
} }
/* Set auxiliary variables in table columns as undefined */ /* Remember the table columns already contained in new_index */
for (i = 0; i < table->n_cols; i++) { indexed = mem_alloc(table->n_cols * sizeof *indexed);
memset(indexed, 0, table->n_cols * sizeof *indexed);
col = dict_table_get_nth_col(table, i);
col->aux = ULINT_UNDEFINED;
}
/* Mark with 0 the table columns already contained in new_index */ /* Mark with 0 the table columns already contained in new_index */
for (i = 0; i < new_index->n_def; i++) { for (i = 0; i < new_index->n_def; i++) {
...@@ -1896,7 +1894,7 @@ dict_index_build_internal_clust( ...@@ -1896,7 +1894,7 @@ dict_index_build_internal_clust(
if (field->prefix_len == 0) { if (field->prefix_len == 0) {
field->col->aux = 0; indexed[field->col->ind] = TRUE;
} }
} }
...@@ -1907,11 +1905,13 @@ dict_index_build_internal_clust( ...@@ -1907,11 +1905,13 @@ dict_index_build_internal_clust(
col = dict_table_get_nth_col(table, i); col = dict_table_get_nth_col(table, i);
ut_ad(col->type.mtype != DATA_SYS); ut_ad(col->type.mtype != DATA_SYS);
if (col->aux == ULINT_UNDEFINED) { if (!indexed[col->ind]) {
dict_index_add_col(new_index, col, 0); dict_index_add_col(new_index, col, 0);
} }
} }
mem_free(indexed);
ut_ad((index->type & DICT_IBUF) ut_ad((index->type & DICT_IBUF)
|| (UT_LIST_GET_LEN(table->indexes) == 0)); || (UT_LIST_GET_LEN(table->indexes) == 0));
...@@ -1949,6 +1949,7 @@ dict_index_build_internal_non_clust( ...@@ -1949,6 +1949,7 @@ dict_index_build_internal_non_clust(
dict_index_t* new_index; dict_index_t* new_index;
dict_index_t* clust_index; dict_index_t* clust_index;
ulint i; ulint i;
ibool* indexed;
ut_ad(table && index); ut_ad(table && index);
ut_ad(!dict_index_is_clust(index)); ut_ad(!dict_index_is_clust(index));
...@@ -1979,13 +1980,9 @@ dict_index_build_internal_non_clust( ...@@ -1979,13 +1980,9 @@ dict_index_build_internal_non_clust(
/* Copy fields from index to new_index */ /* Copy fields from index to new_index */
dict_index_copy(new_index, index, 0, index->n_fields); dict_index_copy(new_index, index, 0, index->n_fields);
/* Set the auxiliary variables in the clust_index unique columns /* Remember the table columns already contained in new_index */
as undefined */ indexed = mem_alloc(table->n_cols * sizeof *indexed);
for (i = 0; i < clust_index->n_uniq; i++) { memset(indexed, 0, table->n_cols * sizeof *indexed);
field = dict_index_get_nth_field(clust_index, i);
field->col->aux = ULINT_UNDEFINED;
}
/* Mark with 0 table columns already contained in new_index */ /* Mark with 0 table columns already contained in new_index */
for (i = 0; i < new_index->n_def; i++) { for (i = 0; i < new_index->n_def; i++) {
...@@ -1997,7 +1994,7 @@ dict_index_build_internal_non_clust( ...@@ -1997,7 +1994,7 @@ dict_index_build_internal_non_clust(
if (field->prefix_len == 0) { if (field->prefix_len == 0) {
field->col->aux = 0; indexed[field->col->ind] = TRUE;
} }
} }
...@@ -2008,12 +2005,14 @@ dict_index_build_internal_non_clust( ...@@ -2008,12 +2005,14 @@ 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 (!indexed[field->col->ind]) {
dict_index_add_col(new_index, field->col, dict_index_add_col(new_index, field->col,
field->prefix_len); field->prefix_len);
} }
} }
mem_free(indexed);
if ((index->type) & DICT_UNIQUE) { if ((index->type) & DICT_UNIQUE) {
new_index->n_uniq = index->n_fields; new_index->n_uniq = index->n_fields;
} else { } else {
......
...@@ -135,8 +135,6 @@ struct dict_col_struct{ ...@@ -135,8 +135,6 @@ struct dict_col_struct{
const char* name; /* name */ const char* name; /* name */
dtype_t type; /* data type */ dtype_t type; /* data type */
dict_table_t* table; /* back pointer to table of this column */ dict_table_t* table; /* back pointer to table of this column */
ulint aux; /* this is used as an auxiliary variable
in some of the functions below */
}; };
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column /* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column
......
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