MDEV-31541: Optimize calls to build_table_filenames for CREATE TABLE #2696
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.
ha_table_exists()
forCREATE
statement that for single statement has 2 paths frommysql_create_table(()
that are called sequentually:We are creating the new members of HA_CREATE_INFO that are updated after first call of
ha_table_exists()
and used in the place where second invocation of function was done.CREATE ...SELECT FROM
is added too with early call ofha_table_exists
instead fromha_create
.or replace [like]
,if not exists
andlock tables
, have different paths invocation that are different from Path 1, we are leaving theha_table_exists()
call for that cases, without optimization.To optimize
build_table_filename
call is done in Path 1 fromupgrade_lock_if_not_exists
by saving the path and length, that is reused inha_table_exists()
, while there is special handling for views that still need to call the function from withinha_table_exists()
. Optimization is done by eliminating the call for Path 2.replace
orif not exists
ddl that do not use Path 1 but Path2 only, without optimizationCREATE..SELECT
without optimization.Reviewer: [email protected]
Description
How can this PR be tested?
I have tested the PR using debug traces and noted optimization of calls for
CREATE TABLE
inha_table_exists()
, as well asbuild_table_filenames()
by comparing the trace files with/without PR.Here is the test case
Basing the PR against the correct MariaDB version
PR quality check