From: Anitha Gopi Date: July 4 2012 1:17pm Subject: bzr push into mysql-5.6 branch (anitha.gopi:3961 to 3962) List-Archive: http://lists.mysql.com/commits/144370 Message-Id: <20120704131724.3931.16259.3962@vitro82.no.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3962 Anitha Gopi 2012-07-04 Add collections for per push run on release binaries added: mysql-test/collections/mysql-5.6.release 3961 Guilhem Bichot 2012-07-04 Fix for Bug#14238404 CRASH IN ITEM_FIELD::PRINT ON SELECT SUBQUERY WITH OPTIMIZER TRACE ENABLED: if a subquery's items may point to freed Fields of an internal tmp table, don't try printing them. @ internal/mysql-test/suite/i_opt_trace/include because result of new testcase varies between non-ps and ps-protocol (where we trace EXECUTE and so miss the IN->EXISTS transformation done at PREPARE), creating two versions of test, as is already the case in opt_trace suite. @ internal/mysql-test/suite/i_opt_trace/r/bugs_no_prot.result First we have processing of field5 as ORDER BY, which prints IN() entirely, evaluates and cleans up IN(): + "clause_processing": { + "clause": "ORDER BY", + "original_clause": "`field5`", + "items": [ + { + "item": "(/* select#2 */ select `t1`.`col_int_key` from `t1` where (('s','l'),(/* select#3 */ select `c_sq1_alias1`.`col_varchar_key` AS `c_sq1_field1`,sum(`c_sq1_alias1`.`col_varchar_key`) from (`t2` `c_sq1_alias2` left join `t1` `c_sq1_alias1` on((`c_sq1_alias2`.`col_int_key` = `c_sq1_alias1`.`col_int_key`))) group by `c_sq1_field1` having (((('s') = `c_sq1_alias1`.`col_varchar_key`) or isnull(`c_sq1_alias1`.`col_varchar_key`)) and ((('l') = sum(`c_sq1_alias1`.`col_varchar_key`)) or isnull(sum(`c_sq1_alias1`.`col_varchar_key`))) and (`c_sq1_alias1`.`col_varchar_key`) and (sum(`c_sq1_alias1`.`col_varchar_key`))))))", + "subselect_evaluation": [ Then we have processing of field5 as GROUP BY and you can see the effect of the patch: + "clause_processing": { + "clause": "GROUP BY", + "original_clause": "`field5`", + "items": [ + { + "item": "(/* select#2 */ select `t1`.`col_int_key` from `t1` where (('s','l'),(/* select#3 */ select )))", @ sql/sql_lex.cc When in JOIN::optimize() for the top JOIN: /* Optimize distinct away if possible */ { ORDER *org_order= order; order= ORDER_with_src(remove_const(this, order, conds, 1, &simple_order, "ORDER BY"), order.src);; evaluates scalar subquery 'field5' because it is constant. This itself evaluates IN(subquery) because it is constant. IN(subquery) has SUM() and so uses tmp table so changes its fields to tmp table's fields (change_to_use_tmp_fields()). At the end of evaluating scalar subquery, we call JOIN::join_free(), which sets its local variable 'full' to 'true', then calls: sl->cleanup_all_joins(full_local); which calls JOIN::join_free() on IN(subq), full_local==true, this frees tmp table's field. Then, back to JOIN::optimize() for the top JOIN: group_list= ORDER_with_src(remove_const(this, group_list, conds, rollup.state == ROLLUP::STATE_NONE, &simple_group, "GROUP BY"), group_list.src); which prints the scalar subquery which prints IN(subquery) which prints the freed item and thus crashes. Also happens if opt trace is not used but --debug is. Fix: if there is a risk, print a fixed string instead of the entire subquery, which has been printed earlier anyway; we still print the select number for easy cross-referencing. Note that Bug#14168371 was about the same issue in a slightly different execution path, so I am eager to close all similar problems in one go with this patch. added: internal/mysql-test/suite/i_opt_trace/include/ internal/mysql-test/suite/i_opt_trace/r/bugs_ps_prot.result internal/mysql-test/suite/i_opt_trace/t/bugs_no_prot.test internal/mysql-test/suite/i_opt_trace/t/bugs_ps_prot.test renamed: internal/mysql-test/suite/i_opt_trace/r/bugs.result => internal/mysql-test/suite/i_opt_trace/r/bugs_no_prot.result internal/mysql-test/suite/i_opt_trace/t/bugs.test => internal/mysql-test/suite/i_opt_trace/include/bugs.inc modified: sql/sql_lex.cc internal/mysql-test/suite/i_opt_trace/r/bugs_no_prot.result internal/mysql-test/suite/i_opt_trace/include/bugs.inc === added file 'mysql-test/collections/mysql-5.6.release' --- a/mysql-test/collections/mysql-5.6.release 1970-01-01 00:00:00 +0000 +++ b/mysql-test/collections/mysql-5.6.release 2012-07-04 13:15:51 +0000 @@ -0,0 +1,6 @@ +perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=n_mix-debug --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list --unit-tests +perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=main_ps_row-debug --vardir=var-main-ps_row --suite=main --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list +perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=main_embedded-debug --vardir=var-main_emebbed --suite=main --embedded --experimental=collections/default.experimental --skip-ndb +perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=innodb_4k_size-debug --vardir=var-innodb-4k --experimental=collections/default.experimental --skip-ndb --suite=innodb --mysqld=--innodb-page-size=4k +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=partitions-debug --vardir=var-parts --suite=parts +perl mysql-test-run.pl --timer --debug-server --force --parallel=auto --comment=rpl_binlog_n_mix_MTS-debug --vardir=var-mts-rpl-binlog-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --unit-tests --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --suite=rpl No bundle (reason: useless for push emails).