3429 Mayank Prasad 2012-02-06 [merge]
WL#5767 : Performance Schema, Statements Digest
Details:
- Merge mysql-trunk -> mysql-trunk-wl5767
removed:
include/byteorder/
added:
mysql-test/r/eq_range_idx_stat.result
mysql-test/t/eq_range_idx_stat.test
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
include/myisam.h
mysql-test/collections/default.daily
mysql-test/collections/default.experimental
mysql-test/include/have_32bit.inc
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.result
mysql-test/r/myisam_icp.result
mysql-test/r/myisam_icp_all.result
mysql-test/r/myisam_icp_none.result
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.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/r/type_temporal_fractional.result
mysql-test/suite/engines/funcs/r/date_function.result
mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result
mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result
mysql-test/suite/innodb/r/innodb-index.result
mysql-test/suite/innodb/r/innodb_monitor.result
mysql-test/suite/innodb/t/innodb-index.test
mysql-test/suite/innodb/t/innodb_bug34300.test
mysql-test/suite/opt_trace/r/eq_range_statistics.result
mysql-test/suite/opt_trace/t/eq_range_statistics.test
mysql-test/suite/rpl/r/rpl_change_master.result
mysql-test/suite/rpl/t/rpl_change_master.test
mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result
mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result
mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result
mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result
mysql-test/t/myisam.test
mysql-test/t/optimizer_debug_sync.test
mysql-test/t/type_temporal_fractional.test
sql/handler.cc
sql/opt_range.cc
sql/sql_select.cc
sql/sql_time.cc
sql/sql_yacc.yy
sql/sys_vars.cc
storage/archive/ha_archive.cc
storage/archive/ha_archive.h
storage/innobase/btr/btr0btr.cc
storage/innobase/btr/btr0sea.cc
storage/innobase/buf/buf0buf.cc
storage/innobase/buf/buf0dblwr.cc
storage/innobase/ibuf/ibuf0ibuf.cc
storage/innobase/include/btr0btr.ic
storage/innobase/include/buf0buf.h
storage/innobase/include/page0page.ic
storage/innobase/include/univ.i
storage/innobase/lock/lock0lock.cc
storage/innobase/page/page0cur.cc
storage/innobase/page/page0page.cc
storage/innobase/row/row0merge.cc
storage/innobase/row/row0sel.cc
storage/innobase/srv/srv0mon.cc
storage/myisam/ha_myisam.cc
storage/myisam/ha_myisam.h
storage/myisam/mi_check.c
storage/myisam/myisamchk.c
storage/myisam/myisamdef.h
storage/myisam/sort.c
3428 Mayank Prasad 2012-02-05
WL#5767: Performance Schema, Statements Digest
Details:
- probable fix for failing test case on PB2.
- A little Code cleanup.
modified:
storage/perfschema/pfs_digest.cc
storage/perfschema/pfs_digest.h
=== 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 'include/myisam.h'
--- a/include/myisam.h 2011-07-04 00:25:46 +0000
+++ b/include/myisam.h 2012-02-02 12:48:48 +0000
@@ -401,14 +401,14 @@ typedef struct st_mi_check_param
ulonglong max_data_file_length;
ulonglong keys_in_use;
ulonglong max_record_length;
+ ulonglong sort_buffer_length;
my_off_t search_after_block;
my_off_t new_file_pos,key_file_blocks;
my_off_t keydata,totaldata,key_blocks,start_check_pos;
ha_rows total_records,total_deleted;
ha_checksum record_checksum,glob_crc;
ulonglong use_buffers;
- ulong read_buffer_length,write_buffer_length,
- sort_buffer_length,sort_key_blocks;
+ ulong read_buffer_length, write_buffer_length, sort_key_blocks;
uint out_flag,warning_printed,error_printed,verbose;
uint opt_sort_key,total_files,max_level;
uint testflag, key_cache_block_size;
=== 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-03 15:16:35 +0000
@@ -9,17 +9,47 @@ 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 # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_all @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_dupsweed @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_firstmatch @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_all @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_innodb_none @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_loosescan @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat_nosj @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_mat @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bka_nixbnl @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bka @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none_bkaunique @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none @solaris # Bug#11753919 2012-02-03 didrik Several test cases fail on Solaris with error Thread stack overrun
+
main.kill @freebsd # Bug#12619719 2011-08-04 Occasional failure in PB2
innodb.innodb_monitor # Bug#12320827 2011-08-04 Occasional failure in PB2
rpl.rpl_change_master_dbug # BUG#11933491 2011-06-13 Anitha Test fails on redhat
rpl.rpl_delayed_slave # BUG#11764654 rpl_delayed_slave fails sporadically in pb
-rpl.rpl_heartbeat_basic # BUG#12403008 2011-04-27 sven fails sporadically
rpl.rpl_innodb_bug28430 # Bug#11754425
rpl.rpl_row_sp011 @solaris # Bug#11753919 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
rpl.rpl_seconds_behind_master # BUG#11765124 2010-11-24 luis fails sporadically on pb2
=== modified file 'mysql-test/include/have_32bit.inc'
--- a/mysql-test/include/have_32bit.inc 2009-01-08 18:13:57 +0000
+++ b/mysql-test/include/have_32bit.inc 2012-02-03 13:49:32 +0000
@@ -3,10 +3,10 @@
--disable_query_log
--disable_warnings
-let $save = `SELECT @@global.sort_buffer_size`;
-SET @@global.sort_buffer_size = 4294967296;
-let $mach32 = `SELECT @@global.sort_buffer_size <= 4294967295`;
-eval SET @@global.sort_buffer_size = $save;
+let $save = `SELECT @@global.myisam_sort_buffer_size`;
+SET @@global.myisam_sort_buffer_size = 4294967296;
+let $mach32 = `SELECT @@global.myisam_sort_buffer_size <= 4294967295`;
+eval SET @@global.myisam_sort_buffer_size = $save;
--enable_warnings
--enable_query_log
if (!$mach32)
=== 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;
+
=== added file 'mysql-test/r/eq_range_idx_stat.result'
--- a/mysql-test/r/eq_range_idx_stat.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/eq_range_idx_stat.result 2012-02-02 16:56:36 +0000
@@ -0,0 +1,125 @@
+SET eq_range_index_dive_limit=default;
+SELECT @@eq_range_index_dive_limit;
+@@eq_range_index_dive_limit
+10
+CREATE TABLE t1
+(
+/* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
+st_a int,
+swt1a int,
+swt2a int,
+st_b int,
+swt1b int,
+swt2b int,
+key sta_swt12a(st_a,swt1a,swt2a),
+key sta_swt1a(st_a,swt1a),
+key sta_swt2a(st_a,swt2a),
+key sta_swt21a(st_a,swt2a,swt1a),
+key st_a(st_a),
+key stb_swt1a_2b(st_b,swt1b,swt2a),
+key stb_swt1b(st_b,swt1b),
+key st_b(st_b)
+) ;
+ALTER TABLE t1 DISABLE KEYS;
+#
+# Printing of many insert into t1 disabled.
+#
+ALTER TABLE t1 ENABLE KEYS;
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Table is already up to date
+#
+# Run index_merge queries two times: 1) with index dives
+# 2) with index statistics
+#
+
+explain
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 15,15 NULL 3 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+st_a swt1a swt2a st_b swt1b swt2b
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+
+explain
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 15,15 NULL 3 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+st_a swt1a swt2a st_b swt1b swt2b
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+
+explain
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a 10 const,const 89 Using where
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+st_a swt1a swt2a st_b swt1b swt2b
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+
+SET eq_range_index_dive_limit=1;
+SET SESSION DEBUG="+d,crash_records_in_range";
+
+explain
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 15,15 NULL 3 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+st_a swt1a swt2a st_b swt1b swt2b
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+
+explain
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a,stb_swt1a_2b 15,15 NULL 3 Using intersect(sta_swt12a,stb_swt1a_2b); Using where
+select * from t1
+where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+st_a swt1a swt2a st_b swt1b swt2b
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+
+explain
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a,stb_swt1a_2b,stb_swt1b,st_b sta_swt12a 10 const,const 90 Using where
+select * from t1
+where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+st_a swt1a swt2a st_b swt1b swt2b
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+1 1 1 1 1 1
+
+SET eq_range_index_dive_limit=1;
+SET SESSION DEBUG="+d,crash_records_in_range";
+DROP TABLE t1;
=== 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.result'
--- a/mysql-test/r/myisam.result 2011-10-21 05:42:01 +0000
+++ b/mysql-test/r/myisam.result 2012-02-02 09:03:02 +0000
@@ -2442,6 +2442,19 @@ Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
+#
+# BUG 11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN
+# CASES RESETS DATA POINTER TO SMAL
+#
+CREATE TABLE t1(a INT, KEY(a));
+ALTER TABLE t1 DISABLE KEYS;
+SET @before:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+FLUSH TABLES;
+SET @after:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+SELECT @before=@after;
+@before=@after
+1
+DROP TABLE t1;
End of 5.1 tests
#
# Bug#43600: Incorrect type conversion caused wrong result.
=== 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/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result 2012-02-01 09:20:33 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result 2012-02-06 05:27:56 +0000
@@ -154,7 +154,8 @@ The following options may be given as th
--eq-range-index-dive-limit=#
The optimizer will use existing index statistics instead
of doing index dives for equality ranges if the number of
- equality ranges is larger than or equal to this number.
+ equality ranges for the index is larger than or equal to
+ this number.
--event-scheduler[=name]
Enable the event scheduler. Possible values are ON, OFF,
and DISABLED (keep the event scheduler completely
=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result 2012-02-01 09:20:33 +0000
+++ b/mysql-test/r/mysqld--help-win.result 2012-02-06 05:27:56 +0000
@@ -154,7 +154,8 @@ The following options may be given as th
--eq-range-index-dive-limit=#
The optimizer will use existing index statistics instead
of doing index dives for equality ranges if the number of
- equality ranges is larger than or equal to this number.
+ equality ranges for the index is larger than or equal to
+ this number.
--event-scheduler[=name]
Enable the event scheduler. Possible values are ON, OFF,
and DISABLED (keep the event scheduler completely
=== 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/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result 2012-01-31 15:16:16 +0000
+++ b/mysql-test/r/type_temporal_fractional.result 2012-02-02 10:58:18 +0000
@@ -17130,4 +17130,49 @@ SELECT 1 FROM t1 WHERE CASE WHEN 0 then
SELECT 1 FROM t1 WHERE (SELECT a FROM t1) / a;
1
DROP TABLE t1;
+#
+# BUG#13616434 ASSERTION FAILED: NANOSECONDS < 1000000000
+#
+SELECT
+EXTRACT(DAY FROM (-0.1111111111)),
+EXTRACT(YEAR FROM (-0.1111111)),
+EXTRACT(YEAR_MONTH FROM (-0.1111111111)),
+EXTRACT(DAY FROM (-0.1111111)),
+EXTRACT(QUARTER FROM (-0.1111111111)),
+EXTRACT(MONTH FROM (-0.1111111)),
+EXTRACT(WEEK FROM (-0.1111111)),
+DATE(-0.1111111),
+QUARTER(-0.1111111111),
+TIMESTAMP(-0.1111111111),
+LAST_DAY(-0.1111111111),
+DAY(-0.1111111111),
+MONTH(-0.1111111111),
+YEAR(-0.1111111),
+DAYOFMONTH(-0.1111111111),
+TIMESTAMP((-0.1111111111),'{$x'),
+DATE_FORMAT(-0.1111111111,'+'),
+CONVERT(-0.1111111,DATE),
+CAST(-0.1111111111 AS DATE);
+EXTRACT(DAY FROM (-0.1111111111)) EXTRACT(YEAR FROM (-0.1111111)) EXTRACT(YEAR_MONTH FROM (-0.1111111111)) EXTRACT(DAY FROM (-0.1111111)) EXTRACT(QUARTER FROM (-0.1111111111)) EXTRACT(MONTH FROM (-0.1111111)) EXTRACT(WEEK FROM (-0.1111111)) DATE(-0.1111111) QUARTER(-0.1111111111) TIMESTAMP(-0.1111111111) LAST_DAY(-0.1111111111) DAY(-0.1111111111) MONTH(-0.1111111111) YEAR(-0.1111111) DAYOFMONTH(-0.1111111111) TIMESTAMP((-0.1111111111),'{$x') DATE_FORMAT(-0.1111111111,'+') CONVERT(-0.1111111,DATE) CAST(-0.1111111111 AS DATE)
+NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
+Warnings:
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111'
+Warning 1292 Incorrect datetime value: '-0.1111111'
+Warning 1292 Incorrect datetime value: '-0.1111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
+Warning 1292 Incorrect datetime value: '-0.1111111'
+Warning 1292 Incorrect datetime value: '-0.1111111111'
# End of 5.6 tests
=== modified file 'mysql-test/suite/engines/funcs/r/date_function.result'
--- a/mysql-test/suite/engines/funcs/r/date_function.result 2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/date_function.result 2012-02-02 12:37:31 +0000
@@ -306,6 +306,8 @@ NULL
2000-01-31
2006-12-31
2008-02-29
+Warnings:
+Warning 1292 Incorrect datetime value: '0000-00-00'
DROP TABLE t3;
CREATE TABLE t3(c1 DATE NOT NULL);
INSERT INTO t3 VALUES('1000-01-01');
=== modified file 'mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result'
--- a/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result 2011-01-05 08:43:46 +0000
+++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_ascii.result 2012-02-02 12:29:12 +0000
@@ -81,6 +81,7 @@ utf8_german2_ci utf8 212 # #
utf8_croatian_ci utf8 213 # #
utf8_unicode_520_ci utf8 214 # #
utf8_vietnamese_ci utf8 215 # #
+utf8_general_mysql500_ci utf8 223 # #
ucs2_general_ci ucs2 35 Yes # #
ucs2_bin ucs2 90 # #
ucs2_unicode_ci ucs2 128 # #
@@ -107,6 +108,7 @@ ucs2_german2_ci ucs2 148 # #
ucs2_croatian_ci ucs2 149 # #
ucs2_unicode_520_ci ucs2 150 # #
ucs2_vietnamese_ci ucs2 151 # #
+ucs2_general_mysql500_ci ucs2 159 # #
cp866_general_ci cp866 36 Yes # #
cp866_bin cp866 68 # #
keybcs2_general_ci keybcs2 37 Yes # #
=== modified file 'mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result'
--- a/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result 2011-01-05 08:43:46 +0000
+++ b/mysql-test/suite/engines/funcs/r/db_alter_collate_utf8.result 2012-02-02 12:29:12 +0000
@@ -81,6 +81,7 @@ utf8_german2_ci utf8 212 # #
utf8_croatian_ci utf8 213 # #
utf8_unicode_520_ci utf8 214 # #
utf8_vietnamese_ci utf8 215 # #
+utf8_general_mysql500_ci utf8 223 # #
ucs2_general_ci ucs2 35 Yes # #
ucs2_bin ucs2 90 # #
ucs2_unicode_ci ucs2 128 # #
@@ -107,6 +108,7 @@ ucs2_german2_ci ucs2 148 # #
ucs2_croatian_ci ucs2 149 # #
ucs2_unicode_520_ci ucs2 150 # #
ucs2_vietnamese_ci ucs2 151 # #
+ucs2_general_mysql500_ci ucs2 159 # #
cp866_general_ci cp866 36 Yes # #
cp866_bin cp866 68 # #
keybcs2_general_ci keybcs2 37 Yes # #
=== modified file 'mysql-test/suite/innodb/r/innodb-index.result'
--- a/mysql-test/suite/innodb/r/innodb-index.result 2011-11-28 07:42:18 +0000
+++ b/mysql-test/suite/innodb/r/innodb-index.result 2012-02-02 12:00:50 +0000
@@ -1,5 +1,9 @@
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
+create table t1(a varchar(2) primary key) engine=innodb;
+insert into t1 values('');
+create index t1a1 on t1(a(1));
+drop table t1;
create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
commit;
=== modified file 'mysql-test/suite/innodb/r/innodb_monitor.result'
--- a/mysql-test/suite/innodb/r/innodb_monitor.result 2011-11-20 20:25:39 +0000
+++ b/mysql-test/suite/innodb/r/innodb_monitor.result 2012-02-02 10:48:36 +0000
@@ -132,7 +132,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -336,7 +336,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -542,7 +542,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -746,7 +746,7 @@ trx_active_transactions 0 disabled
trx_rseg_history_len 0 disabled
trx_undo_slots_used 0 disabled
trx_undo_slots_cached 0 disabled
-trx_rseg_curent_size 0 disabled
+trx_rseg_current_size 0 disabled
purge_del_mark_records 0 disabled
purge_upd_exist_or_extern_records 0 disabled
purge_invoked 0 disabled
@@ -1004,7 +1004,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1208,7 +1208,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1412,7 +1412,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1616,7 +1616,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1820,7 +1820,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
=== modified file 'mysql-test/suite/innodb/t/innodb-index.test'
--- a/mysql-test/suite/innodb/t/innodb-index.test 2011-11-20 21:00:25 +0000
+++ b/mysql-test/suite/innodb/t/innodb-index.test 2012-02-02 12:00:50 +0000
@@ -7,6 +7,12 @@ let $format=`select @@innodb_file_format
set global innodb_file_per_table=on;
set global innodb_file_format='Barracuda';
+# Bug#13654923 BOGUS DEBUG ASSERTION IN INDEX CREATION FOR ZERO-LENGTH RECORD
+create table t1(a varchar(2) primary key) engine=innodb;
+insert into t1 values('');
+create index t1a1 on t1(a(1));
+drop table t1;
+
create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb;
insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak');
commit;
=== modified file 'mysql-test/suite/innodb/t/innodb_bug34300.test'
--- a/mysql-test/suite/innodb/t/innodb_bug34300.test 2011-11-20 21:00:25 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug34300.test 2012-02-02 10:27:45 +0000
@@ -5,13 +5,11 @@
-- source include/have_innodb.inc
-# BLOB support is too slow for smaller page sizes.
-# Some PB2 platforms can get a long semephore wait.
--- source include/have_innodb_16k.inc
-
-- disable_query_log
-- disable_result_log
+call mtr.add_suppression("InnoDB: Warning: a long semaphore wait:");
+
# set packet size and reconnect
let $max_packet=`select @@global.max_allowed_packet`;
SET @@global.max_allowed_packet=16777216;
=== modified file 'mysql-test/suite/opt_trace/r/eq_range_statistics.result'
--- a/mysql-test/suite/opt_trace/r/eq_range_statistics.result 2012-01-26 13:09:59 +0000
+++ b/mysql-test/suite/opt_trace/r/eq_range_statistics.result 2012-02-02 16:56:36 +0000
@@ -36,10 +36,17 @@ SET eq_range_index_dive_limit=3;
SELECT @@eq_range_index_dive_limit;
@@eq_range_index_dive_limit
3
+SET SESSION DEBUG="+d,crash_records_in_range";
# Index statistics kicks in, giving incorrect estimate of 3x2=6 records
EXPLAIN SELECT * FROM t1 WHERE a IN (1,2,3);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 6 Using where; Using index
+SELECT * FROM t1 WHERE a IN (1,2,3);
+a b
+1 1
+2 2
+3 3
+SET SESSION DEBUG="-d,crash_records_in_range";
#####
# Below: A number of tests to verify that the number of equality ranges
# are counted correctly
@@ -422,6 +429,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>
} 0 0
# 3 equality ranges: should use index statistics
+SET SESSION DEBUG="+d,crash_records_in_range";
EXPLAIN SELECT * FROM t1 WHERE a=5 AND (b=2 OR b=3 OR b=4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 10 NULL 3 Using where; Using index
@@ -631,6 +639,7 @@ EXPLAIN SELECT * FROM t1 WHERE a=5 AND (
}
] /* steps */
} 0 0
+SET SESSION DEBUG="-d,crash_records_in_range";
# 2 equality ranges: should not use index statistics
EXPLAIN SELECT * FROM t1 WHERE a=5 AND (b=2 OR b=3 OR b>4);
=== modified file 'mysql-test/suite/opt_trace/t/eq_range_statistics.test'
--- a/mysql-test/suite/opt_trace/t/eq_range_statistics.test 2012-01-26 13:09:59 +0000
+++ b/mysql-test/suite/opt_trace/t/eq_range_statistics.test 2012-02-03 07:36:30 +0000
@@ -5,6 +5,7 @@
# predicate
--source include/have_optimizer_trace.inc
+--source include/have_debug.inc
SET optimizer_trace_max_mem_size=1048576; # 1MB
SET optimizer_trace="enabled=on,end_marker=on,one_line=off";
@@ -38,8 +39,12 @@ EXPLAIN SELECT * FROM t1 WHERE a IN (1,2
SET eq_range_index_dive_limit=3;
SELECT @@eq_range_index_dive_limit;
+# Crash server if records_in_range() is called
+SET SESSION DEBUG="+d,crash_records_in_range";
--echo # Index statistics kicks in, giving incorrect estimate of 3x2=6 records
EXPLAIN SELECT * FROM t1 WHERE a IN (1,2,3);
+SELECT * FROM t1 WHERE a IN (1,2,3);
+SET SESSION DEBUG="-d,crash_records_in_range";
--echo #####
--echo # Below: A number of tests to verify that the number of equality ranges
@@ -53,15 +58,21 @@ EXPLAIN SELECT * FROM t1 WHERE a IN (1,2
EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>10 OR a IN (1);
SELECT * FROM information_schema.OPTIMIZER_TRACE;
+# This query will use index statistics (as shown in trace) but
+# we cannot make it crash if records_in_range() is called
+# because the "a>10" range will correctly call records_in_range()
--echo
--echo # 3 equality ranges: should use index statistics
EXPLAIN SELECT * FROM t1 WHERE a=5 OR a>10 OR a IN (1,2);
SELECT * FROM information_schema.OPTIMIZER_TRACE;
+# Crash server if records_in_range() is called
--echo
--echo # 3 equality ranges: should use index statistics
+SET SESSION DEBUG="+d,crash_records_in_range";
EXPLAIN SELECT * FROM t1 WHERE a=5 AND (b=2 OR b=3 OR b=4);
SELECT * FROM information_schema.OPTIMIZER_TRACE;
+SET SESSION DEBUG="-d,crash_records_in_range";
--echo
--echo # 2 equality ranges: should not use index statistics
=== modified file 'mysql-test/suite/rpl/r/rpl_change_master.result'
--- a/mysql-test/suite/rpl/r/rpl_change_master.result 2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result 2012-02-03 23:52:29 +0000
@@ -96,4 +96,27 @@ drop table t1;
include/stop_slave.inc
CHANGE MASTER TO master_host='SAVE_MASTER_HOST';
include/start_slave.inc
+include/rpl_reset.inc
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='', MASTER_PORT=MASTER_PORT;
+ERROR HY000: Incorrect arguments to MASTER_HOST
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1\n127.0.0.1', MASTER_PORT=MASTER_PORT;
+ERROR HY000: Incorrect argument contains not-allowed LF value: '127.0.0.1
+127.0.0.1'
+CHANGE MASTER TO MASTER_USER='root\n', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'root
+'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='repli\ncation', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'repli
+cation'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=MASTER_PORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.\n001', MASTER_LOG_POS=4;
+ERROR HY000: Incorrect argument contains not-allowed LF value: 'master2-bin.
+001'
+CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT;
+Warnings:
+Note 1756 Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note 1757 Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
+include/start_slave.inc
+Master_Host = '127.0.0.1'
+include/rpl_reset.inc
include/rpl_end.inc
=== modified file 'mysql-test/suite/rpl/t/rpl_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_change_master.test 2010-12-19 17:25:42 +0000
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test 2012-02-03 23:52:29 +0000
@@ -11,4 +11,51 @@
--source include/master-slave.inc
--source extra/rpl_tests/rpl_change_master.test
+
+
+# BUG#11758581 - 50801: CHANGE MASTER ACCEPTS BOGUS VARIABLES
+# We want to check if CHANGE MASTER values have newline characters.
+--source include/rpl_reset.inc
+connection slave;
+
+###
+### This should fail with error ER_WRONG_ARGUMENTS due to empty MASTER_HOST
+### value.
+###
+--source include/stop_slave.inc
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_ARGUMENTS
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='', MASTER_PORT=$MASTER_MYPORT;
+
+###
+### This should fail with error ER_SYNTAX_ERROR due to newline
+### in string values.
+###
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1\n127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root\n', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='repli\ncation', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.001', MASTER_LOG_POS=4;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--error ER_WRONG_VALUE
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='master2.mycompany.com', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='replication', MASTER_PASSWORD='bigs3cret', MASTER_LOG_FILE='master2-bin.\n001', MASTER_LOG_POS=4;
+
+###
+### This should be accepted.
+###
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
+
+--source include/start_slave.inc
+--let $status_items= Master_Host
+--source include/show_slave_status.inc
+--source include/rpl_reset.inc
+
--source include/rpl_end.inc
=== modified file 'mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result 2011-11-20 20:25:39 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_disable_basic.result 2012-02-02 12:26:05 +0000
@@ -132,7 +132,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -336,7 +336,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -542,7 +542,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -746,7 +746,7 @@ trx_active_transactions 0 disabled
trx_rseg_history_len 0 disabled
trx_undo_slots_used 0 disabled
trx_undo_slots_cached 0 disabled
-trx_rseg_curent_size 0 disabled
+trx_rseg_current_size 0 disabled
purge_del_mark_records 0 disabled
purge_upd_exist_or_extern_records 0 disabled
purge_invoked 0 disabled
@@ -1004,7 +1004,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1208,7 +1208,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1412,7 +1412,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1616,7 +1616,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1820,7 +1820,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
=== modified file 'mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result 2011-11-20 20:25:39 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_enable_basic.result 2012-02-02 12:26:05 +0000
@@ -132,7 +132,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -336,7 +336,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -542,7 +542,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -746,7 +746,7 @@ trx_active_transactions 0 disabled
trx_rseg_history_len 0 disabled
trx_undo_slots_used 0 disabled
trx_undo_slots_cached 0 disabled
-trx_rseg_curent_size 0 disabled
+trx_rseg_current_size 0 disabled
purge_del_mark_records 0 disabled
purge_upd_exist_or_extern_records 0 disabled
purge_invoked 0 disabled
@@ -1004,7 +1004,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1208,7 +1208,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1412,7 +1412,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1616,7 +1616,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1820,7 +1820,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
=== modified file 'mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result 2011-11-20 20:25:39 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_all_basic.result 2012-02-02 12:26:05 +0000
@@ -132,7 +132,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -336,7 +336,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -542,7 +542,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -746,7 +746,7 @@ trx_active_transactions 0 disabled
trx_rseg_history_len 0 disabled
trx_undo_slots_used 0 disabled
trx_undo_slots_cached 0 disabled
-trx_rseg_curent_size 0 disabled
+trx_rseg_current_size 0 disabled
purge_del_mark_records 0 disabled
purge_upd_exist_or_extern_records 0 disabled
purge_invoked 0 disabled
@@ -1004,7 +1004,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1208,7 +1208,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1412,7 +1412,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1616,7 +1616,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1820,7 +1820,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
=== modified file 'mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result 2011-11-20 20:25:39 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_monitor_reset_basic.result 2012-02-02 12:26:05 +0000
@@ -132,7 +132,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -336,7 +336,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -542,7 +542,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -746,7 +746,7 @@ trx_active_transactions 0 disabled
trx_rseg_history_len 0 disabled
trx_undo_slots_used 0 disabled
trx_undo_slots_cached 0 disabled
-trx_rseg_curent_size 0 disabled
+trx_rseg_current_size 0 disabled
purge_del_mark_records 0 disabled
purge_upd_exist_or_extern_records 0 disabled
purge_invoked 0 disabled
@@ -1004,7 +1004,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1208,7 +1208,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1412,7 +1412,7 @@ trx_active_transactions enabled
trx_rseg_history_len enabled
trx_undo_slots_used enabled
trx_undo_slots_cached enabled
-trx_rseg_curent_size enabled
+trx_rseg_current_size enabled
purge_del_mark_records enabled
purge_upd_exist_or_extern_records enabled
purge_invoked enabled
@@ -1616,7 +1616,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
@@ -1820,7 +1820,7 @@ trx_active_transactions disabled
trx_rseg_history_len disabled
trx_undo_slots_used disabled
trx_undo_slots_cached disabled
-trx_rseg_curent_size disabled
+trx_rseg_current_size disabled
purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled
purge_invoked disabled
=== added file 'mysql-test/t/eq_range_idx_stat.test'
--- a/mysql-test/t/eq_range_idx_stat.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/eq_range_idx_stat.test 2012-02-02 16:56:36 +0000
@@ -0,0 +1,101 @@
+# Tests for eq_range_index_dive_limit variable:
+# test that index dives are not done when index
+# statistics is requested
+
+--source include/have_debug.inc
+
+SET eq_range_index_dive_limit=default;
+SELECT @@eq_range_index_dive_limit;
+
+CREATE TABLE t1
+(
+ /* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
+ st_a int,
+ swt1a int,
+ swt2a int,
+
+ st_b int,
+ swt1b int,
+ swt2b int,
+
+ key sta_swt12a(st_a,swt1a,swt2a),
+ key sta_swt1a(st_a,swt1a),
+ key sta_swt2a(st_a,swt2a),
+ key sta_swt21a(st_a,swt2a,swt1a),
+
+ key st_a(st_a),
+ key stb_swt1a_2b(st_b,swt1b,swt2a),
+ key stb_swt1b(st_b,swt1b),
+ key st_b(st_b)
+) ;
+
+ALTER TABLE t1 DISABLE KEYS;
+
+--disable_query_log
+--echo #
+--echo # Printing of many insert into t1 disabled.
+--echo #
+let $1=3;
+while ($1)
+{
+ let $2=3;
+ while ($2)
+ {
+ let $3=3;
+ while ($3)
+ {
+ let $equal_records=30;
+ while ($equal_records)
+ {
+ eval insert into t1 select $1, $2, $3, $1 ,$2, $3;
+ dec $equal_records;
+ }
+ dec $3;
+ }
+ dec $2;
+ }
+ dec $1;
+}
+--enable_query_log
+ALTER TABLE t1 ENABLE KEYS;
+ANALYZE TABLE t1;
+
+--echo #
+--echo # Run index_merge queries two times: 1) with index dives
+--echo # 2) with index statistics
+--echo #
+let $iterations=2;
+while ($iterations)
+{
+ dec $iterations;
+
+ --echo
+ explain
+ select * from t1
+ where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+
+ select * from t1
+ where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;
+
+ --echo
+ explain
+ select * from t1
+ where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+
+ select * from t1
+ where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;
+
+ --echo
+ explain
+ select * from t1
+ where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+
+ select * from t1
+ where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;
+
+ --echo
+ SET eq_range_index_dive_limit=1;
+ SET SESSION DEBUG="+d,crash_records_in_range";
+}
+
+DROP TABLE t1;
=== modified file 'mysql-test/t/myisam.test'
--- a/mysql-test/t/myisam.test 2011-10-21 05:42:01 +0000
+++ b/mysql-test/t/myisam.test 2012-02-02 09:03:02 +0000
@@ -1665,6 +1665,20 @@ CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL myisam_use_mmap=default;
+--echo #
+--echo # BUG 11756869 - 48848: MYISAMCHK DOING SORT RECOVER IN CERTAIN
+--echo # CASES RESETS DATA POINTER TO SMAL
+--echo #
+CREATE TABLE t1(a INT, KEY(a));
+ALTER TABLE t1 DISABLE KEYS;
+let $MYSQLD_DATADIR= `select @@datadir`;
+SET @before:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+FLUSH TABLES;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--exec $MYISAMCHK -sn $MYSQLD_DATADIR/test/t1
+SET @after:= (SELECT MAX_DATA_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test');
+SELECT @before=@after;
+DROP TABLE t1;
--echo End of 5.1 tests
--echo #
=== 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 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test 2012-01-31 15:16:16 +0000
+++ b/mysql-test/t/type_temporal_fractional.test 2012-02-02 10:58:18 +0000
@@ -7610,5 +7610,29 @@ SELECT 1 FROM t1 WHERE (SELECT a FROM t1
DROP TABLE t1;
+--echo #
+--echo # BUG#13616434 ASSERTION FAILED: NANOSECONDS < 1000000000
+--echo #
+SELECT
+ EXTRACT(DAY FROM (-0.1111111111)),
+ EXTRACT(YEAR FROM (-0.1111111)),
+ EXTRACT(YEAR_MONTH FROM (-0.1111111111)),
+ EXTRACT(DAY FROM (-0.1111111)),
+ EXTRACT(QUARTER FROM (-0.1111111111)),
+ EXTRACT(MONTH FROM (-0.1111111)),
+ EXTRACT(WEEK FROM (-0.1111111)),
+ DATE(-0.1111111),
+ QUARTER(-0.1111111111),
+ TIMESTAMP(-0.1111111111),
+ LAST_DAY(-0.1111111111),
+ DAY(-0.1111111111),
+ MONTH(-0.1111111111),
+ YEAR(-0.1111111),
+ DAYOFMONTH(-0.1111111111),
+ TIMESTAMP((-0.1111111111),'{$x'),
+ DATE_FORMAT(-0.1111111111,'+'),
+ CONVERT(-0.1111111,DATE),
+ CAST(-0.1111111111 AS DATE);
+
--echo # End of 5.6 tests
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2012-01-31 07:45:59 +0000
+++ b/sql/handler.cc 2012-02-02 16:56:36 +0000
@@ -4616,6 +4616,7 @@ handler::multi_range_read_info_const(uin
rows= table->key_info[keyno].rec_per_key[keyparts_used-1];
else
{
+ DBUG_EXECUTE_IF("crash_records_in_range", DBUG_SUICIDE(););
if (HA_POS_ERROR == (rows= this->records_in_range(keyno, min_endp,
max_endp)))
{
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2012-01-31 07:45:59 +0000
+++ b/sql/opt_range.cc 2012-02-03 07:45:19 +0000
@@ -4654,22 +4654,26 @@ void ror_intersect_cpy(ROR_INTERSECT_INF
/*
- Get selectivity of a ROR scan wrt ROR-intersection.
+ Get selectivity of adding a ROR scan to the ROR-intersection.
SYNOPSIS
ror_scan_selectivity()
- info ROR-interection
- scan ROR scan
+ info ROR-interection, an intersection of ROR index scans
+ scan ROR scan that may or may not improve the selectivity
+ of 'info'
NOTES
- Suppose we have a condition on several keys
- cond=k_11=c_11 AND k_12=c_12 AND ... // parts of first key
- k_21=c_21 AND k_22=c_22 AND ... // parts of second key
+ Suppose we have conditions on several keys
+ cond=k_11=c_11 AND k_12=c_12 AND ... // key_parts of first key in 'info'
+ k_21=c_21 AND k_22=c_22 AND ... // key_parts of second key in 'info'
...
- k_n1=c_n1 AND k_n3=c_n3 AND ... (1) //parts of the key used by *scan
+ k_n1=c_n1 AND k_n3=c_n3 AND ... (1) //key_parts of 'scan'
where k_ij may be the same as any k_pq (i.e. keys may have common parts).
+ Note that for ROR retrieval, only equality conditions are usable so there
+ are no open ranges (e.g., k_ij > c_ij) in 'scan' or 'info'
+
A full row is retrieved if entire condition holds.
The recursive procedure for finding P(cond) is as follows:
@@ -4736,19 +4740,30 @@ void ror_intersect_cpy(ROR_INTERSECT_INF
where i1,i2, .. are key parts that were already marked as fixed.
- In order to minimize number of expensive records_in_range calls we group
- and reduce adjacent fractions.
+ In order to minimize number of expensive records_in_range calls we
+ group and reduce adjacent fractions. Note that on the optimizer's
+ request, index statistics may be used instead of records_in_range
+ @see RANGE_OPT_PARAM::use_index_statistics.
RETURN
- Selectivity of given ROR scan.
+ Selectivity of given ROR scan, a number between 0 and 1. 1 means that
+ adding 'scan' to the intersection does not improve the selectivity.
*/
static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info,
const ROR_SCAN_INFO *scan)
{
double selectivity_mult= 1.0;
- KEY_PART_INFO *key_part= info->param->table->key_info[scan->keynr].key_part;
- uchar key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH]; /* key values tuple */
+ const TABLE * const table= info->param->table;
+ const KEY_PART_INFO * const key_part= table->key_info[scan->keynr].key_part;
+ /**
+ key values tuple, used to store both min_range.key and
+ max_range.key. This function is only called for equality ranges;
+ open ranges (e.g. "min_value < X < max_value") cannot be used for
+ rowid ordered retrieval, so in this function we know that
+ min_range.key == max_range.key
+ */
+ uchar key_val[MAX_KEY_LENGTH+MAX_FIELD_WIDTH];
uchar *key_ptr= key_val;
SEL_ARG *sel_arg, *tuple_arg= NULL;
key_part_map keypart_map= 0;
@@ -4761,7 +4776,7 @@ static double ror_scan_selectivity(const
min_range.flag= HA_READ_KEY_EXACT;
max_range.key= key_val;
max_range.flag= HA_READ_AFTER_KEY;
- ha_rows prev_records= info->param->table->file->stats.records;
+ ha_rows prev_records= table->file->stats.records;
DBUG_ENTER("ror_scan_selectivity");
for (sel_arg= scan->sel_arg; sel_arg;
@@ -4773,12 +4788,14 @@ static double ror_scan_selectivity(const
if (cur_covered != prev_covered)
{
/* create (part1val, ..., part{n-1}val) tuple. */
+ bool is_null_range= false;
ha_rows records;
if (!tuple_arg)
{
tuple_arg= scan->sel_arg;
/* Here we use the length of the first key part */
- tuple_arg->store_min(key_part->store_length, &key_ptr, 0);
+ tuple_arg->store_min(key_part[0].store_length, &key_ptr, 0);
+ is_null_range|= tuple_arg->is_null_interval();
keypart_map= 1;
}
while (tuple_arg->next_key_part != sel_arg)
@@ -4786,12 +4803,33 @@ static double ror_scan_selectivity(const
tuple_arg= tuple_arg->next_key_part;
tuple_arg->store_min(key_part[tuple_arg->part].store_length,
&key_ptr, 0);
+ is_null_range|= tuple_arg->is_null_interval();
keypart_map= (keypart_map << 1) | 1;
}
min_range.length= max_range.length= (size_t) (key_ptr - key_val);
min_range.keypart_map= max_range.keypart_map= keypart_map;
- records= (info->param->table->file->
- records_in_range(scan->keynr, &min_range, &max_range));
+
+ /*
+ Get the number of rows in this range. This is done by calling
+ records_in_range() unless all these are true:
+ 1) The user has requested that index statistics should be used
+ for equality ranges to avoid the incurred overhead of
+ index dives in records_in_range()
+ 2) The range is not on the form "x IS NULL". The reason is
+ that the number of rows with this value are likely to be
+ very different than the values in the index statistics
+ 3) Index statistics is available.
+ @see key_val
+ */
+ if (!info->param->use_index_statistics || // (1)
+ is_null_range || // (2)
+ !(records= table->key_info[scan->keynr].
+ rec_per_key[tuple_arg->part])) // (3)
+ {
+ DBUG_EXECUTE_IF("crash_records_in_range", DBUG_SUICIDE(););
+ records= (table->file->
+ records_in_range(scan->keynr, &min_range, &max_range));
+ }
if (cur_covered)
{
/* uncovered -> covered */
@@ -4810,11 +4848,13 @@ static double ror_scan_selectivity(const
}
if (!prev_covered)
{
- double tmp= rows2double(info->param->table->quick_rows[scan->keynr]) /
+ double tmp= rows2double(table->quick_rows[scan->keynr]) /
rows2double(prev_records);
DBUG_PRINT("info", ("Selectivity multiplier: %g", tmp));
selectivity_mult *= tmp;
}
+ // Todo: This assert fires in PB sysqa RQG tests.
+ // DBUG_ASSERT(selectivity_mult <= 1.0);
DBUG_PRINT("info", ("Returning multiplier: %g", selectivity_mult));
DBUG_RETURN(selectivity_mult);
}
=== 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 'sql/sql_time.cc'
--- a/sql/sql_time.cc 2011-11-24 12:31:44 +0000
+++ b/sql/sql_time.cc 2012-02-02 10:58:18 +0000
@@ -409,13 +409,14 @@ str_to_datetime_with_warn(String *str, M
static bool
lldiv_t_to_datetime(lldiv_t lld, MYSQL_TIME *ltime, uint flags, int *warnings)
{
- bool rc= number_to_datetime(lld.quot, ltime, flags, warnings) == LL(-1);
- if (rc)
+ if (lld.rem < 0 || // Catch negative numbers with zero int part, e.g: -0.1
+ number_to_datetime(lld.quot, ltime, flags, warnings) == LL(-1))
{
/* number_to_datetime does not clear ltime in case of ZERO DATE */
set_zero_time(ltime, MYSQL_TIMESTAMP_ERROR);
if (!*warnings) /* Neither sets warnings in case of ZERO DATE */
*warnings|= MYSQL_TIME_WARN_TRUNCATED;
+ return true;
}
else if (ltime->time_type == MYSQL_TIMESTAMP_DATE)
{
@@ -430,9 +431,9 @@ lldiv_t_to_datetime(lldiv_t lld, MYSQL_T
else if (!(flags & TIME_NO_NSEC_ROUNDING))
{
ltime->second_part= lld.rem / 1000;
- rc= datetime_add_nanoseconds_with_round(ltime, lld.rem % 1000, warnings);
+ return datetime_add_nanoseconds_with_round(ltime, lld.rem % 1000, warnings);
}
- return rc;
+ return false;
}
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2011-12-19 12:53:11 +0000
+++ b/sql/sql_yacc.yy 2012-02-03 18:09:00 +0000
@@ -1504,7 +1504,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
NCHAR_STRING opt_component key_cache_name
sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty
- opt_constraint constraint opt_ident
+ opt_constraint constraint opt_ident TEXT_STRING_sys_nonewline
%type <lex_str_ptr>
opt_table_alias
@@ -1983,19 +1983,19 @@ master_defs:
;
master_def:
- MASTER_HOST_SYM EQ TEXT_STRING_sys
+ MASTER_HOST_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.host = $3.str;
}
- | MASTER_BIND_SYM EQ TEXT_STRING_sys
+ | MASTER_BIND_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.bind_addr = $3.str;
}
- | MASTER_USER_SYM EQ TEXT_STRING_sys
+ | MASTER_USER_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.user = $3.str;
}
- | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys
+ | MASTER_PASSWORD_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.password = $3.str;
}
@@ -2027,23 +2027,23 @@ master_def:
Lex->mi.ssl= $3 ?
LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
}
- | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.ssl_ca= $3.str;
}
- | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.ssl_capath= $3.str;
}
- | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.ssl_cert= $3.str;
}
- | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.ssl_cipher= $3.str;
}
- | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.ssl_key= $3.str;
}
@@ -2052,11 +2052,11 @@ master_def:
Lex->mi.ssl_verify_server_cert= $3 ?
LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE;
}
- | MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CRL_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.ssl_crl= $3.str;
}
- | MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys
+ | MASTER_SSL_CRLPATH_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.ssl_crlpath= $3.str;
}
@@ -2121,7 +2121,7 @@ ignore_server_id:
}
master_file_def:
- MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
+ MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.log_file_name = $3.str;
}
@@ -2141,7 +2141,7 @@ master_file_def:
*/
Lex->mi.pos = max<ulonglong>(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
}
- | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
+ | RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys_nonewline
{
Lex->mi.relay_log_name = $3.str;
}
@@ -12814,6 +12814,19 @@ IDENT_sys:
}
}
;
+
+TEXT_STRING_sys_nonewline:
+ TEXT_STRING_sys
+ {
+ if (!strcont($1.str, "\n"))
+ $$= $1;
+ else
+ {
+ my_error(ER_WRONG_VALUE, MYF(0), "argument contains not-allowed LF", $1.str);
+ MYSQL_YYABORT;
+ }
+ }
+ ;
TEXT_STRING_sys:
TEXT_STRING
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2012-02-01 09:20:33 +0000
+++ b/sql/sys_vars.cc 2012-02-06 05:27:56 +0000
@@ -2129,7 +2129,7 @@ static Sys_var_uint Sys_eq_range_index_d
"eq_range_index_dive_limit",
"The optimizer will use existing index statistics instead of "
"doing index dives for equality ranges if the number of equality "
- "ranges is larger than or equal to this number.",
+ "ranges for the index is larger than or equal to this number.",
SESSION_VAR(eq_range_index_dive_limit), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, UINT_MAX32), DEFAULT(10), BLOCK_SIZE(1));
=== modified file 'storage/archive/ha_archive.cc'
--- a/storage/archive/ha_archive.cc 2012-01-31 15:16:16 +0000
+++ b/storage/archive/ha_archive.cc 2012-02-03 14:37:46 +0000
@@ -294,6 +294,15 @@ err:
DBUG_RETURN(1);
}
+static void save_auto_increment(TABLE *table, ulonglong *value)
+{
+ Field *field= table->found_next_number_field;
+ ulonglong auto_value=
+ (ulonglong) field->val_int(table->record[0] +
+ field->offset(table->record[0]));
+ if (*value <= auto_value)
+ *value= auto_value + 1;
+}
/**
@brief Read version 1 meta file (5.0 compatibility routine).
@@ -476,6 +485,7 @@ ARCHIVE_SHARE *ha_archive::get_share(con
share->table_name= tmp_name;
share->crashed= FALSE;
share->archive_write_open= FALSE;
+ share->in_optimize= false;
fn_format(share->data_file_name, table_name, "",
ARZ, MY_REPLACE_EXT | MY_UNPACK_FILENAME);
strmov(share->table_name, table_name);
@@ -1506,34 +1516,45 @@ int ha_archive::optimize(THD* thd, HA_CH
{
int rc= 0;
azio_stream writer;
+ ha_rows count;
+ my_bitmap_map *org_bitmap;
char writer_filename[FN_REFLEN];
DBUG_ENTER("ha_archive::optimize");
- init_archive_reader();
-
- // now we close both our writer and our reader for the rename
- if (share->archive_write_open)
+ mysql_mutex_lock(&share->mutex);
+ if (share->in_optimize)
{
- if (share->archive_write.version == 1)
- write_v1_metafile();
- azclose(&(share->archive_write));
- share->archive_write_open= FALSE;
+ mysql_mutex_unlock(&share->mutex);
+ DBUG_RETURN(HA_ADMIN_FAILED);
}
+ share->in_optimize= true;
+ /* remember the number of rows */
+ count= share->rows_recorded;
+ if (share->archive_write_open)
+ azflush(&share->archive_write, Z_SYNC_FLUSH);
+ mysql_mutex_unlock(&share->mutex);
+
+ init_archive_reader();
/* Lets create a file to contain the new data */
fn_format(writer_filename, share->table_name, "", ARN,
MY_REPLACE_EXT | MY_UNPACK_FILENAME);
if (!(azopen(&writer, writer_filename, O_CREAT|O_RDWR|O_BINARY)))
- DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ {
+ share->in_optimize= false;
+ DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ }
/*
Transfer the embedded FRM so that the file can be discoverable.
Write file offset is set to the end of the file.
*/
if ((rc= frm_copy(&archive, &writer)))
+ {
+ share->in_optimize= false;
goto error;
-
+ }
/*
An extended rebuild is a lot more effort. We open up each row and re-record it.
Any dead rows are removed (aka rows that may have been partially recorded).
@@ -1541,75 +1562,86 @@ int ha_archive::optimize(THD* thd, HA_CH
As of Archive format 3, this is the only type that is performed, before this
version it was just done on T_EXTEND
*/
- if (1)
- {
- DBUG_PRINT("ha_archive", ("archive extended rebuild"));
- /*
- Now we will rewind the archive file so that we are positioned at the
- start of the file.
- */
- rc= read_data_header(&archive);
+ DBUG_PRINT("ha_archive", ("archive extended rebuild"));
- /*
- On success of writing out the new header, we now fetch each row and
- insert it into the new archive file.
- */
- if (!rc)
- {
- share->rows_recorded= 0;
- stats.auto_increment_value= 1;
- share->archive_write.auto_increment= 0;
- my_bitmap_map *org_bitmap= tmp_use_all_columns(table, table->read_set);
+ /*
+ Now we will rewind the archive file so that we are positioned at the
+ start of the file.
+ */
+ if ((rc= read_data_header(&archive)))
+ {
+ share->in_optimize= false;
+ goto error;
+ }
- while (!(rc= get_row(&archive, table->record[0])))
- {
- real_write_row(table->record[0], &writer);
- /*
- Long term it should be possible to optimize this so that
- it is not called on each row.
- */
- if (table->found_next_number_field)
- {
- Field *field= table->found_next_number_field;
- ulonglong auto_value=
- (ulonglong) field->val_int(table->record[0] +
- field->offset(table->record[0]));
- if (share->archive_write.auto_increment < auto_value)
- stats.auto_increment_value=
- (share->archive_write.auto_increment= auto_value) + 1;
- }
- }
+ stats.auto_increment_value= 1;
+ org_bitmap= tmp_use_all_columns(table, table->read_set);
+ /* read rows upto the remembered rows */
+ for (ha_rows cur_count= count; cur_count; cur_count--)
+ {
+ if ((rc= get_row(&archive, table->record[0])))
+ break;
+ real_write_row(table->record[0], &writer);
+ if (table->found_next_number_field)
+ save_auto_increment(table, &stats.auto_increment_value);
+ }
- tmp_restore_column_map(table->read_set, org_bitmap);
- share->rows_recorded= (ha_rows)writer.rows;
+ mysql_mutex_lock(&share->mutex);
+
+ if (share->archive_write_open)
+ {
+ if (share->archive_write.version == 1)
+ write_v1_metafile();
+ azclose(&share->archive_write);
+ share->archive_write_open= FALSE;
+ }
+ if (!rc)
+ {
+ /* read the remaining rows */
+ for (count= share->rows_recorded - count; count; count--)
+ {
+ if ((rc= get_row(&archive, table->record[0])))
+ break;
+ real_write_row(table->record[0], &writer);
+ if (table->found_next_number_field)
+ save_auto_increment(table, &stats.auto_increment_value);
}
+ }
- DBUG_PRINT("info", ("recovered %llu archive rows",
- (unsigned long long)share->rows_recorded));
+ tmp_restore_column_map(table->read_set, org_bitmap);
+ share->rows_recorded= (ha_rows) writer.rows;
+ share->archive_write.auto_increment= stats.auto_increment_value - 1;
+ DBUG_PRINT("info", ("recovered %llu archive rows",
+ (unsigned long long)share->rows_recorded));
- DBUG_PRINT("ha_archive", ("recovered %llu archive rows",
- (unsigned long long)share->rows_recorded));
+ DBUG_PRINT("ha_archive", ("recovered %llu archive rows",
+ (unsigned long long)share->rows_recorded));
- /*
- If REPAIR ... EXTENDED is requested, try to recover as much data
- from data file as possible. In this case if we failed to read a
- record, we assume EOF. This allows massive data loss, but we can
- hardly do more with broken zlib stream. And this is the only way
- to restore at least what is still recoverable.
- */
- if (rc && rc != HA_ERR_END_OF_FILE && !(check_opt->flags & T_EXTEND))
- goto error;
- }
+ /*
+ If REPAIR ... EXTENDED is requested, try to recover as much data
+ from data file as possible. In this case if we failed to read a
+ record, we assume EOF. This allows massive data loss, but we can
+ hardly do more with broken zlib stream. And this is the only way
+ to restore at least what is still recoverable.
+ */
+ if (rc && rc != HA_ERR_END_OF_FILE && !(check_opt->flags & T_EXTEND))
+ {
+ share->in_optimize= false;
+ mysql_mutex_unlock(&share->mutex);
+ goto error;
+ }
azclose(&writer);
share->dirty= FALSE;
-
- azclose(&archive);
// make the file we just wrote be our data file
rc= my_rename(writer_filename, share->data_file_name, MYF(0));
+ share->in_optimize= false;
+ mysql_mutex_unlock(&share->mutex);
+ azclose(&archive);
+ archive_reader_open= FALSE;
DBUG_RETURN(rc);
error:
=== modified file 'storage/archive/ha_archive.h'
--- a/storage/archive/ha_archive.h 2011-10-07 06:03:14 +0000
+++ b/storage/archive/ha_archive.h 2012-02-03 14:37:46 +0000
@@ -35,6 +35,7 @@ typedef struct st_archive_share {
mysql_mutex_t mutex;
THR_LOCK lock;
azio_stream archive_write; /* Archive file we are working with */
+ bool in_optimize;
bool archive_write_open;
bool dirty; /* Flag for if a flush should occur */
bool crashed; /* Meta file is crashed */
=== modified file 'storage/innobase/btr/btr0btr.cc'
--- a/storage/innobase/btr/btr0btr.cc 2012-01-26 11:57:53 +0000
+++ b/storage/innobase/btr/btr0btr.cc 2012-02-02 10:44:07 +0000
@@ -57,11 +57,12 @@ btr_corruption_report(
(unsigned) buf_block_get_space(block),
(unsigned) buf_block_get_page_no(block),
index->name, index->table_name);
- buf_page_print(buf_block_get_frame(block), 0);
if (block->page.zip.data) {
buf_page_print(block->page.zip.data,
- buf_block_get_zip_size(block));
+ buf_block_get_zip_size(block),
+ BUF_PAGE_PRINT_NO_CRASH);
}
+ buf_page_print(buf_block_get_frame(block), 0, 0);
}
#ifdef UNIV_BLOB_DEBUG
@@ -1396,9 +1397,11 @@ btr_page_get_father_node_ptr_func(
if (btr_node_ptr_get_child_page_no(node_ptr, offsets) != page_no) {
rec_t* print_rec;
fputs("InnoDB: Dump of the child page:\n", stderr);
- buf_page_print(page_align(user_rec), 0);
+ buf_page_print(page_align(user_rec), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: Dump of the parent page:\n", stderr);
- buf_page_print(page_align(node_ptr), 0);
+ buf_page_print(page_align(node_ptr), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: Corruption of an index tree: table ", stderr);
ut_print_name(stderr, NULL, TRUE, index->table_name);
@@ -1836,8 +1839,9 @@ btr_page_reorganize_low(
max_ins_size2 = page_get_max_insert_size_after_reorganize(page, 1);
if (data_size1 != data_size2 || max_ins_size1 != max_ins_size2) {
- buf_page_print(page, 0);
- buf_page_print(temp_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(temp_page, 0, BUF_PAGE_PRINT_NO_CRASH);
+
fprintf(stderr,
"InnoDB: Error: page old data size %lu"
" new data size %lu\n"
@@ -1848,6 +1852,7 @@ btr_page_reorganize_low(
(unsigned long) data_size1, (unsigned long) data_size2,
(unsigned long) max_ins_size1,
(unsigned long) max_ins_size2);
+ ut_ad(0);
} else {
success = TRUE;
}
@@ -4063,7 +4068,7 @@ btr_index_rec_validate(
(ulong) rec_get_n_fields_old(rec), (ulong) n);
if (dump_on_error) {
- buf_page_print(page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: corrupt record ", stderr);
rec_print_old(stderr, rec);
@@ -4101,7 +4106,8 @@ btr_index_rec_validate(
(ulong) i, (ulong) len, (ulong) fixed_size);
if (dump_on_error) {
- buf_page_print(page, 0);
+ buf_page_print(page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: corrupt record ", stderr);
rec_print_new(stderr, rec, offsets);
@@ -4312,8 +4318,8 @@ loop:
btr_validate_report2(index, level, block, right_block);
fputs("InnoDB: broken FIL_PAGE_NEXT"
" or FIL_PAGE_PREV links\n", stderr);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH);
ret = FALSE;
}
@@ -4321,8 +4327,8 @@ loop:
if (page_is_comp(right_page) != page_is_comp(page)) {
btr_validate_report2(index, level, block, right_block);
fputs("InnoDB: 'compact' flag mismatch\n", stderr);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH);
ret = FALSE;
@@ -4344,8 +4350,8 @@ loop:
fputs("InnoDB: records in wrong order"
" on adjacent pages\n", stderr);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(right_page, 0, BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: record ", stderr);
rec = page_rec_get_prev(page_get_supremum_rec(page));
@@ -4393,8 +4399,8 @@ loop:
fputs("InnoDB: node pointer to the page is wrong\n",
stderr);
- buf_page_print(father_page, 0);
- buf_page_print(page, 0);
+ buf_page_print(father_page, 0, BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: node ptr ", stderr);
rec_print(stderr, node_ptr, index);
@@ -4426,8 +4432,10 @@ loop:
btr_validate_report1(index, level, block);
- buf_page_print(father_page, 0);
- buf_page_print(page, 0);
+ buf_page_print(father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fputs("InnoDB: Error: node ptrs differ"
" on levels > 0\n"
@@ -4472,9 +4480,15 @@ loop:
btr_validate_report1(index, level,
block);
- buf_page_print(father_page, 0);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(
+ father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
}
} else {
page_t* right_father_page
@@ -4492,10 +4506,18 @@ loop:
btr_validate_report1(index, level,
block);
- buf_page_print(father_page, 0);
- buf_page_print(right_father_page, 0);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(
+ father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
}
if (page_get_page_no(right_father_page)
@@ -4509,10 +4531,18 @@ loop:
btr_validate_report1(index, level,
block);
- buf_page_print(father_page, 0);
- buf_page_print(right_father_page, 0);
- buf_page_print(page, 0);
- buf_page_print(right_page, 0);
+ buf_page_print(
+ father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_father_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(
+ right_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
}
}
}
=== modified file 'storage/innobase/btr/btr0sea.cc'
--- a/storage/innobase/btr/btr0sea.cc 2011-11-08 10:32:23 +0000
+++ b/storage/innobase/btr/btr0sea.cc 2012-02-02 10:44:07 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -1216,7 +1216,7 @@ cleanup:
index->name, (ulong) block->n_pointers);
rw_lock_x_unlock(&btr_search_latch);
- btr_search_validate();
+ ut_ad(btr_search_validate());
} else {
rw_lock_x_unlock(&btr_search_latch);
}
@@ -1959,7 +1959,9 @@ btr_search_validate(void)
(ulong) block->curr_left_side);
if (n_page_dumps < 20) {
- buf_page_print(page, 0);
+ buf_page_print(
+ page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
n_page_dumps++;
}
}
=== modified file 'storage/innobase/buf/buf0buf.cc'
--- a/storage/innobase/buf/buf0buf.cc 2012-01-26 11:57:53 +0000
+++ b/storage/innobase/buf/buf0buf.cc 2012-02-02 10:44:07 +0000
@@ -682,25 +682,30 @@ void
buf_page_print(
/*===========*/
const byte* read_buf, /*!< in: a database page */
- ulint zip_size) /*!< in: compressed page size, or
- 0 for uncompressed pages */
+ ulint zip_size, /*!< in: compressed page size, or
+ 0 for uncompressed pages */
+ ulint flags) /*!< in: 0 or
+ BUF_PAGE_PRINT_NO_CRASH or
+ BUF_PAGE_PRINT_NO_FULL */
+
{
#ifndef UNIV_HOTBACKUP
dict_index_t* index;
#endif /* !UNIV_HOTBACKUP */
ulint size = zip_size;
- ut_ad(0);
-
if (!size) {
size = UNIV_PAGE_SIZE;
}
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n",
- (ulong) size);
- ut_print_buf(stderr, read_buf, size);
- fputs("\nInnoDB: End of page dump\n", stderr);
+ if (!(flags & BUF_PAGE_PRINT_NO_FULL)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Page dump in ascii and hex (%lu bytes):\n",
+ (ulong) size);
+ ut_print_buf(stderr, read_buf, size);
+ fputs("\nInnoDB: End of page dump\n", stderr);
+ }
if (zip_size) {
/* Print compressed page. */
@@ -850,6 +855,8 @@ buf_page_print(
stderr);
break;
}
+
+ ut_ad(flags & BUF_PAGE_PRINT_NO_CRASH);
}
#ifndef UNIV_HOTBACKUP
@@ -3952,7 +3959,8 @@ corrupt:
"InnoDB: You may have to recover"
" from a backup.\n",
(ulong) bpage->offset);
- buf_page_print(frame, buf_page_get_zip_size(bpage));
+ buf_page_print(frame, buf_page_get_zip_size(bpage),
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Database page corruption on disk"
" or a failed\n"
=== modified file 'storage/innobase/buf/buf0dblwr.cc'
--- a/storage/innobase/buf/buf0dblwr.cc 2012-01-25 15:07:48 +0000
+++ b/storage/innobase/buf/buf0dblwr.cc 2012-02-02 10:44:07 +0000
@@ -512,12 +512,16 @@ buf_dblwr_init_or_restore_pages(
if (buf_page_is_corrupted(page, zip_size)) {
fprintf(stderr,
"InnoDB: Dump of the page:\n");
- buf_page_print(read_buf, zip_size);
+ buf_page_print(
+ read_buf, zip_size,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Dump of"
" corresponding page"
" in doublewrite buffer:\n");
- buf_page_print(page, zip_size);
+ buf_page_print(
+ page, zip_size,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Also the page in the"
@@ -531,7 +535,7 @@ buf_dblwr_init_or_restore_pages(
"InnoDB: option:\n"
"InnoDB:"
" innodb_force_recovery=6\n");
- exit(1);
+ ut_error;
}
/* Write the good page from the
@@ -654,7 +658,7 @@ buf_dblwr_assert_on_corrupt_block(
/*==============================*/
const buf_block_t* block) /*!< in: block to check */
{
- buf_page_print(block->frame, 0);
+ buf_page_print(block->frame, 0, BUF_PAGE_PRINT_NO_CRASH);
ut_print_timestamp(stderr);
fprintf(stderr,
=== 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-02 10:44:07 +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
@@ -3804,9 +3805,10 @@ ibuf_insert_to_index_page(
"InnoDB: but the number of fields does not match!\n",
stderr);
dump:
- buf_page_print(page, 0);
+ buf_page_print(page, 0, BUF_PAGE_PRINT_NO_CRASH);
dtuple_print(stderr, entry);
+ ut_ad(0);
fputs("InnoDB: The table where where"
" this index record belongs\n"
@@ -4373,12 +4375,14 @@ ibuf_merge_or_delete_for_page(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
zip_size, &mtr);
- buf_page_print(bitmap_page, 0);
+ buf_page_print(bitmap_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
ibuf_mtr_commit(&mtr);
fputs("\nInnoDB: Dump of the page:\n", stderr);
- buf_page_print(block->frame, 0);
+ buf_page_print(block->frame, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"InnoDB: Error: corruption in the tablespace."
@@ -4398,6 +4402,7 @@ ibuf_merge_or_delete_for_page(
(ulong) page_no,
(ulong)
fil_page_get_type(block->frame));
+ ut_ad(0);
}
}
=== modified file 'storage/innobase/include/btr0btr.ic'
--- a/storage/innobase/include/btr0btr.ic 2011-11-09 02:40:33 +0000
+++ b/storage/innobase/include/btr0btr.ic 2012-02-02 10:44:07 +0000
@@ -277,7 +277,7 @@ btr_node_ptr_get_child_page_no(
"InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n",
(ulong) page_offset(rec));
- buf_page_print(page_align(rec), 0);
+ buf_page_print(page_align(rec), 0, 0);
}
return(page_no);
=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h 2011-12-12 12:55:18 +0000
+++ b/storage/innobase/include/buf0buf.h 2012-02-02 10:44:07 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -694,6 +694,13 @@ buf_print(void);
/*============*/
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
#endif /* !UNIV_HOTBACKUP */
+enum buf_page_print_flags {
+ /** Do not crash at the end of buf_page_print(). */
+ BUF_PAGE_PRINT_NO_CRASH = 1,
+ /** Do not print the full page dump. */
+ BUF_PAGE_PRINT_NO_FULL = 2
+};
+
/********************************************************************//**
Prints a page to stderr. */
UNIV_INTERN
@@ -701,8 +708,11 @@ void
buf_page_print(
/*===========*/
const byte* read_buf, /*!< in: a database page */
- ulint zip_size) /*!< in: compressed page size, or
+ ulint zip_size, /*!< in: compressed page size, or
0 for uncompressed pages */
+ ulint flags) /*!< in: 0 or
+ BUF_PAGE_PRINT_NO_CRASH or
+ BUF_PAGE_PRINT_NO_FULL */
UNIV_COLD __attribute__((nonnull));
/********************************************************************//**
Decompress a block.
=== modified file 'storage/innobase/include/page0page.ic'
--- a/storage/innobase/include/page0page.ic 2011-11-30 10:27:10 +0000
+++ b/storage/innobase/include/page0page.ic 2012-02-02 10:44:07 +0000
@@ -740,7 +740,7 @@ page_rec_get_next_low(
(void*) rec,
(ulong) page_get_space_id(page),
(ulong) page_get_page_no(page));
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
ut_error;
} else if (offs == 0) {
=== 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
=== modified file 'storage/innobase/lock/lock0lock.cc'
--- a/storage/innobase/lock/lock0lock.cc 2012-01-27 04:18:55 +0000
+++ b/storage/innobase/lock/lock0lock.cc 2012-02-02 10:44:07 +0000
@@ -1671,7 +1671,7 @@ lock_sec_rec_some_has_impl(
} else if (!lock_check_trx_id_sanity(max_trx_id, rec, index, offsets)) {
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
/* The page is corrupt: try to avoid a crash by returning 0 */
trx_id = 0;
=== modified file 'storage/innobase/page/page0cur.cc'
--- a/storage/innobase/page/page0cur.cc 2011-11-20 20:17:41 +0000
+++ b/storage/innobase/page/page0cur.cc 2012-02-02 10:44:07 +0000
@@ -901,7 +901,7 @@ page_cur_parse_insert_rec(
ut_print_buf(stderr, ptr2, 300);
putc('\n', stderr);
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
ut_error;
}
=== modified file 'storage/innobase/page/page0page.cc'
--- a/storage/innobase/page/page0page.cc 2012-01-26 11:57:53 +0000
+++ b/storage/innobase/page/page0page.cc 2012-02-02 10:44:07 +0000
@@ -148,7 +148,7 @@ page_dir_find_owner_slot(
fputs("\n"
"InnoDB: on that page!\n", stderr);
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
ut_error;
}
@@ -569,8 +569,10 @@ page_copy_rec_list_end_no_locks(
/* Track an assertion failure reported on the mailing
list on June 18th, 2003 */
- buf_page_print(new_page, 0);
- buf_page_print(page_align(rec), 0);
+ buf_page_print(new_page, 0,
+ BUF_PAGE_PRINT_NO_CRASH);
+ buf_page_print(page_align(rec), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -1831,7 +1833,7 @@ page_check_dir(
fprintf(stderr,
"InnoDB: Page directory corruption:"
" infimum not pointed to\n");
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
}
if (UNIV_UNLIKELY(!page_rec_is_supremum_low(supremum_offs))) {
@@ -1839,7 +1841,7 @@ page_check_dir(
fprintf(stderr,
"InnoDB: Page directory corruption:"
" supremum not pointed to\n");
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
}
}
#endif /* !UNIV_HOTBACKUP */
@@ -2543,7 +2545,7 @@ func_exit2:
(ulong) page_get_space_id(page),
(ulong) page_get_page_no(page),
index->name);
- buf_page_print(page, 0);
+ buf_page_print(page, 0, 0);
}
return(ret);
=== modified file 'storage/innobase/row/row0merge.cc'
--- a/storage/innobase/row/row0merge.cc 2012-01-18 15:39:14 +0000
+++ b/storage/innobase/row/row0merge.cc 2012-02-02 12:00:50 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -664,7 +664,7 @@ row_merge_buf_write(
REC_STATUS_ORDINARY,
entry, n_fields,
&extra_size);
- ut_ad(size > extra_size);
+ ut_ad(size >= extra_size);
ut_ad(extra_size >= REC_N_NEW_EXTRA_BYTES);
extra_size -= REC_N_NEW_EXTRA_BYTES;
size -= REC_N_NEW_EXTRA_BYTES;
=== modified file 'storage/innobase/row/row0sel.cc'
--- a/storage/innobase/row/row0sel.cc 2012-01-26 11:57:53 +0000
+++ b/storage/innobase/row/row0sel.cc 2012-02-02 10:44:07 +0000
@@ -4286,7 +4286,8 @@ rec_loop:
wrong_offs:
if (srv_force_recovery == 0 || moves_up == FALSE) {
ut_print_timestamp(stderr);
- buf_page_print(page_align(rec), 0);
+ buf_page_print(page_align(rec), 0,
+ BUF_PAGE_PRINT_NO_CRASH);
fprintf(stderr,
"\nInnoDB: rec address %p,"
" buf block fix count %lu\n",
@@ -4305,7 +4306,7 @@ wrong_offs:
"InnoDB: restore from a backup, or"
" dump + drop + reimport the table.\n",
stderr);
-
+ ut_ad(0);
err = DB_CORRUPTION;
goto lock_wait_or_error;
=== modified file 'storage/innobase/srv/srv0mon.cc'
--- a/storage/innobase/srv/srv0mon.cc 2011-12-19 08:43:28 +0000
+++ b/storage/innobase/srv/srv0mon.cc 2012-02-02 09:23:51 +0000
@@ -720,7 +720,7 @@ static monitor_info_t innodb_counter_inf
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_NUM_UNDO_SLOT_CACHED},
- {"trx_rseg_curent_size", "transaction",
+ {"trx_rseg_current_size", "transaction",
"Current rollback segment size in pages",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT),
=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc 2012-01-31 15:16:16 +0000
+++ b/storage/myisam/ha_myisam.cc 2012-02-02 12:48:48 +0000
@@ -78,10 +78,10 @@ static MYSQL_THDVAR_ULONG(repair_threads
"disables parallel repair", NULL, NULL,
1, 1, ULONG_MAX, 1);
-static MYSQL_THDVAR_ULONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
+static MYSQL_THDVAR_ULONGLONG(sort_buffer_size, PLUGIN_VAR_RQCMDARG,
"The buffer that is allocated when sorting the index when doing "
"a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE", NULL, NULL,
- 8192*1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), ULONG_MAX, 1);
+ 8192 * 1024, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), SIZE_T_MAX, 1);
static MYSQL_SYSVAR_BOOL(use_mmap, opt_myisam_use_mmap, PLUGIN_VAR_NOCMDARG,
"Use memory mapping for reading and writing MyISAM tables", NULL, NULL, FALSE);
=== modified file 'storage/myisam/ha_myisam.h'
--- a/storage/myisam/ha_myisam.h 2011-11-08 11:37:54 +0000
+++ b/storage/myisam/ha_myisam.h 2012-02-02 12:48:48 +0000
@@ -31,7 +31,6 @@ typedef struct st_ha_create_information
#define HA_RECOVER_QUICK 8 /* Don't check rows in data file */
#define HA_RECOVER_OFF 16 /* No automatic recover */
-extern ulong myisam_sort_buffer_size;
extern TYPELIB myisam_recover_typelib;
extern const char *myisam_recover_names[];
extern ulonglong myisam_recover_options;
=== modified file 'storage/myisam/mi_check.c'
--- a/storage/myisam/mi_check.c 2011-09-26 12:42:12 +0000
+++ b/storage/myisam/mi_check.c 2012-02-02 12:48:48 +0000
@@ -2429,7 +2429,7 @@ int mi_repair_by_sort(MI_CHECK *param, r
if (_create_index_by_sort(&sort_param,
(my_bool) (!(param->testflag & T_VERBOSE)),
- (uint) param->sort_buffer_length))
+ param->sort_buffer_length))
{
param->retry_repair=1;
goto err;
@@ -4303,14 +4303,6 @@ int recreate_table(MI_CHECK *param, MI_I
u_ptr->seg=keyseg;
keyseg+=u_ptr->keysegs+1;
}
- if (share.options & HA_OPTION_COMPRESS_RECORD)
- share.base.records=max_records=info.state->records;
- else if (share.base.min_pack_length)
- max_records=(ha_rows) (mysql_file_seek(info.dfile, 0L, MY_SEEK_END,
- MYF(0)) /
- (ulong) share.base.min_pack_length);
- else
- max_records=0;
unpack= (share.options & HA_OPTION_COMPRESS_RECORD) &&
(param->testflag & T_UNPACK);
share.options&= ~HA_OPTION_TEMP_COMPRESS_RECORD;
@@ -4320,10 +4312,17 @@ int recreate_table(MI_CHECK *param, MI_I
set_if_bigger(file_length,param->max_data_file_length);
set_if_bigger(file_length,tmp_length);
set_if_bigger(file_length,(ulonglong) share.base.max_data_file_length);
+
+ if (share.options & HA_OPTION_COMPRESS_RECORD)
+ share.base.records= max_records= info.state->records;
+ else if (!(share.options & HA_OPTION_PACK_RECORD))
+ max_records= (ha_rows) (file_length / share.base.pack_reclength);
+ else
+ max_records= 0;
(void) mi_close(*org_info);
memset(&create_info, 0, sizeof(create_info));
- create_info.max_rows= MY_MAX(max_records, share.base.records);
+ create_info.max_rows= max_records;
create_info.reloc_rows=share.base.reloc;
create_info.old_options=(share.options |
(unpack ? HA_OPTION_TEMP_COMPRESS_RECORD : 0));
=== modified file 'storage/myisam/myisamchk.c'
--- a/storage/myisam/myisamchk.c 2011-06-30 15:50:45 +0000
+++ b/storage/myisam/myisamchk.c 2012-02-02 12:48:48 +0000
@@ -297,9 +297,9 @@ static struct my_option my_long_options[
INT_MAX32, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "",
&check_param.sort_buffer_length,
- &check_param.sort_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
+ &check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG,
(long) SORT_BUFFER_INIT, (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD),
- ULONG_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ SIZE_T_MAX, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "",
&check_param.sort_key_blocks,
&check_param.sort_key_blocks, 0, GET_ULONG, REQUIRED_ARG,
=== modified file 'storage/myisam/myisamdef.h'
--- a/storage/myisam/myisamdef.h 2011-07-04 00:25:46 +0000
+++ b/storage/myisam/myisamdef.h 2012-02-02 12:48:48 +0000
@@ -326,9 +326,10 @@ typedef struct st_mi_sort_param
*/
ulonglong unique[MI_MAX_KEY_SEG+1];
ulonglong notnull[MI_MAX_KEY_SEG+1];
+ ulonglong sortbuff_size;
my_off_t pos,max_pos,filepos,start_recpos;
- uint key, key_length,real_key_length,sortbuff_size;
+ uint key, key_length,real_key_length;
uint maxbuffers, keys, find_length, sort_keys_length;
my_bool fix_datafile, master;
my_bool calc_checksum; /* calculate table checksum */
@@ -779,7 +780,7 @@ pthread_handler_t thr_find_all_keys(void
int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
int sort_write_record(MI_SORT_PARAM *sort_param);
-int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ulong);
+int _create_index_by_sort(MI_SORT_PARAM *info, my_bool no_messages, ulonglong);
extern void mi_set_index_cond_func(MI_INFO *info, index_cond_func_t func,
void *func_arg);
=== modified file 'storage/myisam/sort.c'
--- a/storage/myisam/sort.c 2011-08-29 12:08:58 +0000
+++ b/storage/myisam/sort.c 2012-02-02 12:48:48 +0000
@@ -99,10 +99,11 @@ my_var_write(MI_SORT_PARAM *info, IO_CAC
*/
int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
- ulong sortbuff_size)
+ ulonglong sortbuff_size)
{
int error,maxbuffer,skr;
- uint memavl,old_memavl,keys,sort_length;
+ uint sort_length, keys;
+ ulonglong memavl, old_memavl;
DYNAMIC_ARRAY buffpek;
ha_rows records;
uchar **sort_keys;
@@ -134,6 +135,9 @@ int _create_index_by_sort(MI_SORT_PARAM
sort_length= info->key_length;
LINT_INIT(keys);
+ if ((memavl - sizeof(BUFFPEK)) / (sort_length + sizeof(char *)) > UINT_MAX32)
+ memavl= sizeof(BUFFPEK) + UINT_MAX32 * (sort_length + sizeof(char *));
+
while (memavl >= MIN_SORT_BUFFER)
{
if ((records < UINT_MAX32) &&
@@ -308,7 +312,8 @@ pthread_handler_t thr_find_all_keys(void
{
MI_SORT_PARAM *sort_param= (MI_SORT_PARAM*) arg;
int error;
- uint memavl,old_memavl,keys,sort_length;
+ ulonglong memavl, old_memavl;
+ uint keys, sort_length;
uint idx, maxbuffer;
uchar **sort_keys=0;
@@ -349,6 +354,10 @@ pthread_handler_t thr_find_all_keys(void
sort_length= sort_param->key_length;
maxbuffer= 1;
+ if ((memavl - sizeof(BUFFPEK)) / (sort_length +
+ sizeof(char *)) > UINT_MAX32)
+ memavl= sizeof(BUFFPEK) + UINT_MAX32 * (sort_length + sizeof(char *));
+
while (memavl >= MIN_SORT_BUFFER)
{
if ((my_off_t) (idx+1)*(sort_length+sizeof(char*)) <=
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5767 branch (mayank.prasad:3428 to 3429) WL#5767 | Mayank Prasad | 6 Feb |