From: Tor Didriksen Date: January 30 2012 3:47pm Subject: bzr push into mysql-trunk branch (tor.didriksen:3540 to 3541) List-Archive: http://lists.mysql.com/commits/142645 Message-Id: <201201301547.q0UFlvLY027330@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3541 Tor Didriksen 2012-01-30 Shuffle tests around, seems like we need the --exit modified: mysql-test/r/optimizer_debug_sync.result mysql-test/t/optimizer_debug_sync.test 3540 Guilhem Bichot 2012-01-30 Fix for Bug #13637435 ASSERT NAME && !IS_AUTOGENERATED_NAME ON SELECT FROM VIEW WITH OPT_TRACE ENABLED @ mysql-test/t/group_by.test used to crash @ sql/item.cc This assertion was introduced on Jan 10 in guilhem.bichot@stripped . On Jan 13 a first bug was filed, where this assertion was raised by using views (BUG#13591138). It was fixed on Jan 14. On Jan 17 that bug report was reopened, same assertion, when using subqueries. It was fixed on Jan 17. The new bug, Bug#13637435, is for same assertion, with views, and was filed on Jan 28. Three occurences of the same failure in two weeks. It looks like the is_autogenerated_name property is not correctly maintained along the life of Items, especially when it comes to Item_ref and its descendants (Item_direct_view_ref). It is made complex by the fact that Item_ref gets its name sometimes from the item it refers to, sometimes not. For example, Item_ref::Item_ref(..., Item **item) does *not* assign the name of 'item' to the new Item_ref. For example (this is the code involved in the testcase for the present bug), Field_iterator_view::create_item(THD *thd) calls create_view_field(thd, view, &ptr->item, ptr->name, ...); deeper down, this ptr->item and ptr->name are passed as arguments to the constructor of Item_ref: we see that ptr->name is used as name of the new Item_ref, not ptr->item->name... Thus, the name of the new Item_ref is not necessarily the original item's name. Thus, doing in the constructor of Item_ref something like: is_autogenerated_name= (*ref)->is_autogenerated_name, is not guaranteed to be correct. Given that having is_autogenerated_name==true is not necessary for the code in print_for_order() to work, but was rather "a reasonable expectation", I am removing the assertion. It's causing too much extra bugfixing work. If "used_alias" is true, it means the ORDER BY item was resolved to an item of the SELECT list through a user-specified alias, and thus it is guaranteed that this item had such alias. We should consider, as a separate task, reducing the amount of code which depends on is_autogenerated_name. modified: mysql-test/r/group_by.result mysql-test/t/group_by.test sql/item.cc === modified file 'mysql-test/r/optimizer_debug_sync.result' --- a/mysql-test/r/optimizer_debug_sync.result 2012-01-30 13:08:34 +0000 +++ b/mysql-test/r/optimizer_debug_sync.result 2012-01-30 15:47:28 +0000 @@ -1,3 +1,20 @@ +# +# Bug #13536661: VALGRIND: DEFINITELY LOST: 552 BYTES IN 1 BLOCKS IN +# CREATE_TMP_TABLE AND HIGHER +# +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30); +SET debug_sync = "tmp_table_created SIGNAL parked WAIT_FOR go"; +# This should not leak memory. +SELECT b, COUNT(DISTINCT b) FROM t1 GROUP BY b ORDER BY -b; +SET debug_sync = "now WAIT_FOR parked"; +# Set locally to shadow the global variable. +SET debug = ''; +SET GLOBAL debug = '+d,simulate_out_of_memory'; +SET debug_sync = "now SIGNAL go"; +ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space +SET GLOBAL debug = ''; +DROP TABLE t1; BUG#11763382 Assertion 'inited==INDEX' on SELECT MAX(...) @@ -21,21 +38,3 @@ MAX(i) MAX(i) 2 DROP TABLE t; -# End of BUG#56080 -# -# Bug #13536661: VALGRIND: DEFINITELY LOST: 552 BYTES IN 1 BLOCKS IN -# CREATE_TMP_TABLE AND HIGHER -# -CREATE TABLE t1 ( a INT, b INT ); -INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30); -SET debug_sync = "tmp_table_created SIGNAL parked WAIT_FOR go"; -# This should not leak memory. -SELECT b, COUNT(DISTINCT b) FROM t1 GROUP BY b ORDER BY -b; -SET debug_sync = "now WAIT_FOR parked"; -# Set locally to shadow the global variable. -SET debug = ''; -SET GLOBAL debug = '+d,simulate_out_of_memory'; -SET debug_sync = "now SIGNAL go"; -ERROR HY000: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space -SET GLOBAL debug = ''; -DROP TABLE t1; === modified file 'mysql-test/t/optimizer_debug_sync.test' --- a/mysql-test/t/optimizer_debug_sync.test 2012-01-30 13:08:34 +0000 +++ b/mysql-test/t/optimizer_debug_sync.test 2012-01-30 15:47:28 +0000 @@ -5,6 +5,35 @@ --source include/have_innodb.inc --source include/have_materialization.inc +--echo # +--echo # Bug #13536661: VALGRIND: DEFINITELY LOST: 552 BYTES IN 1 BLOCKS IN +--echo # CREATE_TMP_TABLE AND HIGHER +--echo # +CREATE TABLE t1 ( a INT, b INT ); +INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30); + +connect(con1,localhost,root,,); +SET debug_sync = "tmp_table_created SIGNAL parked WAIT_FOR go"; +--echo # This should not leak memory. +send SELECT b, COUNT(DISTINCT b) FROM t1 GROUP BY b ORDER BY -b; + +connection default; +SET debug_sync = "now WAIT_FOR parked"; +--echo # Set locally to shadow the global variable. +SET debug = ''; +SET GLOBAL debug = '+d,simulate_out_of_memory'; + +SET debug_sync = "now SIGNAL go"; + +connection con1; +--error ER_OUT_OF_RESOURCES +reap; +SET GLOBAL debug = ''; + +DROP TABLE t1; +--disconnect con1 +--connection default + --echo --echo BUG#11763382 Assertion 'inited==INDEX' on SELECT MAX(...) --echo @@ -55,38 +84,7 @@ SET DEBUG_SYNC='RESET'; --reap DROP TABLE t; ---disconnect con1 ---disconnect con2 ---disconnect con3 ---connection default ---echo # End of BUG#56080 - ---echo # ---echo # Bug #13536661: VALGRIND: DEFINITELY LOST: 552 BYTES IN 1 BLOCKS IN ---echo # CREATE_TMP_TABLE AND HIGHER ---echo # -CREATE TABLE t1 ( a INT, b INT ); -INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30); - -connect(con1,localhost,root,,); -SET debug_sync = "tmp_table_created SIGNAL parked WAIT_FOR go"; ---echo # This should not leak memory. -send SELECT b, COUNT(DISTINCT b) FROM t1 GROUP BY b ORDER BY -b; - -connection default; -SET debug_sync = "now WAIT_FOR parked"; ---echo # Set locally to shadow the global variable. -SET debug = ''; -SET GLOBAL debug = '+d,simulate_out_of_memory'; +--exit -SET debug_sync = "now SIGNAL go"; - -connection con1; ---error ER_OUT_OF_RESOURCES -reap; -SET GLOBAL debug = ''; - -DROP TABLE t1; ---disconnect con1 ---connection default +--echo # End of BUG#56080 No bundle (reason: useless for push emails).