3245 Guilhem Bichot 2011-02-03
Applying review comments (more edits to come).
modified:
sql/opt_trace.cc
sql/opt_trace.h
sql/opt_trace2server.cc
unittest/gunit/opt_trace-t.cc
3244 Guilhem Bichot 2011-01-26
Pulled the entire big commit of Tor's review comments; here doing
additional edits and a few reverts.
modified:
sql/opt_trace.cc
sql/opt_trace.h
sql/opt_trace2server.cc
unittest/gunit/opt_trace-t.cc
3243 Tor Didriksen 2011-01-11
WL#5257 Review comments.
More comments in followup email ...
@ sql/opt_range.cc
@ sql/opt_trace.cc
added:
unittest/gunit/opt_notrace-t.cc
modified:
sql/opt_range.cc
sql/opt_trace.cc
sql/opt_trace.h
sql/opt_trace2server.cc
sql/sys_vars.cc
unittest/gunit/CMakeLists.txt
unittest/gunit/opt_trace-t.cc
3242 Jorgen Loland 2010-12-21
WL#4800:
Revert print_quick() and friends to how they are in
next-mr-opt-backporting, i.e., remove optimizer tracing from
this function since tracing of quick is performed in
TABLE_READ_PLAN::trace_basic_info() instead.
@ WL4800_TODO.txt
Update todo-list
@ sql/opt_range.cc
Revert print_quick() and friends to how they are in next-mr-opt-backporting.
modified:
WL4800_TODO.txt
sql/opt_range.cc
3241 Guilhem Bichot 2010-12-19 [merge]
merge Jorgen's changes
modified:
WL4800_TODO.txt
3240 Guilhem Bichot 2010-12-19
applying review comments. Fix for build failures.
modified:
WL4800_TODO.txt
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/optimizer_trace2.result
mysql-test/t/optimizer_trace2.test
sql/opt_range.cc
sql/opt_trace.h
sql/opt_trace2server.cc
sql/sql_parse.cc
sql/sql_prepare.cc
3239 Guilhem Bichot 2010-12-03
review comments. Fix for a bug with views (testcase will come later,
part of bigger unfinished work).
modified:
sql/opt_trace.h
sql/sql_view.cc
3238 Guilhem Bichot 2010-11-26
making use of sql_command_flags as advised by Davi
modified:
sql/opt_trace2server.cc
sql/sql_class.h
sql/sql_parse.cc
3237 Guilhem Bichot 2010-11-26
Limit optimizer tracing to a certain set of SQL commands (safer).
All other changes in this patch follow from this goal.
@ mysql-test/include/optimizer_trace.inc
* Marks in queries (as /**/ comments )to facilitate understanding results
(exactly identical queries make it hard).
* Comments explaining why results now differ between non-ps and --ps-protocol:
now in ps-protocol, PREPARE and EXECUTE both generate one trace. This wasn't
the case before: this is because PREPARE and EXECUTE, in mysqltest, are
sent via COM_STMT_(PREPARE|EXECUTE), which are handled in dispatch_command():
** COM_STMT_PREPARE never goes through mysql_execute_command() so the
preparation was not traced (now that we trace in check_prepared_statement(),
it is traced)
** COM_STMT_EXECUTE executes the prepared command with mysql_execute_command()
so the execution was traced and is still traced.
@ mysql-test/r/optimizer_trace_no_prot.result
SET is not traced anymore. PREPARE CALL neither (thus we see the trace
of the statement before PREPARE CALL, which is a SELECT).
@ mysql-test/r/optimizer_trace_ps_prot.result
Now that PREPARE SELECT and EXECUTE SELECT
@ mysql-test/t/optimizer_trace2.test
Now that CALL is not traced anymore, the testcase needs to use
a top-statement which is traced (SELECT STORED_FUNC() instead of CALL),
in order to keep the test's intention.
@ sql/opt_trace.h
Updating comments: EXECUTE is not traced anymore, it's the executed statement
which is (one level below, in terms of stack frames...).
@ sql/opt_trace2server.cc
- let opt_trace_start() limit tracing to certain SQL commands
- it sounds like the similar check done in opt_trace_print_expanded_query()
would become unnecessary, but alas no, because sometimes we open tables
before executing the command (see comments).
@ sql/sql_parse.cc
The check on CF_DIAGNOSTIC_STMT is not needed, as opt_trace_start()
now checks sql_command.
@ sql/sql_prepare.cc
To have "PREPARE <command>" be traced only if <command> is in a certain set,
we need to know <command>, which is possible only in check_prepared_statement();
so we:
- don't turn tracing on in mysql_execute_command() when command is SQLCOM_PREPARE
(too early, not enough info)
- check the _to-be-prepared_ command in check_prepared_statement() and decide then.
modified:
mysql-test/include/optimizer_trace.inc
mysql-test/r/optimizer_trace2.result
mysql-test/r/optimizer_trace_no_prot.result
mysql-test/r/optimizer_trace_ps_prot.result
mysql-test/t/optimizer_trace2.test
sql/opt_trace.h
sql/opt_trace2server.cc
sql/sql_parse.cc
sql/sql_prepare.cc
3236 Guilhem Bichot 2010-11-26
Fix for a bug: if a sub-statement shouldn't be traced but is inside a traced
top-statement, the sub-statement's trace structures would be included
inside the top-statement's trace instead of being invisible.
@ mysql-test/r/optimizer_trace2.result
Without the code fix, the trace of CALL would contain the trace
of "select TRACE+NULL..." even though the latter one uses
OPTIMIZER_TRACE (which shouldn't be traced).
@ sql/opt_trace2server.cc
Fix for the bug. The "allocated_here" part is for another bug (which
could happen if running out of memory): we should free opt_trace
only if we allocated it in this frame.
added:
mysql-test/r/optimizer_trace2.result
mysql-test/t/optimizer_trace2.test
modified:
sql/opt_trace2server.cc
3235 Guilhem Bichot 2010-11-24
Implementing some TODOs:
- renamed add_str*() and reviewed all calls of it
- fixed "database"/"table" printouts in the trace (more uniform now)
- test trace when the view/table/column/index' name contains \n and \t
- added add_null()
Misc: removed redundant "constant_tables" array. Fixed bug in detecting
duplicate consecutive keys in a trace object.
@ WL4800_TODO.txt
deleting TODOs, adding others agreed during reviews
@ mysql-test/r/optimizer_trace_no_prot.result
"constant_tables" removed
@ mysql-test/r/optimizer_trace_ps_prot.result
"constant_tables" removed
@ mysql-test/r/optimizer_trace_range.result
escaping is done on the range now, gives correct trace
@ mysql-test/t/optimizer_trace_charset.test
* to check the validity of a trace, better get it in utf8 (that's what
Python's json module wants) => "set names utf8"
* test of \n and \t in view/table/column/index name
@ sql/opt_range.cc
add_alnum/add_utf8. add_null.
@ sql/opt_trace.cc
add_alnum/add_utf8. strcmp() was not detecting the case where
the key is identical to the previous key but longer than sizeof(previous_key)
(different length of previous_key and key made the equality false).
@ sql/opt_trace.h
add_str() renamed to add_alnum(). add_str_escaped() renamed to add_utf8().
add_null() is added.
A macro to avoid repeating this more than 10 times:
trace_object.add_utf8("database", ...->s->db.str, ...->s->db.length)
.add_utf8("table", ...->alias).
@ sql/opt_trace2server.cc
add_alnum/add_utf8
@ sql/sql_delete.cc
add_alnum/add_utf8.
@ sql/sql_select.cc
add_alnum/add_utf8. There were different sources used for finding the
database and name of a table, here we standardize on TABLE::TABLE_SHARE::db
and TABLE::alias. 'alias' is better than 'table_name' because in
a query which uses the same table twice, the 'alias' is more unique.
The old code also had a problem: sometimes it used the database
of the first table of the join (s->join->tables_list->db) which
may be wrong in a cross-database join.
The "constant_tables" array is removed because it is redundant: constant
tables are already listed in "records_estimation" with a mention of
"const" or "system". Thus a big code block is re-indented.
@ sql/sql_test.cc
add_alnum/add_utf8.
@ sql/sql_update.cc
add_alnum/add_utf8.
@ sql/sql_view.cc
add_alnum/add_utf8. "database" instead of "db"; "view" instead of "name";
this is to be symmetric of the "database"/"table" pair found in
traces in sql_select.cc
@ unittest/gunit/opt_trace-t.cc
add_alnum/add_utf8.
modified:
WL4800_TODO.txt
mysql-test/r/optimizer_trace_charset.result
mysql-test/r/optimizer_trace_no_prot.result
mysql-test/r/optimizer_trace_ps_prot.result
mysql-test/r/optimizer_trace_range.result
mysql-test/t/optimizer_trace_charset.test
sql/opt_range.cc
sql/opt_trace.cc
sql/opt_trace.h
sql/opt_trace2server.cc
sql/sql_delete.cc
sql/sql_select.cc
sql/sql_test.cc
sql/sql_update.cc
sql/sql_view.cc
unittest/gunit/opt_trace-t.cc
3234 Guilhem Bichot 2010-11-23 [merge]
merge of WL#5594 "tracing for range optimizer" into tree of WL#4800 "optimizer trace"
removed:
mysql-test/suite/ndb/r/optimizer_trace_range_opt_bug.result
mysql-test/suite/ndb/t/optimizer_trace_range_opt_bug.test
added:
mysql-test/r/optimizer_trace_range.result
mysql-test/t/optimizer_trace_range.test
modified:
WL4800_TODO.txt
mysql-test/include/optimizer_trace.inc
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/optimizer_trace_charset.result
mysql-test/r/optimizer_trace_no_prot.result
mysql-test/r/optimizer_trace_ps_prot.result
mysql-test/suite/sys_vars/r/optimizer_trace_features_basic.result
mysql-test/t/optimizer_trace_charset.test
sql/handler.cc
sql/opt_range.cc
sql/opt_range.h
sql/opt_trace.cc
sql/opt_trace.h
sql/opt_trace2server.cc
sql/sql_delete.cc
sql/sql_help.cc
sql/sql_select.cc
sql/sql_update.cc
sql/sys_vars.cc
3233 Guilhem Bichot 2010-11-15
Review comments
@ WL4800_TODO.txt
remove done stuff, adding a few more
@ WL4800_validate_json.py
Put a mark ('&') near the first syntax error found by this script
@ mysql-test/include/optimizer_trace.inc
"misc" is not available to the user now. Test for a query longer than
1024 chars.
@ mysql-test/suite/sys_vars/r/optimizer_trace_features_basic.result
"misc" is not available to the user now
@ sql/opt_trace.cc
- making the ALIGN_SIZE(1) trick hopefully clearer, by rewriting code
and adding comments
- making "misc" not available to the user: "misc" structures
are now always enabled, cannot be disabled.
- escaping was not complete: it didn't handle all of the ASCII 0-31
range; now we still escape "common special characters" with the
short escaping form (like: \n) if they support one, and escape
the less-common special characters with \uXXXX. The short escaping
form is more readable which is why we use it instead of \uXXXX.
@ sql/opt_trace.h
Features select-able by the user start at 1 in the enum
(that's a constraint of the system variables system)
so we move "misc" to the enum's end.
Comments, alignment.
@ sql/sys_vars.cc
"misc" is not available to the user now
@ unittest/gunit/opt_trace-t.cc
- test add_str() with explicit string length
- function which checks JSON compliance (not needed for the test,
just a helper)
- test escaping of utf8 characters in the trace, as required by JSON
- test handling of non-utf8 characters in the trace
modified:
WL4800_TODO.txt
WL4800_validate_json.py
mysql-test/include/optimizer_trace.inc
mysql-test/r/optimizer_trace_no_prot.result
mysql-test/r/optimizer_trace_ps_prot.result
mysql-test/suite/sys_vars/r/optimizer_trace_features_basic.result
sql/opt_trace.cc
sql/opt_trace.h
sql/opt_trace2server.cc
sql/sys_vars.cc
unittest/gunit/opt_trace-t.cc
3232 Guilhem Bichot 2010-11-06
Adding a way to explicitely end a structure (exception to RAII).
Using it to avoid opening a scope which in turn forces
some massive re-indentation (in JOIN::optimize(), in mysql_execute_command()).
@ mysql-test/include/optimizer_trace.inc
test for bug reported by JorgenL long ago.
@ sql/opt_trace.cc
when ending an object, set 'started' to false. This avoids that the destructor
tries to destroy a structure on which we have already called 'end()'.
@ sql/opt_trace.h
Adding end()
@ sql/sql_parse.cc
removing badly indented scope, thanks to end().
@ sql/sql_select.cc
reverting to code of main tree: removal of JOIN::optimize_steps();
it had been introduced to have an additional scope for trace structures.
With end() it's not needed anymore.
modified:
mysql-test/include/optimizer_trace.inc
mysql-test/r/optimizer_trace_no_prot.result
mysql-test/r/optimizer_trace_ps_prot.result
sql/opt_trace.cc
sql/opt_trace.h
sql/sql_parse.cc
sql/sql_select.cc
sql/sql_select.h
3231 Guilhem Bichot 2010-11-05
review comments
modified:
WL4800_TODO.txt
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
sql/opt_trace.cc
sql/opt_trace.h
sql/sys_vars.cc
3230 Guilhem Bichot 2010-10-23
fix for test failure on Windows
modified:
mysql-test/include/optimizer_trace.inc
mysql-test/r/optimizer_trace_no_prot.result
mysql-test/r/optimizer_trace_ps_prot.result
Diff too large for email (21075 lines, the limit is 10000).
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-next-mr-bugfixing branch (guilhem.bichot:3230 to 3245) | Guilhem Bichot | 3 Feb |