1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Make trace.add() usage uniform

- Before any multiple add() calls, always use (if trace_started()).
- Add unlikely() around all tests of trace_started().
- Change trace.add(); trace.add(); to trace.add().add();
- When trace.add() goes over several line, use the following formating:
trace.
 add(xxx).
 add(yyy).
 add(zzz);

This format was choosen after a discussion between Sergei Petrunia and
me as it looks similar indepedent if 'trace' is an object or a
pointer. It also more suitable for an editors auto-indentation.

Other things:

Added DBUG_ASSERT(thd->trace_started()) to a few functions that should
only be called if trace is enabled.

"use_roworder_index_merge: true" changed to "use_sort_index_merge: false"
As the original output was often not correct.
Also fixed the related 'cause' to be correct.

In best_access_path() print the cost (and number of rows) before
checking if it the plan should be used. This removes the need to print
the cost in two places.

Changed a few "read_time" tags to "cost".
This commit is contained in:
Monty
2022-01-20 15:49:01 +02:00
committed by Sergei Petrunia
parent ec6aa2829a
commit 766bae2b31
11 changed files with 429 additions and 250 deletions

View File

@@ -698,14 +698,15 @@ void print_keyuse_array_for_trace(THD *thd, DYNAMIC_ARRAY *keyuse_array)
{
keyuse_elem.add("index", keyuse->table->key_info[keyuse->key].name);
}
keyuse_elem.add("field", (keyuse->keypart == FT_KEYPART) ? "<fulltext>":
(keyuse->is_for_hash_join() ?
keyuse->table->field[keyuse->keypart]
->field_name.str :
keyuse->table->key_info[keyuse->key]
.key_part[keyuse->keypart]
.field->field_name.str));
keyuse_elem.add("equals",keyuse->val);
keyuse_elem.add("null_rejecting",keyuse->null_rejecting);
keyuse_elem.
add("field", (keyuse->keypart == FT_KEYPART) ? "<fulltext>":
(keyuse->is_for_hash_join() ?
keyuse->table->field[keyuse->keypart]
->field_name.str :
keyuse->table->key_info[keyuse->key]
.key_part[keyuse->keypart]
.field->field_name.str)).
add("equals",keyuse->val).
add("null_rejecting",keyuse->null_rejecting);
}
}