Commit 9b2f9ede authored by John Esmet's avatar John Esmet

FT-93 Fix another sizing bug exposed by ftnode_pivot_keys::sanity_check()

parent 2cfb1047
...@@ -324,11 +324,13 @@ void ftnode_pivot_keys::_append_dbt(const ftnode_pivot_keys &pivotkeys) { ...@@ -324,11 +324,13 @@ void ftnode_pivot_keys::_append_dbt(const ftnode_pivot_keys &pivotkeys) {
REALLOC_N_ALIGNED(64, _num_pivots + pivotkeys._num_pivots, _dbt_keys); REALLOC_N_ALIGNED(64, _num_pivots + pivotkeys._num_pivots, _dbt_keys);
bool other_fixed = pivotkeys._fixed_format(); bool other_fixed = pivotkeys._fixed_format();
for (int i = 0; i < pivotkeys._num_pivots; i++) { for (int i = 0; i < pivotkeys._num_pivots; i++) {
size_t size = other_fixed ? pivotkeys._fixed_keylen :
pivotkeys._dbt_keys[i].size;
toku_memdup_dbt(&_dbt_keys[_num_pivots + i], toku_memdup_dbt(&_dbt_keys[_num_pivots + i],
other_fixed ? pivotkeys._fixed_key(i) : other_fixed ? pivotkeys._fixed_key(i) :
pivotkeys._dbt_keys[i].data, pivotkeys._dbt_keys[i].data,
other_fixed ? pivotkeys._fixed_keylen : size);
pivotkeys._dbt_keys[i].size); _total_size += size;
} }
} }
...@@ -337,6 +339,7 @@ void ftnode_pivot_keys::_append_fixed(const ftnode_pivot_keys &pivotkeys) { ...@@ -337,6 +339,7 @@ void ftnode_pivot_keys::_append_fixed(const ftnode_pivot_keys &pivotkeys) {
// other pivotkeys have the same fixed keylen // other pivotkeys have the same fixed keylen
REALLOC_N_ALIGNED(64, (_num_pivots + pivotkeys._num_pivots) * _fixed_keylen_aligned, _fixed_keys); REALLOC_N_ALIGNED(64, (_num_pivots + pivotkeys._num_pivots) * _fixed_keylen_aligned, _fixed_keys);
memcpy(_fixed_key(_num_pivots), pivotkeys._fixed_keys, pivotkeys._total_size); memcpy(_fixed_key(_num_pivots), pivotkeys._fixed_keys, pivotkeys._total_size);
_total_size += pivotkeys._total_size;
} else { } else {
// must convert to dbt format, other pivotkeys have different length'd keys // must convert to dbt format, other pivotkeys have different length'd keys
_convert_to_dbt_format(); _convert_to_dbt_format();
...@@ -351,7 +354,6 @@ void ftnode_pivot_keys::append(const ftnode_pivot_keys &pivotkeys) { ...@@ -351,7 +354,6 @@ void ftnode_pivot_keys::append(const ftnode_pivot_keys &pivotkeys) {
_append_dbt(pivotkeys); _append_dbt(pivotkeys);
} }
_num_pivots += pivotkeys._num_pivots; _num_pivots += pivotkeys._num_pivots;
_total_size += pivotkeys._total_size;
sanity_check(); sanity_check();
} }
......
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