From: Marc Alff Date: February 2 2012 9:47am Subject: bzr push into mysql-trunk-wl5259 branch (marc.alff:3368 to 3369) List-Archive: http://lists.mysql.com/commits/142706 Message-Id: <201202020947.q129lokj025965@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3369 Marc Alff 2012-02-02 [merge] Merge mysql-trunk --> mysql-trunk-wl5259 removed: include/byteorder/ renamed: include/byteorder/big_endian.h => include/big_endian.h include/byteorder/byte_order_generic.h => include/byte_order_generic.h include/byteorder/byte_order_generic_x86.h => include/byte_order_generic_x86.h include/byteorder/byte_order_generic_x86_64.h => include/byte_order_generic_x86_64.h include/byteorder/little_endian.h => include/little_endian.h modified: include/CMakeLists.txt include/my_byteorder.h mysql-test/collections/default.daily mysql-test/collections/default.experimental mysql-test/include/icp_tests.inc mysql-test/include/order_by.inc mysql-test/r/innodb_icp.result mysql-test/r/innodb_icp_all.result mysql-test/r/innodb_icp_none.result mysql-test/r/join_cache_nojb.result mysql-test/r/myisam_icp.result mysql-test/r/myisam_icp_all.result mysql-test/r/myisam_icp_none.result mysql-test/r/optimizer_debug_sync.result mysql-test/r/order_by_all.result mysql-test/r/order_by_icp_mrr.result mysql-test/r/order_by_none.result mysql-test/t/optimizer_debug_sync.test sql/sql_select.cc storage/innobase/ibuf/ibuf0ibuf.cc storage/innobase/include/univ.i 3368 Marc Alff 2012-02-01 [merge] Merge mysql-trunk --> mysql-trunk-wl5259 added: mysql-test/include/function_defaults.inc mysql-test/include/function_defaults_notembedded.inc mysql-test/include/libdaemon_example.ini mysql-test/r/function_defaults.result mysql-test/r/function_defaults_notembedded.result mysql-test/std_data/onerow.xml mysql-test/suite/rpl/r/rpl_function_defaults.result mysql-test/suite/rpl/t/rpl_function_defaults.test mysql-test/t/function_defaults.test mysql-test/t/function_defaults_notembedded.test mysql-test/wl5874_updown sql/delayable_insert_operation.h unittest/gunit/copy_info-t.cc unittest/gunit/create_field-t.cc unittest/gunit/delayable_insert_operation-t.cc unittest/gunit/fake_table.h unittest/gunit/field_timestamp-t.cc unittest/gunit/item_func_now_local-t.cc unittest/gunit/mock_create_field.h unittest/gunit/mock_field_datetime.h unittest/gunit/mock_field_timestamp.h unittest/gunit/mock_field_timestampf.h unittest/gunit/sql_table-t.cc modified: client/mysql_plugin.c include/my_bitmap.h mysql-test/collections/default.daily mysql-test/collections/default.weekly mysql-test/include/subquery_sj.inc mysql-test/r/change_user.result mysql-test/r/create.result mysql-test/r/derived.result mysql-test/r/func_in_all.result mysql-test/r/group_by.result mysql-test/r/group_min_max.result mysql-test/r/index_merge_myisam.result mysql-test/r/innodb_icp_all.result mysql-test/r/innodb_mrr_all.result mysql-test/r/innodb_mrr_cost_all.result mysql-test/r/join_cache_bka.result mysql-test/r/join_cache_bka_nixbnl.result mysql-test/r/join_cache_bkaunique.result mysql-test/r/join_cache_bnl.result mysql-test/r/join_cache_nojb.result mysql-test/r/myisam_explain_non_select_all.result mysql-test/r/mysql_plugin.result mysql-test/r/mysqld--help-notwin.result mysql-test/r/mysqld--help-win.result mysql-test/r/mysqldump.result mysql-test/r/optimizer_debug_sync.result mysql-test/r/order_by_all.result mysql-test/r/subquery_all.result mysql-test/r/subquery_all_bka.result mysql-test/r/subquery_mat.result mysql-test/r/subquery_mat_none.result mysql-test/r/subquery_sj_all.result mysql-test/r/subquery_sj_all_bka.result mysql-test/r/subquery_sj_all_bka_nixbnl.result mysql-test/r/subquery_sj_all_bkaunique.result mysql-test/r/subquery_sj_dupsweed.result mysql-test/r/subquery_sj_dupsweed_bka.result mysql-test/r/subquery_sj_dupsweed_bka_nixbnl.result mysql-test/r/subquery_sj_dupsweed_bkaunique.result mysql-test/r/subquery_sj_firstmatch.result mysql-test/r/subquery_sj_firstmatch_bka.result mysql-test/r/subquery_sj_firstmatch_bka_nixbnl.result mysql-test/r/subquery_sj_firstmatch_bkaunique.result mysql-test/r/subquery_sj_loosescan.result mysql-test/r/subquery_sj_loosescan_bka.result mysql-test/r/subquery_sj_loosescan_bka_nixbnl.result mysql-test/r/subquery_sj_loosescan_bkaunique.result mysql-test/r/subquery_sj_mat.result mysql-test/r/subquery_sj_mat_bka.result mysql-test/r/subquery_sj_mat_bka_nixbnl.result mysql-test/r/subquery_sj_mat_bkaunique.result mysql-test/r/subquery_sj_mat_nosj.result mysql-test/r/subquery_sj_none.result mysql-test/r/subquery_sj_none_bka.result mysql-test/r/subquery_sj_none_bka_nixbnl.result mysql-test/r/subquery_sj_none_bkaunique.result mysql-test/r/subselect_innodb.result mysql-test/r/type_temporal_fractional.result mysql-test/r/type_timestamp.result mysql-test/suite/innodb/r/innodb_mysql.result mysql-test/suite/opt_trace/r/bugs_no_prot_all.result mysql-test/suite/opt_trace/r/bugs_ps_prot_all.result mysql-test/suite/sys_vars/r/optimizer_switch_basic.result mysql-test/t/change_user.test mysql-test/t/create.test mysql-test/t/group_by.test mysql-test/t/mysql_plugin.test mysql-test/t/mysqldump.test mysql-test/t/optimizer_debug_sync.test mysql-test/t/type_temporal_fractional.test mysql-test/t/type_timestamp.test mysys/my_bitmap.c sql/event_db_repository.cc sql/field.cc sql/field.h sql/field_conv.cc sql/ha_ndbcluster.cc sql/ha_partition.cc sql/item.cc sql/item.h sql/item_timefunc.cc sql/item_timefunc.h sql/log_event.cc sql/log_event_old.cc sql/rpl_info_table.cc sql/sp.cc sql/sp_head.cc sql/sql_base.cc sql/sql_class.cc sql/sql_class.h sql/sql_executor.cc sql/sql_insert.cc sql/sql_insert.h sql/sql_load.cc sql/sql_parse.cc sql/sql_partition.cc sql/sql_priv.h sql/sql_show.cc sql/sql_table.cc sql/sql_table.h sql/sql_update.cc sql/table.cc sql/table.h sql/unireg.cc storage/archive/ha_archive.cc storage/csv/ha_tina.cc storage/example/ha_example.cc storage/federated/ha_federated.cc storage/heap/ha_heap.cc storage/innobase/fil/fil0fil.cc storage/innobase/handler/ha_innodb.cc storage/myisam/ha_myisam.cc storage/myisammrg/ha_myisammrg.cc unittest/gunit/CMakeLists.txt === modified file 'include/CMakeLists.txt' --- a/include/CMakeLists.txt 2012-01-11 09:33:52 +0000 +++ b/include/CMakeLists.txt 2012-02-01 08:31:03 +0000 @@ -56,10 +56,11 @@ SET(HEADERS my_compiler.h mysql_com_server.h my_byteorder.h - byteorder/byte_order_generic_x86.h - byteorder/little_endian.h - byteorder/byte_order_generic.h - byteorder/big_endian.h + byte_order_generic.h + byte_order_generic_x86.h + byte_order_generic_x86_64.h + little_endian.h + big_endian.h ${HEADERS_GEN_CONFIGURE} ) === renamed file 'include/byteorder/big_endian.h' => 'include/big_endian.h' === renamed file 'include/byteorder/byte_order_generic.h' => 'include/byte_order_generic.h' === renamed file 'include/byteorder/byte_order_generic_x86.h' => 'include/byte_order_generic_x86.h' === renamed file 'include/byteorder/byte_order_generic_x86_64.h' => 'include/byte_order_generic_x86_64.h' === removed directory 'include/byteorder' === renamed file 'include/byteorder/little_endian.h' => 'include/little_endian.h' === modified file 'include/my_byteorder.h' --- a/include/my_byteorder.h 2012-01-11 09:33:52 +0000 +++ b/include/my_byteorder.h 2012-02-01 08:31:03 +0000 @@ -33,11 +33,11 @@ */ #if defined(__i386__) || defined(_WIN32) #define MY_BYTE_ORDER_ARCH_OPTIMIZED -#include "byteorder/byte_order_generic_x86.h" +#include "byte_order_generic_x86.h" #elif defined(__x86_64__) -#include "byteorder/byte_order_generic_x86_64.h" +#include "byte_order_generic_x86_64.h" #else -#include "byteorder/byte_order_generic.h" +#include "byte_order_generic.h" #endif /* @@ -46,9 +46,9 @@ a register) and M a pointer to byte. */ #ifdef WORDS_BIGENDIAN -#include "byteorder/big_endian.h" +#include "big_endian.h" #else -#include "byteorder/little_endian.h" +#include "little_endian.h" #endif #endif /* MY_BYTEORDER_INCLUDED */ === modified file 'mysql-test/collections/default.daily' --- a/mysql-test/collections/default.daily 2012-02-01 06:03:43 +0000 +++ b/mysql-test/collections/default.daily 2012-02-02 04:38:55 +0000 @@ -33,3 +33,5 @@ perl mysql-test-run.pl --timer --force - perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-mixed-tests-myisam-engine-debug --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-myisam-engine-debug --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-daily.list perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-row-tests-innodb-engine-debug --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-innodb-engine-debug --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=row --skip-test-list=collections/disabled-daily.list perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-mixed-tests-innodb-engine-debug --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-innodb-engine-debug --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-tests-myisam-engine-debug --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-myisam-engine-debug --suite=engines/iuds,engines/funcs --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-tests-innodb-engine-debug --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-innodb-engine-debug --suite=engines/iuds,engines/funcs --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --skip-test-list=collections/disabled-daily.list === modified file 'mysql-test/collections/default.experimental' --- a/mysql-test/collections/default.experimental 2012-01-12 13:22:52 +0000 +++ b/mysql-test/collections/default.experimental 2012-02-01 08:59:14 +0000 @@ -9,10 +9,39 @@ main.func_math @freebsd main.mysqlslap @windows # Bug#11761520 2010-08-10 alik mysqlslap fails sporadically starting from Dahlia main.signal_demo3 @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun main.sp @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -main.subquery_sj_none @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -main.subquery_sj_none_bka @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrunbzr rename -main.subquery_sj_none_bkaunique @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun -main.subquery_sj_none_bka_nixbnl @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun +main.subquery_sj_all_bka_nixbnl @solaris +main.subquery_sj_all_bka @solaris +main.subquery_sj_all_bkaunique @solaris +main.subquery_sj_all @solaris +main.subquery_sj_dupsweed_bka_nixbnl @solaris +main.subquery_sj_dupsweed_bka @solaris +main.subquery_sj_dupsweed_bkaunique @solaris +main.subquery_sj_dupsweed @solaris +main.subquery_sj_firstmatch_bka_nixbnl @solaris +main.subquery_sj_firstmatch_bka @solaris +main.subquery_sj_firstmatch_bkaunique @solaris +main.subquery_sj_firstmatch @solaris +main.subquery_sj_innodb_all_bka_nixbnl @solaris +main.subquery_sj_innodb_all_bka @solaris +main.subquery_sj_innodb_all_bkaunique @solaris +main.subquery_sj_innodb_all @solaris +main.subquery_sj_innodb_none_bka_nixbnl @solaris +main.subquery_sj_innodb_none_bka @solaris +main.subquery_sj_innodb_none_bkaunique @solaris +main.subquery_sj_innodb_none @solaris +main.subquery_sj_loosescan_bka_nixbnl @solaris +main.subquery_sj_loosescan_bka @solaris +main.subquery_sj_loosescan_bkaunique @solaris +main.subquery_sj_loosescan @solaris +main.subquery_sj_mat_bka_nixbnl @solaris +main.subquery_sj_mat_bka @solaris +main.subquery_sj_mat_bkaunique @solaris +main.subquery_sj_mat_nosj @solaris +main.subquery_sj_mat @solaris +main.subquery_sj_none_bka_nixbnl @solaris +main.subquery_sj_none_bka @solaris +main.subquery_sj_none_bkaunique @solaris +main.subquery_sj_none @solaris main.kill @freebsd # Bug#12619719 2011-08-04 Occasional failure in PB2 innodb.innodb_monitor # Bug#12320827 2011-08-04 Occasional failure in PB2 === modified file 'mysql-test/include/icp_tests.inc' --- a/mysql-test/include/icp_tests.inc 2011-10-05 13:16:38 +0000 +++ b/mysql-test/include/icp_tests.inc 2012-02-01 09:59:13 +0000 @@ -1043,7 +1043,7 @@ INSERT INTO t2 VALUES (0,9),(3,10),(4,6) let $query= SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; === modified file 'mysql-test/include/order_by.inc' --- a/mysql-test/include/order_by.inc 2012-01-25 14:52:00 +0000 +++ b/mysql-test/include/order_by.inc 2012-02-01 09:59:13 +0000 @@ -1781,3 +1781,33 @@ SELECT c FROM t1 WHERE a=2 AND (c=10 OR SELECT c FROM t1 WHERE a=2 AND (c=10 OR c IS NULL) ORDER BY c DESC; DROP TABLE t1; + +--echo # +--echo # Bug #13528826 +--echo # TEST_IF_CHEAPER_ORDERING(): CALCULATES INCORRECT 'SELECT_LIMIT' +--echo # +--echo # + +CREATE TABLE t1(a int PRIMARY KEY, b int) ENGINE=myisam; +INSERT INTO t1 VALUES + (5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60); +CREATE TABLE t2 (p int, a int, INDEX i_a(a)) ENGINE=myisam; +INSERT INTO t2 VALUES + (103, 7), (109, 3), (102, 3), (108, 1), (106, 3), + (107, 7), (105, 1), (101, 3), (100, 7), (110, 1); + +--echo # number of rows in t1 was incorrectly used as an +--echo # implicit limit-clause if not explicit specified +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a; + +--echo # Query above used to be explained identical to this: +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 8; + +-- echo # A really high limit was required to give the correct explain +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 1000; + +DROP TABLE t1, t2; + === modified file 'mysql-test/r/innodb_icp.result' --- a/mysql-test/r/innodb_icp.result 2012-01-25 12:45:56 +0000 +++ b/mysql-test/r/innodb_icp.result 2012-02-01 09:59:13 +0000 @@ -988,14 +988,14 @@ INSERT INTO t2 VALUES (0,9),(3,10),(4,6) set @old_opt_switch=@@optimizer_switch; SET optimizer_switch="block_nested_loop=off"; EXPLAIN SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,col_int_key col_int_key 5 NULL 5 Using where; Using index +1 SIMPLE t2 range col_int_key col_int_key 5 NULL 5 Using where; Using index 1 SIMPLE t1 index NULL col_int_key 5 NULL 4 Using index SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; field1 === modified file 'mysql-test/r/innodb_icp_all.result' --- a/mysql-test/r/innodb_icp_all.result 2012-01-30 13:08:34 +0000 +++ b/mysql-test/r/innodb_icp_all.result 2012-02-01 09:59:13 +0000 @@ -988,14 +988,14 @@ INSERT INTO t2 VALUES (0,9),(3,10),(4,6) set @old_opt_switch=@@optimizer_switch; SET optimizer_switch="block_nested_loop=off"; EXPLAIN SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,col_int_key col_int_key 5 NULL 5 Using where; Using index +1 SIMPLE t2 range col_int_key col_int_key 5 NULL 5 Using where; Using index 1 SIMPLE t1 index NULL col_int_key 5 NULL 4 Using index SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; field1 === modified file 'mysql-test/r/innodb_icp_none.result' --- a/mysql-test/r/innodb_icp_none.result 2012-01-25 12:45:56 +0000 +++ b/mysql-test/r/innodb_icp_none.result 2012-02-01 09:59:13 +0000 @@ -987,14 +987,14 @@ INSERT INTO t2 VALUES (0,9),(3,10),(4,6) set @old_opt_switch=@@optimizer_switch; SET optimizer_switch="block_nested_loop=off"; EXPLAIN SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range PRIMARY,col_int_key col_int_key 5 NULL 5 Using where; Using index +1 SIMPLE t2 range col_int_key col_int_key 5 NULL 5 Using where; Using index 1 SIMPLE t1 index NULL col_int_key 5 NULL 4 Using index SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; field1 === modified file 'mysql-test/r/join_cache_nojb.result' --- a/mysql-test/r/join_cache_nojb.result 2012-01-30 13:13:15 +0000 +++ b/mysql-test/r/join_cache_nojb.result 2012-02-01 09:59:13 +0000 @@ -1445,7 +1445,7 @@ explain select t1.a, count(t2.p) as count from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index 1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using where select t1.a, count(t2.p) as count from t1 left join t2 on t1.a=t2.a and t2.p % 2 = 1 group by t1.a; === modified file 'mysql-test/r/myisam_icp.result' --- a/mysql-test/r/myisam_icp.result 2012-01-03 11:04:14 +0000 +++ b/mysql-test/r/myisam_icp.result 2012-02-01 09:59:13 +0000 @@ -983,14 +983,14 @@ INSERT INTO t2 VALUES (0,9),(3,10),(4,6) set @old_opt_switch=@@optimizer_switch; SET optimizer_switch="block_nested_loop=off"; EXPLAIN SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index; Using temporary; Using filesort -1 SIMPLE t2 ALL PRIMARY,col_int_key NULL NULL NULL 6 Using where +1 SIMPLE t2 ALL col_int_key NULL NULL NULL 6 Using where; Using temporary; Using filesort +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; field1 === modified file 'mysql-test/r/myisam_icp_all.result' --- a/mysql-test/r/myisam_icp_all.result 2012-01-03 11:04:14 +0000 +++ b/mysql-test/r/myisam_icp_all.result 2012-02-01 09:59:13 +0000 @@ -983,14 +983,14 @@ INSERT INTO t2 VALUES (0,9),(3,10),(4,6) set @old_opt_switch=@@optimizer_switch; SET optimizer_switch="block_nested_loop=off"; EXPLAIN SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index; Using temporary; Using filesort -1 SIMPLE t2 ALL PRIMARY,col_int_key NULL NULL NULL 6 Using where +1 SIMPLE t2 ALL col_int_key NULL NULL NULL 6 Using where; Using temporary; Using filesort +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; field1 === modified file 'mysql-test/r/myisam_icp_none.result' --- a/mysql-test/r/myisam_icp_none.result 2012-01-03 11:04:14 +0000 +++ b/mysql-test/r/myisam_icp_none.result 2012-02-01 09:59:13 +0000 @@ -982,14 +982,14 @@ INSERT INTO t2 VALUES (0,9),(3,10),(4,6) set @old_opt_switch=@@optimizer_switch; SET optimizer_switch="block_nested_loop=off"; EXPLAIN SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index; Using temporary; Using filesort -1 SIMPLE t2 ALL PRIMARY,col_int_key NULL NULL NULL 6 Using where +1 SIMPLE t2 ALL col_int_key NULL NULL NULL 6 Using where; Using temporary; Using filesort +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index SELECT t2.col_int_key AS field1 -FROM t2 JOIN t1 ON t2.col_int_key +FROM t2 USE INDEX(col_int_key) STRAIGHT_JOIN t1 ON t2.col_int_key WHERE t2.pk < 7 AND t2.col_int_key <> 7 GROUP BY field1; field1 === modified file 'mysql-test/r/optimizer_debug_sync.result' --- a/mysql-test/r/optimizer_debug_sync.result 2012-01-31 06:42:46 +0000 +++ b/mysql-test/r/optimizer_debug_sync.result 2012-02-01 08:32:05 +0000 @@ -21,3 +21,21 @@ 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/r/order_by_all.result' --- a/mysql-test/r/order_by_all.result 2012-01-30 13:08:34 +0000 +++ b/mysql-test/r/order_by_all.result 2012-02-01 09:59:13 +0000 @@ -2639,4 +2639,36 @@ c 10 NULL DROP TABLE t1; +# +# Bug #13528826 +# TEST_IF_CHEAPER_ORDERING(): CALCULATES INCORRECT 'SELECT_LIMIT' +# +# +CREATE TABLE t1(a int PRIMARY KEY, b int) ENGINE=myisam; +INSERT INTO t1 VALUES +(5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60); +CREATE TABLE t2 (p int, a int, INDEX i_a(a)) ENGINE=myisam; +INSERT INTO t2 VALUES +(103, 7), (109, 3), (102, 3), (108, 1), (106, 3), +(107, 7), (105, 1), (101, 3), (100, 7), (110, 1); +# number of rows in t1 was incorrectly used as an +# implicit limit-clause if not explicit specified +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +# Query above used to be explained identical to this: +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 8; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +# A really high limit was required to give the correct explain +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 1000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +DROP TABLE t1, t2; set optimizer_switch=default; === modified file 'mysql-test/r/order_by_icp_mrr.result' --- a/mysql-test/r/order_by_icp_mrr.result 2012-01-25 14:52:00 +0000 +++ b/mysql-test/r/order_by_icp_mrr.result 2012-02-01 09:59:13 +0000 @@ -2639,4 +2639,36 @@ c 10 NULL DROP TABLE t1; +# +# Bug #13528826 +# TEST_IF_CHEAPER_ORDERING(): CALCULATES INCORRECT 'SELECT_LIMIT' +# +# +CREATE TABLE t1(a int PRIMARY KEY, b int) ENGINE=myisam; +INSERT INTO t1 VALUES +(5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60); +CREATE TABLE t2 (p int, a int, INDEX i_a(a)) ENGINE=myisam; +INSERT INTO t2 VALUES +(103, 7), (109, 3), (102, 3), (108, 1), (106, 3), +(107, 7), (105, 1), (101, 3), (100, 7), (110, 1); +# number of rows in t1 was incorrectly used as an +# implicit limit-clause if not explicit specified +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +# Query above used to be explained identical to this: +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 8; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +# A really high limit was required to give the correct explain +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 1000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +DROP TABLE t1, t2; set optimizer_switch=default; === modified file 'mysql-test/r/order_by_none.result' --- a/mysql-test/r/order_by_none.result 2012-01-25 14:52:00 +0000 +++ b/mysql-test/r/order_by_none.result 2012-02-01 09:59:13 +0000 @@ -2638,4 +2638,36 @@ c 10 NULL DROP TABLE t1; +# +# Bug #13528826 +# TEST_IF_CHEAPER_ORDERING(): CALCULATES INCORRECT 'SELECT_LIMIT' +# +# +CREATE TABLE t1(a int PRIMARY KEY, b int) ENGINE=myisam; +INSERT INTO t1 VALUES +(5, 10), (2, 70), (7, 80), (6, 20), (1, 50), (9, 40), (8, 30), (3, 60); +CREATE TABLE t2 (p int, a int, INDEX i_a(a)) ENGINE=myisam; +INSERT INTO t2 VALUES +(103, 7), (109, 3), (102, 3), (108, 1), (106, 3), +(107, 7), (105, 1), (101, 3), (100, 7), (110, 1); +# number of rows in t1 was incorrectly used as an +# implicit limit-clause if not explicit specified +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +# Query above used to be explained identical to this: +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 8; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +# A really high limit was required to give the correct explain +EXPLAIN +SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 1000; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 8 Using index +1 SIMPLE t2 ref i_a i_a 5 test.t1.a 2 Using index +DROP TABLE t1, t2; set optimizer_switch=default; === modified file 'mysql-test/t/optimizer_debug_sync.test' --- a/mysql-test/t/optimizer_debug_sync.test 2012-01-31 06:42:46 +0000 +++ b/mysql-test/t/optimizer_debug_sync.test 2012-02-01 08:32:05 +0000 @@ -4,6 +4,7 @@ --source include/have_debug_sync.inc --source include/have_innodb.inc --source include/have_materialization.inc +--source include/not_embedded.inc --echo --echo BUG#11763382 Assertion 'inited==INDEX' on SELECT MAX(...) @@ -54,9 +55,12 @@ SET DEBUG_SYNC='RESET'; --connection con3 --reap +--connection default DROP TABLE t; +--disconnect con1 +--disconnect con2 +--disconnect con3 ---exit --echo # End of BUG#56080 --echo # === modified file 'sql/sql_select.cc' --- a/sql/sql_select.cc 2012-01-31 07:45:59 +0000 +++ b/sql/sql_select.cc 2012-02-01 09:59:13 +0000 @@ -4684,7 +4684,7 @@ bool JOIN::change_result(select_result * @param ref_key * 0 <= key < MAX_KEY - key number (hint) to start the search * -1 - no key number provided - @param select_limit LIMIT value + @param select_limit LIMIT value, or HA_POS_ERROR if no limit @param [out] new_key Key number if success, otherwise undefined @param [out] new_key_direction Return -1 (reverse) or +1 if success, otherwise undefined @@ -4732,6 +4732,7 @@ test_if_cheaper_ordering(const JOIN_TAB ha_rows table_records= table->file->stats.records; bool group= join && join->group && order == join->group_list; ha_rows ref_key_quick_rows= HA_POS_ERROR; + const bool has_limit= (select_limit != HA_POS_ERROR); /* If not used with LIMIT, only use keys if the whole query can be @@ -4824,7 +4825,7 @@ test_if_cheaper_ordering(const JOIN_TAB be included into the result set. */ if (select_limit > table_records/rec_per_key) - select_limit= table_records; + select_limit= table_records; else select_limit= (ha_rows) (select_limit*rec_per_key); } @@ -4905,7 +4906,7 @@ test_if_cheaper_ordering(const JOIN_TAB *new_key= best_key; *new_key_direction= best_key_direction; - *new_select_limit= best_select_limit; + *new_select_limit= has_limit ? best_select_limit : table_records; if (new_used_key_parts != NULL) *new_used_key_parts= best_key_parts; === modified file 'storage/innobase/ibuf/ibuf0ibuf.cc' --- a/storage/innobase/ibuf/ibuf0ibuf.cc 2012-01-26 12:31:26 +0000 +++ b/storage/innobase/ibuf/ibuf0ibuf.cc 2012-02-01 20:59:15 +0000 @@ -2423,7 +2423,8 @@ ibuf_get_merge_page_nos_func( smallest possible secondary index leaf page (and that only after DROP INDEX). */ ut_ad(rec_page_no - > IBUF_TREE_ROOT_PAGE_NO - (rec_space_id != 0)); + > (ulint) IBUF_TREE_ROOT_PAGE_NO + - (rec_space_id != 0)); } #ifdef UNIV_IBUF_DEBUG === modified file 'storage/innobase/include/univ.i' --- a/storage/innobase/include/univ.i 2011-12-28 10:40:55 +0000 +++ b/storage/innobase/include/univ.i 2012-02-01 20:59:15 +0000 @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -155,7 +155,7 @@ be excluded from instrumentation. */ #endif /* HAVE_PSI_INTERFACE */ #ifdef __WIN__ -# define YY_NO_UNISTD_H +# define YY_NO_UNISTD_H 1 #endif /* __WIN__ */ /* DEBUG VERSION CONTROL No bundle (reason: useless for push emails).