PS-11073 [8.0]: Fix underestimations in dict_index_node_ptr_max_size()#5945
Open
polchawa-percona wants to merge 1 commit into
Open
PS-11073 [8.0]: Fix underestimations in dict_index_node_ptr_max_size()#5945polchawa-percona wants to merge 1 commit into
polchawa-percona wants to merge 1 commit into
Conversation
de198bc to
b410041
Compare
… utf32 PK indexes https://perconadev.atlassian.net/browse/PS-11073 * Spatial indexes: the first field stores the MBR (DATA_MBR_LEN bytes), not the original geometry payload. Without this special case the generic path uses dict_col_get_max_size() which returns ULINT_MAX for DATA_GEOMETRY, causing rec_max_size to wrap around to a too-small node_ptr_max_size estimate. * Fast path was incorrectly taken whenever dict_col_get_fixed_size() returned non-zero. When dict_index_add_col() has zeroed field->fixed_len (because fixed_len > DICT_MAX_FIXED_COL_LEN = 768, e.g. CHAR(255) utf32 = 1020 bytes), the field is actually variable- length-encoded and needs 1-2 extra header bytes that the fast path skipped. Take the fast path only when field->fixed_len != 0. * Added a sanity ut_ad(field_max_size != ULINT_MAX) on the slow path. A debug-only runtime cross-check is added in btr_cur_search_to_nth_level() under the new DBUG keyword "check_node_ptr_size_estimation": when latched in BTR_MODIFY_TREE the actual rec_offs_size(node_ptr_offsets) must not exceed the estimated node_ptr_max_size. Tests enable this DBUG keyword to verify the estimator is a true upper bound.
b410041 to
0c02b60
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://perconadev.atlassian.net/browse/PS-11073
Spatial indexes: the first field stores the MBR (DATA_MBR_LEN bytes), not the original geometry payload. Without this special case the generic path uses dict_col_get_max_size() which returns ULINT_MAX for DATA_GEOMETRY, causing rec_max_size to wrap around to a too-small node_ptr_max_size estimate.
Fast path was incorrectly taken whenever dict_col_get_fixed_size() returned non-zero. When dict_index_add_col() has zeroed field->fixed_len (because fixed_len > DICT_MAX_FIXED_COL_LEN = 768, e.g. CHAR(255) utf32 = 1020 bytes), the field is actually variable- length-encoded and needs 1-2 extra header bytes that the fast path skipped. Take the fast path only when field->fixed_len != 0.
Added a sanity ut_ad(field_max_size != ULINT_MAX) on the slow path.
A debug-only runtime cross-check is added in btr_cur_search_to_nth_level() under the new DBUG keyword "check_node_ptr_size_estimation": when latched in BTR_MODIFY_TREE the actual rec_offs_size(node_ptr_offsets) must not exceed the estimated node_ptr_max_size. Tests enable this DBUG keyword to verify the estimator is a true upper bound.