diff options
author | Monty <monty@mariadb.org> | 2021-10-06 12:31:19 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2022-07-07 18:52:36 +0300 |
commit | d0b403d238190ec00c1953001584daa4dc04a431 (patch) | |
tree | e156f58a25cdc39da02c39376518861d0bdb8ad2 /sql/opt_trace.cc | |
parent | faa3531d87d0104a902ac315d6bf62ec40dfe99a (diff) | |
download | mariadb-git-d0b403d238190ec00c1953001584daa4dc04a431.tar.gz |
Optimizer code cleanups, no logic changes
- Updated comments
- Added some extra DEBUG
- Indentation changes and break long lines
- Trivial code changes like:
- Combining 2 statements in one
- Reorder DBUG lines
- Use a variable to store a pointer that is used multiple times
- Moved declaration of variables to start of loop/function
- Removed dead or commented code
- Removed wrong DBUG_EXECUTE code in best_extension_by_limited_search()
Diffstat (limited to 'sql/opt_trace.cc')
-rw-r--r-- | sql/opt_trace.cc | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/sql/opt_trace.cc b/sql/opt_trace.cc index 4bc493940fb..a7e8c3da63b 100644 --- a/sql/opt_trace.cc +++ b/sql/opt_trace.cc @@ -568,35 +568,32 @@ void Opt_trace_stmt::set_allowed_mem_size(size_t mem_size) void Json_writer::add_table_name(const JOIN_TAB *tab) { + char table_name_buffer[SAFE_NAME_LEN]; + DBUG_ASSERT(tab != NULL); DBUG_ASSERT(tab->join->thd->trace_started()); - if (tab != NULL) + + if (tab->table && tab->table->derived_select_number) { - char table_name_buffer[SAFE_NAME_LEN]; - if (tab->table && tab->table->derived_select_number) - { - /* Derived table name generation */ - size_t len= my_snprintf(table_name_buffer, sizeof(table_name_buffer)-1, - "<derived%u>", - tab->table->derived_select_number); - add_str(table_name_buffer, len); - } - else if (tab->bush_children) - { - JOIN_TAB *ctab= tab->bush_children->start; - size_t len= my_snprintf(table_name_buffer, - sizeof(table_name_buffer)-1, - "<subquery%d>", - ctab->emb_sj_nest->sj_subq_pred->get_identifier()); - add_str(table_name_buffer, len); - } - else - { - TABLE_LIST *real_table= tab->table->pos_in_table_list; - add_str(real_table->alias.str, real_table->alias.length); - } + /* Derived table name generation */ + size_t len= my_snprintf(table_name_buffer, sizeof(table_name_buffer)-1, + "<derived%u>", + tab->table->derived_select_number); + add_str(table_name_buffer, len); + } + else if (tab->bush_children) + { + JOIN_TAB *ctab= tab->bush_children->start; + size_t len= my_snprintf(table_name_buffer, + sizeof(table_name_buffer)-1, + "<subquery%d>", + ctab->emb_sj_nest->sj_subq_pred->get_identifier()); + add_str(table_name_buffer, len); } else - DBUG_ASSERT(0); + { + TABLE_LIST *real_table= tab->table->pos_in_table_list; + add_str(real_table->alias.str, real_table->alias.length); + } } void Json_writer::add_table_name(const TABLE *table) |