PS-11140 [8.0] rec_get_offsets optimize: avoid redundant dict_table_is_comp() in hot path#5937
Open
wjunLu wants to merge 2 commits into
Open
PS-11140 [8.0] rec_get_offsets optimize: avoid redundant dict_table_is_comp() in hot path#5937wjunLu wants to merge 2 commits into
wjunLu wants to merge 2 commits into
Conversation
…in hot path Add rec_get_offsets_with_comp() which accepts a pre-computed compact flag, avoiding repeated dict_table_is_comp(index->table) calls inside the function on every invocation. Apply the optimization in: - page_copy_rec_list_end_to_created_page (page0cur.cc): cache compact once before the record copy loop. - row_search_mvcc (row0sel.cc): reuse the existing comp variable at 6 call sites in the hot scan path. Ported from boostdb-patches/0001-rec_get_offsets-optimize.patch (originally targeting Percona Server 5.7.44-53). Adapted for 8.0: - ibool -> bool - file/line -> ut::Location - mem_heap_create_at -> mem_heap_create(size, location) - rec_get_n_fields_old(rec) -> rec_get_n_fields_old(rec, index) - Implementation moved to rem/rec.h and rem/rec.cc - The locks_ok hunk is not applicable (semi-consistent read path restructured) Signed-off-by: wjunLu <wjunlu217@gmail.com>
Reformat function declaration, definition and call sites to satisfy clang-format-19 style checks flagged by CircleCI. Signed-off-by: wjunLu <wjunlu217@gmail.com>
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.
Summary
rec_get_offsets_with_comp()inrem/rec.handrem/rec.cc, accepting a pre-computedcompact(bool) flag to skip the repeateddict_table_is_comp(index->table)call inside the function on every invocation.page_copy_rec_list_end_to_created_page(page0cur.cc): cachecompactonce before the record copy loop, then userec_get_offsets_with_comp()inside it.row_search_mvcc(row0sel.cc): reuse the existingcompvariable at 6 hot-path call sites.8.0 adaptation notes:
ibool→boolconst char* file, ulint line+#ifdef UNIV_DEBUG→ut::Location locationmem_heap_create_at(size, file, line)→mem_heap_create(size, location)rec_get_n_fields_old(rec)→rec_get_n_fields_old(rec, index)rem/rec.h/rem/rec.cc(notrem0rec.h/cc)locks_okhunk from 5.7 is not applicable: the semi-consistent read path in 8.0 has been restructured androw_sel_build_committed_vers_for_mysql()already returns updated offsets