Commit 732d2f32 authored by marko's avatar marko

branches/zip: dtuple_convert_big_rec(): Reduce the locally stored part

of externally stored columns to REC_1BYTE_OFFS_LIMIT (128) bytes.
TODO: only store BTR_EXTERN_FIELD_REF_SIZE (20) bytes with the record,
and store the entire column externally.  (Bug #22496)

dict_col_t::min_prefix: Remove.
parent 16a5b788
...@@ -551,8 +551,7 @@ dtuple_convert_big_rec( ...@@ -551,8 +551,7 @@ dtuple_convert_big_rec(
for (i = dict_index_get_n_unique_in_tree(index); for (i = dict_index_get_n_unique_in_tree(index);
i < dtuple_get_n_fields(entry); i++) { i < dtuple_get_n_fields(entry); i++) {
ulint savings;
ulint min_prefix;
dfield = dtuple_get_nth_field(entry, i); dfield = dtuple_get_nth_field(entry, i);
ifield = dict_index_get_nth_field(index, i); ifield = dict_index_get_nth_field(index, i);
...@@ -561,27 +560,16 @@ dtuple_convert_big_rec( ...@@ -561,27 +560,16 @@ dtuple_convert_big_rec(
if (ifield->fixed_len if (ifield->fixed_len
|| dfield->len == UNIV_SQL_NULL || dfield->len == UNIV_SQL_NULL
|| dfield->len <= (BTR_EXTERN_FIELD_REF_SIZE || dfield->len <= REC_1BYTE_OFFS_LIMIT + 1) {
+ REC_1BYTE_OFFS_LIMIT + 1)) { goto skip_field;
continue;
} }
min_prefix = ifield->col->min_prefix; savings = dfield->len - (REC_1BYTE_OFFS_LIMIT + 1
- BTR_EXTERN_FIELD_REF_SIZE);
/* Skip indexed columns */
if (min_prefix == ULINT_UNDEFINED) {
continue;
}
if (min_prefix < (REC_1BYTE_OFFS_LIMIT + 1
- BTR_EXTERN_FIELD_REF_SIZE)) {
min_prefix = (REC_1BYTE_OFFS_LIMIT + 1
- BTR_EXTERN_FIELD_REF_SIZE);
}
/* Check that there would be savings */ /* Check that there would be savings */
if (longest >= dfield->len - min_prefix) { if (longest >= savings) {
continue; goto skip_field;
} }
/* Skip externally stored columns */ /* Skip externally stored columns */
...@@ -591,15 +579,15 @@ dtuple_convert_big_rec( ...@@ -591,15 +579,15 @@ dtuple_convert_big_rec(
for (j = 0; j < n_ext_vec; j++) { for (j = 0; j < n_ext_vec; j++) {
if (ext_vec[j] == i) { if (ext_vec[j] == i) {
goto is_externally_stored; goto skip_field;
} }
} }
} }
longest_i = i; longest_i = i;
longest = dfield->len - min_prefix; longest = savings;
is_externally_stored: skip_field:
continue; continue;
} }
...@@ -622,9 +610,8 @@ is_externally_stored: ...@@ -622,9 +610,8 @@ is_externally_stored:
vector->fields[n_fields].field_no = longest_i; vector->fields[n_fields].field_no = longest_i;
vector->fields[n_fields].len vector->fields[n_fields].len
= dfield->len - ut_max(REC_1BYTE_OFFS_LIMIT + 1 = dfield->len - (REC_1BYTE_OFFS_LIMIT + 1
- BTR_EXTERN_FIELD_REF_SIZE, - BTR_EXTERN_FIELD_REF_SIZE);
ifield->col->min_prefix);
vector->fields[n_fields].data vector->fields[n_fields].data
= mem_heap_alloc(heap, vector->fields[n_fields].len); = mem_heap_alloc(heap, vector->fields[n_fields].len);
...@@ -643,6 +630,7 @@ is_externally_stored: ...@@ -643,6 +630,7 @@ is_externally_stored:
+ dfield->len - BTR_EXTERN_FIELD_REF_SIZE, + dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
0, BTR_EXTERN_FIELD_REF_SIZE); 0, BTR_EXTERN_FIELD_REF_SIZE);
n_fields++; n_fields++;
ut_ad(n_fields < dtuple_get_n_fields(entry));
} }
vector->n_fields = n_fields; vector->n_fields = n_fields;
......
...@@ -1869,11 +1869,6 @@ dict_index_build_internal_non_clust( ...@@ -1869,11 +1869,6 @@ dict_index_build_internal_non_clust(
if (field->prefix_len == 0) { if (field->prefix_len == 0) {
indexed[field->col->ind] = TRUE; indexed[field->col->ind] = TRUE;
field->col->min_prefix = ULINT_UNDEFINED;
} else if (field->col->min_prefix < field->prefix_len) {
field->col->min_prefix = field->prefix_len;
} }
} }
......
...@@ -206,7 +206,6 @@ dict_mem_table_add_col( ...@@ -206,7 +206,6 @@ dict_mem_table_add_col(
col->ind = table->n_def - 1; col->ind = table->n_def - 1;
col->ord_part = 0; col->ord_part = 0;
col->min_prefix = 0;
col->mtype = mtype; col->mtype = mtype;
col->prtype = prtype; col->prtype = prtype;
......
...@@ -159,10 +159,6 @@ struct dict_col_struct{ ...@@ -159,10 +159,6 @@ struct dict_col_struct{
unsigned ord_part:1; /* nonzero if this column unsigned ord_part:1; /* nonzero if this column
appears in the ordering fields appears in the ordering fields
of an index */ of an index */
ulint min_prefix;/* the longest prefix index defined
on the column (in bytes), 0 if no index
defined, and ULINT_UNDEFINED if an index
is defined on the entire column */
}; };
#define DICT_MAX_INDEX_COL_LEN REC_MAX_INDEX_COL_LEN #define DICT_MAX_INDEX_COL_LEN REC_MAX_INDEX_COL_LEN
......
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