summaryrefslogtreecommitdiff
path: root/sql/sql_test.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2022-01-20 15:49:01 +0200
committerSergei Petrunia <sergey@mariadb.com>2023-02-02 20:53:59 +0300
commit766bae2b3116bb0805e3448dbfcfa892bb6cb707 (patch)
tree41bfb99a2ad9a6975041c27d590dfa8b23a345c6 /sql/sql_test.cc
parentec6aa2829ab88a3cde697c78355b0478ee0ff337 (diff)
downloadmariadb-git-766bae2b3116bb0805e3448dbfcfa892bb6cb707.tar.gz
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".
Diffstat (limited to 'sql/sql_test.cc')
-rw-r--r--sql/sql_test.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/sql/sql_test.cc b/sql/sql_test.cc
index b85b37b1726..f50452a9d6c 100644
--- a/sql/sql_test.cc
+++ b/sql/sql_test.cc
@@ -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);
}
}