3364 Marc Alff 2012-01-30 [merge]
Merge mysql-trunk --> mysql-trunk-wl5259
renamed:
mysql-test/suite/sys_vars/r/innodb_sort_buf_size_basic.result => mysql-test/suite/sys_vars/r/innodb_sort_buffer_size_basic.result
mysql-test/suite/sys_vars/t/innodb_sort_buf_size_basic.test => mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test
modified:
mysql-test/include/func_in.inc
mysql-test/include/range.inc
mysql-test/r/func_in_all.result
mysql-test/r/func_in_icp.result
mysql-test/r/func_in_icp_mrr.result
mysql-test/r/func_in_mrr.result
mysql-test/r/func_in_mrr_cost.result
mysql-test/r/func_in_none.result
mysql-test/r/lowercase_fs_off.result
mysql-test/r/merge.result
mysql-test/r/optimizer_debug_sync.result
mysql-test/r/plugin.result
mysql-test/r/range_all.result
mysql-test/r/range_icp.result
mysql-test/r/range_icp_mrr.result
mysql-test/r/range_mrr.result
mysql-test/r/range_mrr_cost.result
mysql-test/r/range_none.result
mysql-test/r/sp-security.result
mysql-test/r/sp.result
mysql-test/suite/opt_trace/include/range.inc
mysql-test/suite/parts/inc/partition-dml-1-7.inc
mysql-test/suite/parts/inc/partition-dml-1-8.inc
mysql-test/suite/parts/inc/partition_key_16col.inc
mysql-test/suite/parts/inc/partition_key_32col.inc
mysql-test/suite/parts/inc/partition_key_4col.inc
mysql-test/suite/parts/inc/partition_key_8col.inc
mysql-test/suite/parts/r/partition_special_myisam.result
mysql-test/t/merge.test
mysql-test/t/optimizer_debug_sync.test
mysql-test/t/plugin.test
mysql-test/t/sp-security.test
mysql-test/t/sp.test
mysql-test/t/temp_table.test
mysql-test/valgrind.supp
sql/handler.cc
sql/handler.h
sql/item.cc
sql/item_cmpfunc.h
sql/item_func.cc
sql/item_func.h
sql/mysqld.cc
sql/opt_explain.cc
sql/opt_range.cc
sql/sql_parse.cc
storage/example/ha_example.cc
storage/innobase/btr/btr0btr.cc
storage/innobase/btr/btr0cur.cc
storage/innobase/buf/buf0buf.cc
storage/innobase/handler/ha_innodb.cc
storage/innobase/ibuf/ibuf0ibuf.cc
storage/innobase/include/btr0btr.h
storage/innobase/include/mtr0log.ic
storage/innobase/lock/lock0lock.cc
storage/innobase/page/page0page.cc
storage/innobase/row/row0ins.cc
storage/innobase/row/row0sel.cc
storage/innobase/row/row0umod.cc
storage/innobase/row/row0upd.cc
storage/innobase/srv/srv0srv.cc
storage/innobase/trx/trx0purge.cc
storage/innobase/trx/trx0rec.cc
storage/myisammrg/ha_myisammrg.cc
storage/perfschema/pfs_instr_class.cc
storage/perfschema/pfs_instr_class.h
storage/perfschema/pfs_server.cc
mysql-test/suite/sys_vars/r/innodb_sort_buffer_size_basic.result
mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test
3363 Marc Alff 2012-01-30
work in progress, tests
added:
mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_again_allow.result
mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_bad_allow.result
mysql-test/suite/perfschema/r/hostcache_ipv6_addrinfo_noname_allow.result
mysql-test/suite/perfschema/r/hostcache_ipv6_auth_plugin.result
mysql-test/suite/perfschema/r/hostcache_ipv6_max_con.result
mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_again_allow.result
mysql-test/suite/perfschema/r/hostcache_ipv6_nameinfo_noname_allow.result
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow-master.opt
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_again_allow.test
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow-master.opt
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_bad_allow.test
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow-master.opt
mysql-test/suite/perfschema/t/hostcache_ipv6_addrinfo_noname_allow.test
mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin-master.opt
mysql-test/suite/perfschema/t/hostcache_ipv6_auth_plugin.test
mysql-test/suite/perfschema/t/hostcache_ipv6_max_con-master.opt
mysql-test/suite/perfschema/t/hostcache_ipv6_max_con.test
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow-master.opt
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_again_allow.test
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow-master.opt
mysql-test/suite/perfschema/t/hostcache_ipv6_nameinfo_noname_allow.test
modified:
mysql-test/suite/perfschema/r/hostcache_ipv4_addrinfo_again_allow.result
mysql-test/suite/perfschema/r/hostcache_ipv4_auth_plugin.result
mysql-test/suite/perfschema/r/hostcache_ipv4_max_con.result
mysql-test/suite/perfschema/t/hostcache_ipv4_addrinfo_again_allow.test
mysql-test/suite/perfschema/t/hostcache_ipv4_auth_plugin.test
mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test
storage/perfschema/table_host_cache.cc
=== modified file 'mysql-test/include/func_in.inc'
--- a/mysql-test/include/func_in.inc 2011-04-12 10:31:30 +0000
+++ b/mysql-test/include/func_in.inc 2012-01-30 06:39:02 +0000
@@ -609,4 +609,12 @@ INSERT INTO t1 VALUES (0000),(2001);
--disable_metadata
DROP TABLE t1;
+--echo #
+--echo # Bug #11764651-57510: IN(string,real,string) causes invalid read in sort function
+--echo #
+
+SELECT LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"");
+
+--echo # End of test BUG#11764651-57510
+
--echo End of 5.1 tests
=== modified file 'mysql-test/include/range.inc'
--- a/mysql-test/include/range.inc 2011-12-09 15:06:50 +0000
+++ b/mysql-test/include/range.inc 2012-01-26 10:08:12 +0000
@@ -1392,6 +1392,82 @@ SELECT * FROM t1, t1 as t2 WHERE t1.i4 B
DROP TABLE t1;
+--echo #
+--echo # BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+--echo # WITH/WITHOUT INDEX RANGE SCAN
+--echo #
+
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+ id int unsigned not null auto_increment,
+ val decimal(5,3) not null,
+ primary key (id,val),
+ unique key (val,id),
+ unique key (id));
+--disable_warnings
+insert into t2 select null,id*0.0009 from t1;
+--enable_warnings
+
+select count(val) from t2 ignore index (val) where val > 0.1155;
+select count(val) from t2 force index (val) where val > 0.1155;
+
+drop table t2, t1;
+
+--echo #
+--echo # BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+--echo # RESULTS WITH DECIMAL CONVERSION
+--echo #
+
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+# show that the integer 3 is bigger than the decimal 2.9,
+# which should also apply to comparing "c" with 2.9
+# when c is 3.
+select convert(3, signed integer) > 2.9;
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+select * from t1 force index (primary) where a=1 and c> 2.9;
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+drop table t1;
+
+--echo #
+--echo # BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+--echo # RESULT AFTER MYSQL 5.1.
+--echo #
+
+CREATE TABLE t1(
+ F1 CHAR(5) NOT NULL,
+ F2 CHAR(5) NOT NULL,
+ F3 CHAR(5) NOT NULL,
+ PRIMARY KEY(F1),
+ INDEX IDX_F2(F2)
+);
+
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+
+SELECT * FROM t1 WHERE F1 = 'A ';
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+SELECT * FROM t1 WHERE F1 >= 'A ';
+SELECT * FROM t1 WHERE F1 > 'A ';
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
#
=== modified file 'mysql-test/r/func_in_all.result'
--- a/mysql-test/r/func_in_all.result 2012-01-25 09:57:22 +0000
+++ b/mysql-test/r/func_in_all.result 2012-01-30 06:39:02 +0000
@@ -817,5 +817,12 @@ def MAX(f1) MAX(f1) 13 4 4 Y 32864 0
MAX(f1)
2001
DROP TABLE t1;
+#
+# Bug #11764651-57510: IN(string,real,string) causes invalid read in sort function
+#
+SELECT LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"");
+LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"")
+0
+# End of test BUG#11764651-57510
End of 5.1 tests
set optimizer_switch=default;
=== modified file 'mysql-test/r/func_in_icp.result'
--- a/mysql-test/r/func_in_icp.result 2012-01-25 09:57:22 +0000
+++ b/mysql-test/r/func_in_icp.result 2012-01-30 06:39:02 +0000
@@ -819,5 +819,12 @@ def MAX(f1) MAX(f1) 13 4 4 Y 32864 0
MAX(f1)
2001
DROP TABLE t1;
+#
+# Bug #11764651-57510: IN(string,real,string) causes invalid read in sort function
+#
+SELECT LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"");
+LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"")
+0
+# End of test BUG#11764651-57510
End of 5.1 tests
set optimizer_switch=default;
=== modified file 'mysql-test/r/func_in_icp_mrr.result'
--- a/mysql-test/r/func_in_icp_mrr.result 2012-01-25 09:57:22 +0000
+++ b/mysql-test/r/func_in_icp_mrr.result 2012-01-30 06:39:02 +0000
@@ -819,5 +819,12 @@ def MAX(f1) MAX(f1) 13 4 4 Y 32864 0
MAX(f1)
2001
DROP TABLE t1;
+#
+# Bug #11764651-57510: IN(string,real,string) causes invalid read in sort function
+#
+SELECT LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"");
+LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"")
+0
+# End of test BUG#11764651-57510
End of 5.1 tests
set optimizer_switch=default;
=== modified file 'mysql-test/r/func_in_mrr.result'
--- a/mysql-test/r/func_in_mrr.result 2012-01-25 09:57:22 +0000
+++ b/mysql-test/r/func_in_mrr.result 2012-01-30 06:39:02 +0000
@@ -819,5 +819,12 @@ def MAX(f1) MAX(f1) 13 4 4 Y 32864 0
MAX(f1)
2001
DROP TABLE t1;
+#
+# Bug #11764651-57510: IN(string,real,string) causes invalid read in sort function
+#
+SELECT LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"");
+LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"")
+0
+# End of test BUG#11764651-57510
End of 5.1 tests
set optimizer_switch=default;
=== modified file 'mysql-test/r/func_in_mrr_cost.result'
--- a/mysql-test/r/func_in_mrr_cost.result 2012-01-25 09:57:22 +0000
+++ b/mysql-test/r/func_in_mrr_cost.result 2012-01-30 06:39:02 +0000
@@ -819,5 +819,12 @@ def MAX(f1) MAX(f1) 13 4 4 Y 32864 0
MAX(f1)
2001
DROP TABLE t1;
+#
+# Bug #11764651-57510: IN(string,real,string) causes invalid read in sort function
+#
+SELECT LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"");
+LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"")
+0
+# End of test BUG#11764651-57510
End of 5.1 tests
set optimizer_switch=default;
=== modified file 'mysql-test/r/func_in_none.result'
--- a/mysql-test/r/func_in_none.result 2012-01-25 09:57:22 +0000
+++ b/mysql-test/r/func_in_none.result 2012-01-30 06:39:02 +0000
@@ -818,5 +818,12 @@ def MAX(f1) MAX(f1) 13 4 4 Y 32864 0
MAX(f1)
2001
DROP TABLE t1;
+#
+# Bug #11764651-57510: IN(string,real,string) causes invalid read in sort function
+#
+SELECT LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"");
+LEFT(GEOMFROMTEXT("POINT(0 0)"),1) IN (@@global.query_cache_type,1,"")
+0
+# End of test BUG#11764651-57510
End of 5.1 tests
set optimizer_switch=default;
=== modified file 'mysql-test/r/lowercase_fs_off.result'
--- a/mysql-test/r/lowercase_fs_off.result 2010-09-16 09:11:13 +0000
+++ b/mysql-test/r/lowercase_fs_off.result 2012-01-30 06:59:39 +0000
@@ -44,7 +44,7 @@ f1(1)
call p1();
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
call P1();
-ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
+ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.P1'
select f1(1);
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.f1'
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
=== modified file 'mysql-test/r/merge.result'
--- a/mysql-test/r/merge.result 2012-01-12 13:27:57 +0000
+++ b/mysql-test/r/merge.result 2012-01-27 08:16:43 +0000
@@ -3801,3 +3801,23 @@ ERROR HY000: Unable to open underlying t
DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE m1;
+#
+# Test for bug #11764786 - 57657: TEMPORARY MERGE TABLE WITH TEMPORARY
+# UNDERLYING TABLE, IS BROKEN BY ALTER.
+#
+DROP TABLES IF EXISTS t1, t2, t3, t4;
+CREATE TEMPORARY TABLE t1(i INT) ENGINE= MyISAM;
+CREATE TEMPORARY TABLE t2(i INT) ENGINE= MERGE UNION= (t1) INSERT_METHOD= LAST;
+ALTER TABLE t2 INSERT_METHOD= FIRST;
+CHECK TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 check status OK
+CREATE TABLE t3(i INT) ENGINE= MyISAM;
+CREATE TABLE t4(i int) ENGINE= MERGE UNION= (t3) INSERT_METHOD= LAST;
+ALTER TABLE t4 INSERT_METHOD= FIRST;
+CHECK TABLE t4;
+Table Op Msg_type Msg_text
+test.t4 check status OK
+# Clean-up
+DROP TABLES t1, t2, t3, t4;
+# End of bug #11764786 - 57657
=== modified file 'mysql-test/r/optimizer_debug_sync.result'
--- a/mysql-test/r/optimizer_debug_sync.result 2011-03-01 14:57:53 +0000
+++ b/mysql-test/r/optimizer_debug_sync.result 2012-01-26 11:34:35 +0000
@@ -21,3 +21,20 @@ MAX(i)
MAX(i)
2
DROP TABLE t;
+#
+# 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/plugin.result'
--- a/mysql-test/r/plugin.result 2011-10-27 08:43:56 +0000
+++ b/mysql-test/r/plugin.result 2012-01-26 12:39:35 +0000
@@ -8,8 +8,30 @@ INSTALL PLUGIN EXAMPLE SONAME 'ha_exampl
ERROR HY000: Function 'EXAMPLE' already exists
UNINSTALL PLUGIN example;
INSTALL PLUGIN example SONAME 'ha_example.so';
+# Example engine does not support indexes
+CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=EXAMPLE;
+ERROR 42000: Too many key parts specified; max 0 parts allowed
+CREATE TABLE t1 (a int, KEY (a)) ENGINE=EXAMPLE;
+ERROR 42000: Too many key parts specified; max 0 parts allowed
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=EXAMPLE DEFAULT CHARSET=latin1
+# Let's do some advanced ops with the example engine :)
+INSERT INTO t1 VALUES (0);
+# Only supports table scans (and does always return zero rows :)
SELECT * FROM t1;
+a
+SELECT * FROM t1 WHERE a = 0;
+a
+# Since there are no rows found, it will never do update_row.
+UPDATE t1 SET a = 1 WHERE a = 0;
+# Since there are no rows found, it will never do delete_row.
+DELETE FROM t1 WHERE a = 0;
+# No support for SQL HANDLER statement
+HANDLER t1 OPEN;
ERROR HY000: Table storage engine for 't1' doesn't have this option
DROP TABLE t1;
set global example_ulong_var=500;
=== modified file 'mysql-test/r/range_all.result'
--- a/mysql-test/r/range_all.result 2011-12-09 15:06:50 +0000
+++ b/mysql-test/r/range_all.result 2012-01-26 10:08:12 +0000
@@ -1768,6 +1768,123 @@ id select_type table type possible_keys
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
+#
+# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+# WITH/WITHOUT INDEX RANGE SCAN
+#
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+id int unsigned not null auto_increment,
+val decimal(5,3) not null,
+primary key (id,val),
+unique key (val,id),
+unique key (id));
+insert into t2 select null,id*0.0009 from t1;
+select count(val) from t2 ignore index (val) where val > 0.1155;
+count(val)
+128
+select count(val) from t2 force index (val) where val > 0.1155;
+count(val)
+128
+drop table t2, t1;
+#
+# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+# RESULTS WITH DECIMAL CONVERSION
+#
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+select convert(3, signed integer) > 2.9;
+convert(3, signed integer) > 2.9
+1
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 force index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+drop table t1;
+#
+# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+# RESULT AFTER MYSQL 5.1.
+#
+CREATE TABLE t1(
+F1 CHAR(5) NOT NULL,
+F2 CHAR(5) NOT NULL,
+F3 CHAR(5) NOT NULL,
+PRIMARY KEY(F1),
+INDEX IDX_F2(F2)
+);
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+SELECT * FROM t1 WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 WHERE F1 >= 'A ';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 > 'A ';
+F1 F2 F3
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
INSERT INTO t1 VALUES (1),(2),(3);
=== modified file 'mysql-test/r/range_icp.result'
--- a/mysql-test/r/range_icp.result 2011-12-09 15:06:50 +0000
+++ b/mysql-test/r/range_icp.result 2012-01-26 10:08:12 +0000
@@ -1768,6 +1768,123 @@ id select_type table type possible_keys
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
+#
+# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+# WITH/WITHOUT INDEX RANGE SCAN
+#
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+id int unsigned not null auto_increment,
+val decimal(5,3) not null,
+primary key (id,val),
+unique key (val,id),
+unique key (id));
+insert into t2 select null,id*0.0009 from t1;
+select count(val) from t2 ignore index (val) where val > 0.1155;
+count(val)
+128
+select count(val) from t2 force index (val) where val > 0.1155;
+count(val)
+128
+drop table t2, t1;
+#
+# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+# RESULTS WITH DECIMAL CONVERSION
+#
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+select convert(3, signed integer) > 2.9;
+convert(3, signed integer) > 2.9
+1
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 force index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+drop table t1;
+#
+# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+# RESULT AFTER MYSQL 5.1.
+#
+CREATE TABLE t1(
+F1 CHAR(5) NOT NULL,
+F2 CHAR(5) NOT NULL,
+F3 CHAR(5) NOT NULL,
+PRIMARY KEY(F1),
+INDEX IDX_F2(F2)
+);
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+SELECT * FROM t1 WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 WHERE F1 >= 'A ';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 > 'A ';
+F1 F2 F3
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
INSERT INTO t1 VALUES (1),(2),(3);
=== modified file 'mysql-test/r/range_icp_mrr.result'
--- a/mysql-test/r/range_icp_mrr.result 2011-12-09 15:06:50 +0000
+++ b/mysql-test/r/range_icp_mrr.result 2012-01-26 10:08:12 +0000
@@ -1768,6 +1768,123 @@ id select_type table type possible_keys
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
+#
+# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+# WITH/WITHOUT INDEX RANGE SCAN
+#
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+id int unsigned not null auto_increment,
+val decimal(5,3) not null,
+primary key (id,val),
+unique key (val,id),
+unique key (id));
+insert into t2 select null,id*0.0009 from t1;
+select count(val) from t2 ignore index (val) where val > 0.1155;
+count(val)
+128
+select count(val) from t2 force index (val) where val > 0.1155;
+count(val)
+128
+drop table t2, t1;
+#
+# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+# RESULTS WITH DECIMAL CONVERSION
+#
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+select convert(3, signed integer) > 2.9;
+convert(3, signed integer) > 2.9
+1
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 force index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+drop table t1;
+#
+# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+# RESULT AFTER MYSQL 5.1.
+#
+CREATE TABLE t1(
+F1 CHAR(5) NOT NULL,
+F2 CHAR(5) NOT NULL,
+F3 CHAR(5) NOT NULL,
+PRIMARY KEY(F1),
+INDEX IDX_F2(F2)
+);
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+SELECT * FROM t1 WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 WHERE F1 >= 'A ';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 > 'A ';
+F1 F2 F3
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
INSERT INTO t1 VALUES (1),(2),(3);
=== modified file 'mysql-test/r/range_mrr.result'
--- a/mysql-test/r/range_mrr.result 2011-12-09 15:06:50 +0000
+++ b/mysql-test/r/range_mrr.result 2012-01-26 10:08:12 +0000
@@ -1768,6 +1768,123 @@ id select_type table type possible_keys
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
+#
+# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+# WITH/WITHOUT INDEX RANGE SCAN
+#
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+id int unsigned not null auto_increment,
+val decimal(5,3) not null,
+primary key (id,val),
+unique key (val,id),
+unique key (id));
+insert into t2 select null,id*0.0009 from t1;
+select count(val) from t2 ignore index (val) where val > 0.1155;
+count(val)
+128
+select count(val) from t2 force index (val) where val > 0.1155;
+count(val)
+128
+drop table t2, t1;
+#
+# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+# RESULTS WITH DECIMAL CONVERSION
+#
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+select convert(3, signed integer) > 2.9;
+convert(3, signed integer) > 2.9
+1
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 force index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+drop table t1;
+#
+# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+# RESULT AFTER MYSQL 5.1.
+#
+CREATE TABLE t1(
+F1 CHAR(5) NOT NULL,
+F2 CHAR(5) NOT NULL,
+F3 CHAR(5) NOT NULL,
+PRIMARY KEY(F1),
+INDEX IDX_F2(F2)
+);
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+SELECT * FROM t1 WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 WHERE F1 >= 'A ';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 > 'A ';
+F1 F2 F3
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
INSERT INTO t1 VALUES (1),(2),(3);
=== modified file 'mysql-test/r/range_mrr_cost.result'
--- a/mysql-test/r/range_mrr_cost.result 2011-12-09 15:06:50 +0000
+++ b/mysql-test/r/range_mrr_cost.result 2012-01-26 10:08:12 +0000
@@ -1768,6 +1768,123 @@ id select_type table type possible_keys
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
+#
+# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+# WITH/WITHOUT INDEX RANGE SCAN
+#
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+id int unsigned not null auto_increment,
+val decimal(5,3) not null,
+primary key (id,val),
+unique key (val,id),
+unique key (id));
+insert into t2 select null,id*0.0009 from t1;
+select count(val) from t2 ignore index (val) where val > 0.1155;
+count(val)
+128
+select count(val) from t2 force index (val) where val > 0.1155;
+count(val)
+128
+drop table t2, t1;
+#
+# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+# RESULTS WITH DECIMAL CONVERSION
+#
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+select convert(3, signed integer) > 2.9;
+convert(3, signed integer) > 2.9
+1
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 force index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+drop table t1;
+#
+# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+# RESULT AFTER MYSQL 5.1.
+#
+CREATE TABLE t1(
+F1 CHAR(5) NOT NULL,
+F2 CHAR(5) NOT NULL,
+F3 CHAR(5) NOT NULL,
+PRIMARY KEY(F1),
+INDEX IDX_F2(F2)
+);
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+SELECT * FROM t1 WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 WHERE F1 >= 'A ';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 > 'A ';
+F1 F2 F3
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
INSERT INTO t1 VALUES (1),(2),(3);
=== modified file 'mysql-test/r/range_none.result'
--- a/mysql-test/r/range_none.result 2011-12-09 15:06:50 +0000
+++ b/mysql-test/r/range_none.result 2012-01-26 10:08:12 +0000
@@ -1767,6 +1767,123 @@ id select_type table type possible_keys
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
+#
+# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
+# WITH/WITHOUT INDEX RANGE SCAN
+#
+create table t1 (id int unsigned not null auto_increment primary key);
+insert into t1 values (null);
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+insert into t1 select null from t1;
+create table t2 (
+id int unsigned not null auto_increment,
+val decimal(5,3) not null,
+primary key (id,val),
+unique key (val,id),
+unique key (id));
+insert into t2 select null,id*0.0009 from t1;
+select count(val) from t2 ignore index (val) where val > 0.1155;
+count(val)
+128
+select count(val) from t2 force index (val) where val > 0.1155;
+count(val)
+128
+drop table t2, t1;
+#
+# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
+# RESULTS WITH DECIMAL CONVERSION
+#
+create table t1 (a int,b int,c int,primary key (a,c));
+insert into t1 values (1,1,2),(1,1,3),(1,1,4);
+select convert(3, signed integer) > 2.9;
+convert(3, signed integer) > 2.9
+1
+select * from t1 force index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c>= 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 force index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+select * from t1 ignore index (primary) where a=1 and c> 2.9;
+a b c
+1 1 3
+1 1 4
+drop table t1;
+#
+# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
+# RESULT AFTER MYSQL 5.1.
+#
+CREATE TABLE t1(
+F1 CHAR(5) NOT NULL,
+F2 CHAR(5) NOT NULL,
+F3 CHAR(5) NOT NULL,
+PRIMARY KEY(F1),
+INDEX IDX_F2(F2)
+);
+INSERT INTO t1 VALUES
+('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
+('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
+SELECT * FROM t1 WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
+F1 F2 F3
+A A A
+SELECT * FROM t1 WHERE F1 >= 'A ';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 > 'A ';
+F1 F2 F3
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
+'AAAAA';
+F1 F2 F3
+A A A
+AA AA AA
+AAA AAA AAA
+AAAA AAAA AAAA
+AAAAA AAAAA AAAAA
+DROP TABLE t1;
End of 5.1 tests
CREATE TABLE t1 (c1 DECIMAL(10,0),INDEX(c1));
INSERT INTO t1 VALUES (1),(2),(3);
=== modified file 'mysql-test/r/sp-security.result'
--- a/mysql-test/r/sp-security.result 2011-04-13 08:06:15 +0000
+++ b/mysql-test/r/sp-security.result 2012-01-30 06:59:39 +0000
@@ -617,3 +617,33 @@ SELECT 1 latin1 latin1_swedish_ci latin1
# Connection default
DROP USER user2@localhost;
DROP DATABASE db1;
+#
+# Test for bug#12602983 - User without privilege on routine can discover
+# its existence by executing "select non_existing_func();" or by
+# "call non_existing_proc()";
+#
+drop database if exists mysqltest_db;
+create database mysqltest_db;
+create function mysqltest_db.f1() returns int return 0;
+create procedure mysqltest_db.p1() begin end;
+# Create user with no privileges on mysqltest_db database.
+create user bug12602983_user@localhost;
+# Connect as user 'bug12602983_user@localhost'
+# Attempt to execute routine on which user doesn't have privileges
+# should result in the same 'access denied' error whether
+# routine exists or not.
+select mysqltest_db.f_does_not_exist();
+ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.f_does_not_exist'
+call mysqltest_db.p_does_not_exist();
+ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.p_does_not_exist'
+select mysqltest_db.f1();
+ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.f1'
+call mysqltest_db.p1();
+ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.p1'
+create view bug12602983_v1 as select mysqltest_db.f_does_not_exist();
+ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.f_does_not_exist'
+create view bug12602983_v1 as select mysqltest_db.f1();
+ERROR 42000: execute command denied to user 'bug12602983_user'@'localhost' for routine 'mysqltest_db.f1'
+# Connection 'default'.
+drop user bug12602983_user@localhost;
+drop database mysqltest_db;
=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result 2012-01-12 13:22:52 +0000
+++ b/mysql-test/r/sp.result 2012-01-27 05:57:35 +0000
@@ -7666,4 +7666,36 @@ CREATE FUNCTION f1 (p_value INT) RETURNS
SELECT f1(1);
ERROR 42S22: Unknown column 'x' in 'field list'
DROP FUNCTION f1;
+#
+# BUG #12872824 (formerly known as 62125): testing stored function
+# result for null incorrectly yields 1292 warning.
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP FUNCTION IF EXISTS f3;
+DROP FUNCTION IF EXISTS f4;
+CREATE FUNCTION f1() RETURNS VARCHAR(1)
+BEGIN RETURN 'X'; END;/
+CREATE FUNCTION f2() RETURNS CHAR(1)
+BEGIN RETURN 'X'; END;/
+CREATE FUNCTION f3() RETURNS VARCHAR(1)
+BEGIN RETURN NULL; END;/
+CREATE FUNCTION f4() RETURNS CHAR(1)
+BEGIN RETURN NULL; END;/
+SELECT f1() IS NULL;
+f1() IS NULL
+0
+SELECT f2() IS NULL;
+f2() IS NULL
+0
+SELECT f3() IS NULL;
+f3() IS NULL
+1
+SELECT f4() IS NULL;
+f4() IS NULL
+1
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP FUNCTION f3;
+DROP FUNCTION f4;
+#
# End of 5.6 tests
=== modified file 'mysql-test/suite/opt_trace/include/range.inc'
--- a/mysql-test/suite/opt_trace/include/range.inc 2011-12-01 14:12:10 +0000
+++ b/mysql-test/suite/opt_trace/include/range.inc 2012-01-27 08:45:00 +0000
@@ -1,6 +1,8 @@
# Test for optimizer tracing of range analysis
--source include/have_optimizer_trace.inc
+# InnoDB page size influences cost => makes trace vary.
+--source include/have_innodb_16k.inc
SET optimizer_trace_max_mem_size=1048576; # 1MB
SET optimizer_trace="enabled=on,end_marker=on,one_line=off";
=== modified file 'mysql-test/suite/parts/inc/partition-dml-1-7.inc'
--- a/mysql-test/suite/parts/inc/partition-dml-1-7.inc 2011-02-17 15:36:05 +0000
+++ b/mysql-test/suite/parts/inc/partition-dml-1-7.inc 2012-01-27 11:20:26 +0000
@@ -27,6 +27,7 @@ GRANT ALL PRIVILEGES ON test.* TO test_u
GRANT ALL PRIVILEGES ON test.* TO test_user_3 IDENTIFIED BY 'testpw';
connect (session1, localhost, test_user_1,'testpw',test);
+--sorted_result
SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
UPDATE t1 PARTITION (`p0-29`) SET b='p0-29-upd-1' WHERE a BETWEEN 0 AND 9 ;
@@ -48,6 +49,7 @@ connection session2;
--echo ####### expect p0-29 has not been updated
--sorted_result
SELECT * FROM t1 PARTITION (`p0-29`);
+--sorted_result
SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 20 AND 29 FOR UPDATE;
UPDATE t1 PARTITION (`p0-29`) SET b='p0-29-upd-2' WHERE a BETWEEN 20 AND 29 ;
=== modified file 'mysql-test/suite/parts/inc/partition-dml-1-8.inc'
--- a/mysql-test/suite/parts/inc/partition-dml-1-8.inc 2011-02-17 15:36:05 +0000
+++ b/mysql-test/suite/parts/inc/partition-dml-1-8.inc 2012-01-27 11:20:26 +0000
@@ -26,6 +26,7 @@ GRANT ALL PRIVILEGES ON test.* TO test_u
GRANT ALL PRIVILEGES ON test.* TO test_user_3 IDENTIFIED BY 'testpw';
connect (session1, localhost, test_user_1,'testpw',test);
+--sorted_result
SELECT * FROM t1 PARTITION (`p0-29`) WHERE a BETWEEN 0 AND 9 LOCK IN SHARE MODE;
UPDATE t1 PARTITION (`p0-29`) SET b='p0-29-upd-1' WHERE a BETWEEN 0 AND 9 ;
=== modified file 'mysql-test/suite/parts/inc/partition_key_16col.inc'
--- a/mysql-test/suite/parts/inc/partition_key_16col.inc 2008-02-06 14:13:56 +0000
+++ b/mysql-test/suite/parts/inc/partition_key_16col.inc 2012-01-27 11:20:26 +0000
@@ -11,5 +11,6 @@ insert into t1 values
('1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124,'1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, 'd,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr'),
('2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, 'pib mdotkbm.m');
select * from t1;
+--sorted_result
select * from t1 where a<19851231;
drop table t1;
=== modified file 'mysql-test/suite/parts/inc/partition_key_32col.inc'
--- a/mysql-test/suite/parts/inc/partition_key_32col.inc 2009-09-15 15:07:52 +0000
+++ b/mysql-test/suite/parts/inc/partition_key_32col.inc 2012-01-27 11:20:26 +0000
@@ -21,6 +21,7 @@ insert into t1 values
('1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, '1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, '1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, '1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, 'd,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr'),
('2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, '2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, 'pib mdotkbm.m');
select * from t1;
+--sorted_result
select * from t1 where a<19851231;
drop table t1;
--enable_abort_on_error
=== modified file 'mysql-test/suite/parts/inc/partition_key_4col.inc'
--- a/mysql-test/suite/parts/inc/partition_key_4col.inc 2008-02-06 14:13:56 +0000
+++ b/mysql-test/suite/parts/inc/partition_key_4col.inc 2012-01-27 11:20:26 +0000
@@ -11,6 +11,7 @@ insert into t1 values
('1980-10-14', 'fgbbd', 'dtzndtz', 'w'),
('2000-06-15', 'jukg','zikhuk','m');
select * from t1;
+--sorted_result
select * from t1 where a<19851231;
drop table t1;
=== modified file 'mysql-test/suite/parts/inc/partition_key_8col.inc'
--- a/mysql-test/suite/parts/inc/partition_key_8col.inc 2008-02-06 14:13:56 +0000
+++ b/mysql-test/suite/parts/inc/partition_key_8col.inc 2012-01-27 11:20:26 +0000
@@ -11,5 +11,6 @@ insert into t1 values
('1980-10-14', 'fgbbd', 'dtzndtz', 'w', 67856, 5463354.67, 3567845333, 124, 'd,f söierugsig msireg siug ei5ggth lrutluitgzeöjrtnb.rkjthuekuhzrkuthgjdnffjmbr'),
('2000-06-15', 'jukg','zikhuk','m', 45675, 6465754.13, 435242623462, 18, 'pib mdotkbm.m' );
select * from t1;
+--sorted_result
select * from t1 where a<19851231;
drop table t1;
=== modified file 'mysql-test/suite/parts/r/partition_special_myisam.result'
--- a/mysql-test/suite/parts/r/partition_special_myisam.result 2011-03-24 13:10:37 +0000
+++ b/mysql-test/suite/parts/r/partition_special_myisam.result 2012-01-27 11:20:26 +0000
@@ -31,9 +31,9 @@ a b c d
2000-06-15 jukg zikhuk m
select * from t1 where a<19851231;
a b c d
-1983-12-31 cdef srtbvsr w
-1980-10-14 fgbbd dtzndtz w
1975-01-01 abcde abcde m
+1980-10-14 fgbbd dtzndtz w
+1983-12-31 cdef srtbvsr w
drop table t1;
create table t1 (a date not null, b varchar(50) not null, c varchar(50) not null, d enum('m', 'w') not null, e int not null, f decimal (18,2) not null, g bigint not null, h tinyint not null, i char(255), primary key(a,b,c,d,e,f,g,h)) engine='MyISAM'
partition by key(a,b,c,d,e,f,g,h) (
=== renamed file 'mysql-test/suite/sys_vars/r/innodb_sort_buf_size_basic.result' => 'mysql-test/suite/sys_vars/r/innodb_sort_buffer_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_sort_buf_size_basic.result 2011-11-17 11:02:53 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_sort_buffer_size_basic.result 2012-01-26 12:50:34 +0000
@@ -1,21 +1,21 @@
-select @@global.innodb_sort_buf_size;
-@@global.innodb_sort_buf_size
+select @@global.innodb_sort_buffer_size;
+@@global.innodb_sort_buffer_size
1048576
-select @@session.innodb_sort_buf_size;
-ERROR HY000: Variable 'innodb_sort_buf_size' is a GLOBAL variable
-show global variables like 'innodb_sort_buf_size';
+select @@session.innodb_sort_buffer_size;
+ERROR HY000: Variable 'innodb_sort_buffer_size' is a GLOBAL variable
+show global variables like 'innodb_sort_buffer_size';
Variable_name Value
-innodb_sort_buf_size 1048576
-show session variables like 'innodb_sort_buf_size';
+innodb_sort_buffer_size 1048576
+show session variables like 'innodb_sort_buffer_size';
Variable_name Value
-innodb_sort_buf_size 1048576
-select * from information_schema.global_variables where variable_name='innodb_sort_buf_size';
+innodb_sort_buffer_size 1048576
+select * from information_schema.global_variables where variable_name='innodb_sort_buffer_size';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_SORT_BUF_SIZE 1048576
-select * from information_schema.session_variables where variable_name='innodb_sort_buf_size';
+INNODB_SORT_BUFFER_SIZE 1048576
+select * from information_schema.session_variables where variable_name='innodb_sort_buffer_size';
VARIABLE_NAME VARIABLE_VALUE
-INNODB_SORT_BUF_SIZE 1048576
-set global innodb_sort_buf_size=1;
-ERROR HY000: Variable 'innodb_sort_buf_size' is a read only variable
-set session innodb_sort_buf_size=1;
-ERROR HY000: Variable 'innodb_sort_buf_size' is a read only variable
+INNODB_SORT_BUFFER_SIZE 1048576
+set global innodb_sort_buffer_size=1;
+ERROR HY000: Variable 'innodb_sort_buffer_size' is a read only variable
+set session innodb_sort_buffer_size=1;
+ERROR HY000: Variable 'innodb_sort_buffer_size' is a read only variable
=== renamed file 'mysql-test/suite/sys_vars/t/innodb_sort_buf_size_basic.test' => 'mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_sort_buf_size_basic.test 2011-11-17 11:02:53 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_sort_buffer_size_basic.test 2012-01-26 12:50:34 +0000
@@ -8,19 +8,19 @@
#
# show the global and session values;
#
-select @@global.innodb_sort_buf_size;
+select @@global.innodb_sort_buffer_size;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
-select @@session.innodb_sort_buf_size;
-show global variables like 'innodb_sort_buf_size';
-show session variables like 'innodb_sort_buf_size';
-select * from information_schema.global_variables where variable_name='innodb_sort_buf_size';
-select * from information_schema.session_variables where variable_name='innodb_sort_buf_size';
+select @@session.innodb_sort_buffer_size;
+show global variables like 'innodb_sort_buffer_size';
+show session variables like 'innodb_sort_buffer_size';
+select * from information_schema.global_variables where variable_name='innodb_sort_buffer_size';
+select * from information_schema.session_variables where variable_name='innodb_sort_buffer_size';
#
# show that it's read-only
#
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set global innodb_sort_buf_size=1;
+set global innodb_sort_buffer_size=1;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
-set session innodb_sort_buf_size=1;
+set session innodb_sort_buffer_size=1;
=== modified file 'mysql-test/t/merge.test'
--- a/mysql-test/t/merge.test 2012-01-12 13:27:57 +0000
+++ b/mysql-test/t/merge.test 2012-01-27 08:16:43 +0000
@@ -2905,6 +2905,25 @@ DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE m1;
+--echo #
+--echo # Test for bug #11764786 - 57657: TEMPORARY MERGE TABLE WITH TEMPORARY
+--echo # UNDERLYING TABLE, IS BROKEN BY ALTER.
+--echo #
+--disable_warnings
+DROP TABLES IF EXISTS t1, t2, t3, t4;
+--enable_warnings
+CREATE TEMPORARY TABLE t1(i INT) ENGINE= MyISAM;
+CREATE TEMPORARY TABLE t2(i INT) ENGINE= MERGE UNION= (t1) INSERT_METHOD= LAST;
+ALTER TABLE t2 INSERT_METHOD= FIRST;
+CHECK TABLE t2;
+
+CREATE TABLE t3(i INT) ENGINE= MyISAM;
+CREATE TABLE t4(i int) ENGINE= MERGE UNION= (t3) INSERT_METHOD= LAST;
+ALTER TABLE t4 INSERT_METHOD= FIRST;
+CHECK TABLE t4;
+--echo # Clean-up
+DROP TABLES t1, t2, t3, t4;
+--echo # End of bug #11764786 - 57657
--disable_result_log
--disable_query_log
=== modified file 'mysql-test/t/optimizer_debug_sync.test'
--- a/mysql-test/t/optimizer_debug_sync.test 2011-03-28 10:56:41 +0000
+++ b/mysql-test/t/optimizer_debug_sync.test 2012-01-26 11:34:35 +0000
@@ -59,3 +59,30 @@ DROP TABLE t;
--exit
--echo # End of BUG#56080
+
+--echo #
+--echo # Bug #13536661: VALGRIND: DEFINITELY LOST: 552 BYTES IN 1 BLOCKS IN
+--echo # CREATE_TMP_TABLE AND HIGHER
+--echo #
+CREATE TABLE t1 ( a INT, b INT );
+INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30);
+
+connect(con1,localhost,root,,);
+SET debug_sync = "tmp_table_created SIGNAL parked WAIT_FOR go";
+--echo # This should not leak memory.
+send SELECT b, COUNT(DISTINCT b) FROM t1 GROUP BY b ORDER BY -b;
+
+connection default;
+SET debug_sync = "now WAIT_FOR parked";
+--echo # Set locally to shadow the global variable.
+SET debug = '';
+SET GLOBAL debug = '+d,simulate_out_of_memory';
+
+SET debug_sync = "now SIGNAL go";
+
+connection con1;
+--error ER_OUT_OF_RESOURCES
+reap;
+SET GLOBAL debug = '';
+
+DROP TABLE t1;
=== modified file 'mysql-test/t/plugin.test'
--- a/mysql-test/t/plugin.test 2011-10-27 08:43:56 +0000
+++ b/mysql-test/t/plugin.test 2012-01-26 12:39:35 +0000
@@ -15,10 +15,33 @@ UNINSTALL PLUGIN example;
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN example SONAME '$EXAMPLE_PLUGIN';
+--echo # Example engine does not support indexes
+--error ER_TOO_MANY_KEY_PARTS
+CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=EXAMPLE;
+--error ER_TOO_MANY_KEY_PARTS
+CREATE TABLE t1 (a int, KEY (a)) ENGINE=EXAMPLE;
+
+
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
---error ER_ILLEGAL_HA
+SHOW CREATE TABLE t1;
+
+--echo # Let's do some advanced ops with the example engine :)
+INSERT INTO t1 VALUES (0);
+
+--echo # Only supports table scans (and does always return zero rows :)
SELECT * FROM t1;
+SELECT * FROM t1 WHERE a = 0;
+
+--echo # Since there are no rows found, it will never do update_row.
+UPDATE t1 SET a = 1 WHERE a = 0;
+
+--echo # Since there are no rows found, it will never do delete_row.
+DELETE FROM t1 WHERE a = 0;
+
+--echo # No support for SQL HANDLER statement
+--error ER_ILLEGAL_HA
+HANDLER t1 OPEN;
DROP TABLE t1;
=== modified file 'mysql-test/t/sp-security.test'
--- a/mysql-test/t/sp-security.test 2011-04-13 07:59:17 +0000
+++ b/mysql-test/t/sp-security.test 2012-01-30 06:59:39 +0000
@@ -995,6 +995,47 @@ disconnect con2;
DROP USER user2@localhost;
DROP DATABASE db1;
+--echo #
+--echo # Test for bug#12602983 - User without privilege on routine can discover
+--echo # its existence by executing "select non_existing_func();" or by
+--echo # "call non_existing_proc()";
+--echo #
+--disable_warnings
+drop database if exists mysqltest_db;
+--enable_warnings
+create database mysqltest_db;
+create function mysqltest_db.f1() returns int return 0;
+create procedure mysqltest_db.p1() begin end;
+
+--echo # Create user with no privileges on mysqltest_db database.
+create user bug12602983_user@localhost;
+
+--echo # Connect as user 'bug12602983_user@localhost'
+connect (conn1, localhost, bug12602983_user,,);
+
+--echo # Attempt to execute routine on which user doesn't have privileges
+--echo # should result in the same 'access denied' error whether
+--echo # routine exists or not.
+--error ER_PROCACCESS_DENIED_ERROR
+select mysqltest_db.f_does_not_exist();
+--error ER_PROCACCESS_DENIED_ERROR
+call mysqltest_db.p_does_not_exist();
+
+--error ER_PROCACCESS_DENIED_ERROR
+select mysqltest_db.f1();
+--error ER_PROCACCESS_DENIED_ERROR
+call mysqltest_db.p1();
+
+--error ER_PROCACCESS_DENIED_ERROR
+create view bug12602983_v1 as select mysqltest_db.f_does_not_exist();
+--error ER_PROCACCESS_DENIED_ERROR
+create view bug12602983_v1 as select mysqltest_db.f1();
+
+--echo # Connection 'default'.
+connection default;
+disconnect conn1;
+drop user bug12602983_user@localhost;
+drop database mysqltest_db;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
=== modified file 'mysql-test/t/sp.test'
--- a/mysql-test/t/sp.test 2011-12-22 17:43:39 +0000
+++ b/mysql-test/t/sp.test 2012-01-27 05:57:35 +0000
@@ -8912,4 +8912,44 @@ CREATE FUNCTION f1 (p_value INT) RETURNS
--error ER_BAD_FIELD_ERROR
SELECT f1(1);
DROP FUNCTION f1;
+
+--echo #
+--echo # BUG #12872824 (formerly known as 62125): testing stored function
+--echo # result for null incorrectly yields 1292 warning.
+
+--disable_warnings
+DROP FUNCTION IF EXISTS f1;
+DROP FUNCTION IF EXISTS f2;
+DROP FUNCTION IF EXISTS f3;
+DROP FUNCTION IF EXISTS f4;
+--enable_warnings
+
+delimiter /;
+
+CREATE FUNCTION f1() RETURNS VARCHAR(1)
+BEGIN RETURN 'X'; END;/
+
+CREATE FUNCTION f2() RETURNS CHAR(1)
+BEGIN RETURN 'X'; END;/
+
+CREATE FUNCTION f3() RETURNS VARCHAR(1)
+BEGIN RETURN NULL; END;/
+
+CREATE FUNCTION f4() RETURNS CHAR(1)
+BEGIN RETURN NULL; END;/
+
+delimiter ;/
+
+SELECT f1() IS NULL;
+SELECT f2() IS NULL;
+SELECT f3() IS NULL;
+SELECT f4() IS NULL;
+
+DROP FUNCTION f1;
+DROP FUNCTION f2;
+DROP FUNCTION f3;
+DROP FUNCTION f4;
+
+--echo #
+
--echo # End of 5.6 tests
=== modified file 'mysql-test/t/temp_table.test'
--- a/mysql-test/t/temp_table.test 2012-01-25 11:42:57 +0000
+++ b/mysql-test/t/temp_table.test 2012-01-26 11:34:35 +0000
@@ -294,32 +294,3 @@ INSERT INTO t3 VALUES (101), (102), (103
REPAIR TABLE t1, t2, t3;
DROP TABLES t1, t2, t3;
-
-# Test case temporarily deactivated until we can find a place to move it
-# --echo #
-# --echo # Bug #13536661: VALGRIND: DEFINITELY LOST: 552 BYTES IN 1 BLOCKS IN
-# --echo # CREATE_TMP_TABLE AND HIGHER
-# --echo #
-# CREATE TABLE t1 ( a INT, b INT );
-# INSERT INTO t1 VALUES (4, 40), (1, 10), (2, 20), (2, 20), (3, 30);
-#
-# connect(con1,localhost,root,,);
-# SET debug_sync = "tmp_table_created SIGNAL parked WAIT_FOR go";
-# --echo # This should not leak memory.
-# send SELECT b, COUNT(DISTINCT b) FROM t1 GROUP BY b ORDER BY -b;
-#
-# connection default;
-# SET debug_sync = "now WAIT_FOR parked";
-# --echo # Set locally to shadow the global variable.
-# SET debug = '';
-# SET GLOBAL debug = '+d,simulate_out_of_memory';
-#
-# SET debug_sync = "now SIGNAL go";
-#
-# connection con1;
-# --error ER_OUT_OF_RESOURCES
-# reap;
-# SET GLOBAL debug = '';
-#
-# DROP TABLE t1;
-#
\ No newline at end of file
=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp 2011-12-09 08:32:03 +0000
+++ b/mysql-test/valgrind.supp 2012-01-29 00:57:40 +0000
@@ -782,7 +782,7 @@
}
{
- missing shutdown_performance_schema 8
+ missing shutdown_performance_schema 8a
Memcheck:Leak
fun:malloc
fun:my_malloc
@@ -794,6 +794,18 @@
}
{
+ missing shutdown_performance_schema 8b
+ Memcheck:Leak
+ fun:malloc
+ fun:my_malloc
+ fun:_Z22add_pfs_instr_to_arrayPKcS0_
+ fun:mysqld_get_one_option
+ fun:handle_options
+ fun:_Z11mysqld_mainiPPc
+ fun:(below main)
+}
+
+{
missing shutdown_performance_schema 9
Memcheck:Leak
fun:malloc
@@ -826,6 +838,16 @@
}
{
+ missing shutdown_performance_schema 11
+ Memcheck:Leak
+ fun:malloc
+ fun:my_malloc
+ fun:init_dynamic_array2
+ fun:_Z11mysqld_mainiPPc
+ fun:(below main)
+}
+
+{
Bug 59874 Valgrind warning in InnoDB compression code
Memcheck:Cond
fun:*
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2012-01-06 09:03:53 +0000
+++ b/sql/handler.cc 2012-01-26 12:53:38 +0000
@@ -4601,7 +4601,9 @@ handler::multi_range_read_info_const(uin
if (total_rows != HA_POS_ERROR)
{
/* The following calculation is the same as in multi_range_read_info(): */
- *flags |= HA_MRR_USE_DEFAULT_IMPL;
+ *flags|= HA_MRR_USE_DEFAULT_IMPL;
+ *flags|= HA_MRR_SUPPORT_SORTED;
+
DBUG_ASSERT(cost->is_zero());
if ((*flags & HA_MRR_INDEX_ONLY) && total_rows > 2)
cost->add_io(index_only_read_time(keyno, total_rows) *
@@ -4655,7 +4657,8 @@ ha_rows handler::multi_range_read_info(u
{
*bufsz= 0; /* Default implementation doesn't need a buffer */
- *flags |= HA_MRR_USE_DEFAULT_IMPL;
+ *flags|= HA_MRR_USE_DEFAULT_IMPL;
+ *flags|= HA_MRR_SUPPORT_SORTED;
DBUG_ASSERT(cost->is_zero());
@@ -4819,13 +4822,15 @@ int DsMrr_impl::dsmrr_init(handler *h_ar
handler *new_h2= 0;
int retval= 0;
DBUG_ENTER("DsMrr_impl::dsmrr_init");
+ THD *thd= current_thd;
/*
index_merge may invoke a scan on an object for which dsmrr_info[_const]
has not been called, so set the owner handler here as well.
*/
h= h_arg;
- if (mode & HA_MRR_USE_DEFAULT_IMPL || mode & HA_MRR_SORTED)
+ if (!thd->optimizer_switch_flag(OPTIMIZER_SWITCH_MRR) ||
+ mode & (HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED)) // DS-MRR doesn't sort
{
use_default_impl= TRUE;
retval= h->handler::multi_range_read_init(seq_funcs, seq_init_param,
@@ -4875,7 +4880,6 @@ int DsMrr_impl::dsmrr_init(handler *h_ar
if (!h2)
{
/* Create a separate handler object to do rndpos() calls. */
- THD *thd= current_thd;
/*
::clone() takes up a lot of stack, especially on 64 bit platforms.
The constant 5 is an empiric result.
@@ -5155,6 +5159,7 @@ ha_rows DsMrr_impl::dsmrr_info(uint keyn
DBUG_PRINT("info", ("Default MRR implementation choosen"));
*flags= def_flags;
*bufsz= def_bufsz;
+ DBUG_ASSERT(*flags & HA_MRR_USE_DEFAULT_IMPL);
}
else
{
@@ -5198,6 +5203,7 @@ ha_rows DsMrr_impl::dsmrr_info_const(uin
DBUG_PRINT("info", ("Default MRR implementation choosen"));
*flags= def_flags;
*bufsz= def_bufsz;
+ DBUG_ASSERT(*flags & HA_MRR_USE_DEFAULT_IMPL);
}
else
{
@@ -5237,12 +5243,11 @@ bool DsMrr_impl::choose_mrr_impl(uint ke
bool res;
THD *thd= current_thd;
if (!thd->optimizer_switch_flag(OPTIMIZER_SWITCH_MRR) ||
- *flags & HA_MRR_INDEX_ONLY ||
+ *flags & (HA_MRR_INDEX_ONLY | HA_MRR_SORTED) || // Unsupported by DS-MRR
(keyno == table->s->primary_key && h->primary_key_is_clustered()) ||
key_uses_partial_cols(table, keyno))
{
- /* Use the default implementation */
- *flags |= HA_MRR_USE_DEFAULT_IMPL;
+ /* Use the default implementation, don't modify args: See comments */
return TRUE;
}
@@ -5266,7 +5271,7 @@ bool DsMrr_impl::choose_mrr_impl(uint ke
if (force_dsmrr || (dsmrr_cost.total_cost() <= cost->total_cost()))
{
*flags &= ~HA_MRR_USE_DEFAULT_IMPL; /* Use the DS-MRR implementation */
- *flags &= ~HA_MRR_SORTED; /* We will return unordered output */
+ *flags &= ~HA_MRR_SUPPORT_SORTED; /* We can't provide ordered output */
*cost= dsmrr_cost;
res= FALSE;
}
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2011-11-30 11:36:14 +0000
+++ b/sql/handler.h 2012-01-26 12:53:38 +0000
@@ -1163,6 +1163,10 @@ void get_sweep_read_cost(TABLE *table, h
/*
The MRR user will provide ranges in key order, and MRR implementation
must return rows in key order.
+ Passing this flag to multi_read_range_init() may cause the
+ default MRR handler to be used even if HA_MRR_USE_DEFAULT_IMPL
+ was not specified.
+ (If the native MRR impl. can not provide SORTED result)
*/
#define HA_MRR_SORTED 8
@@ -1191,6 +1195,15 @@ void get_sweep_read_cost(TABLE *table, h
*/
#define HA_MRR_NO_NULL_ENDPOINTS 128
+/*
+ Set by the MRR implementation to signal that it will natively
+ produced sorted result if multi_range_read_init() is called with
+ the HA_MRR_SORTED flag - Else multi_range_read_init(HA_MRR_SORTED)
+ will revert to use the default MRR implementation.
+*/
+#define HA_MRR_SUPPORT_SORTED 256
+
+
class ha_statistics
{
public:
=== modified file 'sql/item.cc'
--- a/sql/item.cc 2012-01-25 15:06:20 +0000
+++ b/sql/item.cc 2012-01-26 10:08:12 +0000
@@ -8246,7 +8246,7 @@ int stored_field_cmp_to_item(THD *thd, F
return my_time_compare(&field_time, &item_time);
}
- return stringcmp(field_result, item_result);
+ return sortcmp(field_result, item_result, field->charset());
}
if (res_type == INT_RESULT)
return 0; // Both are of type int
@@ -8258,7 +8258,7 @@ int stored_field_cmp_to_item(THD *thd, F
if (item->null_value)
return 0;
field_val= field->val_decimal(&field_buf);
- return my_decimal_cmp(item_val, field_val);
+ return my_decimal_cmp(field_val, item_val);
}
/*
The patch for Bug#13463415 started using this function for comparing
=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h 2012-01-16 09:01:53 +0000
+++ b/sql/item_cmpfunc.h 2012-01-30 06:39:02 +0000
@@ -1124,7 +1124,13 @@ public:
value(value_buff, sizeof(value_buff), cs) {}
void store_value(Item *item)
{
- value_res= item->val_str(&value);
+ String *res= item->val_str(&value);
+ if(res && (res != &value))
+ {
+ // 'res' may point in item's temporary internal data, so make a copy
+ value.copy(*res);
+ }
+ value_res= &value;
}
int cmp(Item *arg)
{
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2011-12-13 18:18:20 +0000
+++ b/sql/item_func.cc 2012-01-30 06:59:39 +0000
@@ -6598,6 +6598,27 @@ void Item_func_sp::fix_length_and_dec()
}
+void Item_func_sp::update_null_value()
+{
+ /*
+ This method is called when we try to check if the item value is NULL.
+ We call Item_func_sp::execute() to get value of null_value attribute
+ as a side effect of its execution.
+ We ignore any error since update_null_value() doesn't return value.
+ We used to delegate nullability check to Item::update_null_value as
+ a result of a chain of function calls:
+ Item_func_isnull::val_int --> Item_func::is_null -->
+ Item::update_null_value -->Item_func_sp::val_int -->
+ Field_varstring::val_int
+ Such approach resulted in a call of push_warning_printf() in case
+ if a stored program value couldn't be cast to integer (the case when
+ for example there was a stored function that declared as returning
+ varchar(1) and a function's implementation returned "Y" from its body).
+ */
+ execute();
+}
+
+
/**
@brief Execute function & store value in field.
@@ -6775,9 +6796,42 @@ bool
Item_func_sp::fix_fields(THD *thd, Item **ref)
{
bool res;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ Security_context *save_security_ctx= thd->security_ctx;
+#endif
+
DBUG_ENTER("Item_func_sp::fix_fields");
DBUG_ASSERT(fixed == 0);
-
+
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ /*
+ Checking privileges to execute the function while creating view and
+ executing the function of select.
+ */
+ if (!(thd->lex->context_analysis_only & CONTEXT_ANALYSIS_ONLY_VIEW) ||
+ (thd->lex->sql_command == SQLCOM_CREATE_VIEW))
+ {
+ if (context->security_ctx)
+ {
+ /* Set view definer security context */
+ thd->security_ctx= context->security_ctx;
+ }
+
+ /*
+ Check whether user has execute privilege or not
+ */
+ res= check_routine_access(thd, EXECUTE_ACL, m_name->m_db.str,
+ m_name->m_name.str, 0, FALSE);
+ thd->security_ctx= save_security_ctx;
+
+ if (res)
+ {
+ context->process_error(thd);
+ DBUG_RETURN(res);
+ }
+ }
+#endif
+
/*
We must call init_result_field before Item_func::fix_fields()
to make m_sp and result_field members available to fix_length_and_dec(),
=== modified file 'sql/item_func.h'
--- a/sql/item_func.h 2012-01-17 14:44:49 +0000
+++ b/sql/item_func.h 2012-01-27 05:57:35 +0000
@@ -1995,6 +1995,8 @@ public:
{
return sp_result_field;
}
+
+ virtual void update_null_value();
};
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2012-01-26 10:20:10 +0000
+++ b/sql/mysqld.cc 2012-01-30 10:59:40 +0000
@@ -1529,10 +1529,7 @@ static void mysqld_exit(int exit_code)
clean_up_mutexes();
clean_up_error_log_mutex();
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
- /*
- Bug#56666 needs to be fixed before calling:
- shutdown_performance_schema();
- */
+ shutdown_performance_schema();
#endif
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(exit_code); /* purecov: inspected */
@@ -2716,10 +2713,21 @@ pthread_handler_t signal_hand(void *arg
should not be any other mysql_cond_signal() calls.
*/
mysql_mutex_lock(&LOCK_thread_count);
- mysql_mutex_unlock(&LOCK_thread_count);
mysql_cond_broadcast(&COND_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
+
+ /*
+ Waiting for until mysqld_server_started != 0
+ to ensure that all server components has been successfully
+ initialized. This step is mandatory since signal processing
+ could be done safely only when all server components
+ has been initialized.
+ */
+ mysql_mutex_lock(&LOCK_server_started);
+ while (!mysqld_server_started)
+ mysql_cond_wait(&COND_server_started, &LOCK_server_started);
+ mysql_mutex_unlock(&LOCK_server_started);
- (void) pthread_sigmask(SIG_BLOCK,&set,NULL);
for (;;)
{
int error; // Used when debugging
=== modified file 'sql/opt_explain.cc'
--- a/sql/opt_explain.cc 2011-12-14 12:32:55 +0000
+++ b/sql/opt_explain.cc 2012-01-26 12:53:38 +0000
@@ -770,24 +770,25 @@ void Explain_table_base::explain_extra_c
if (table->reginfo.not_exists_optimize)
str_extra->append(STRING_WITH_LEN("; Not exists"));
- if (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE &&
- !(((QUICK_RANGE_SELECT*)(select->quick))->mrr_flags &
- (HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED)))
+ if (quick_type == QUICK_SELECT_I::QS_TYPE_RANGE)
{
+ uint mrr_flags=
+ ((QUICK_RANGE_SELECT*)(select->quick))->mrr_flags;
+
/*
During normal execution of a query, multi_range_read_init() is
called to initialize MRR. If HA_MRR_SORTED is set at this point,
multi_range_read_init() for any native MRR implementation will
- revert to default MRR because they cannot produce sorted output
- currently.
+ revert to default MRR if not HA_MRR_SUPPORT_SORTED.
Calling multi_range_read_init() can potentially be costly, so it
- is not done when executing an EXPLAIN. We therefore make the
- assumption that HA_MRR_SORTED means no MRR. If some MRR native
- implementation will support sorted output in the future, a
- function "bool mrr_supports_sorted()" should be added in the
- handler.
+ is not done when executing an EXPLAIN. We therefore simulate
+ its effect here:
*/
- str_extra->append(STRING_WITH_LEN("; Using MRR"));
+ if (mrr_flags & HA_MRR_SORTED && !(mrr_flags & HA_MRR_SUPPORT_SORTED))
+ mrr_flags|= HA_MRR_USE_DEFAULT_IMPL;
+
+ if (!(mrr_flags & HA_MRR_USE_DEFAULT_IMPL))
+ str_extra->append(STRING_WITH_LEN("; Using MRR"));
}
}
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2012-01-25 12:45:56 +0000
+++ b/sql/opt_range.cc 2012-01-26 12:53:38 +0000
@@ -2568,7 +2568,7 @@ int SQL_SELECT::test_quick_select(THD *t
param.imerge_cost_buff_size= 0;
param.using_real_indexes= TRUE;
param.remove_jump_scans= TRUE;
- param.force_default_mrr= (interesting_order != ORDER::ORDER_NOT_RELEVANT);
+ param.force_default_mrr= (interesting_order == ORDER::ORDER_DESC);
param.order_direction= interesting_order;
thd->no_errors=1; // Don't warn about NULL
@@ -5562,7 +5562,7 @@ QUICK_SELECT_I *TRP_ROR_INTERSECT::make_
{
if (!(quick= get_quick_select(param, (*current)->idx,
(*current)->sel_arg,
- HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED,
+ HA_MRR_SORTED,
0, alloc)) ||
quick_intrsect->push_quick_back(quick))
{
@@ -5574,7 +5574,7 @@ QUICK_SELECT_I *TRP_ROR_INTERSECT::make_
{
if (!(quick= get_quick_select(param, cpk_scan->idx,
cpk_scan->sel_arg,
- HA_MRR_USE_DEFAULT_IMPL | HA_MRR_SORTED,
+ HA_MRR_SORTED,
0, alloc)))
{
delete quick_intrsect;
@@ -6464,10 +6464,24 @@ get_mm_leaf(RANGE_OPT_PARAM *param, Item
(field->type() == MYSQL_TYPE_DATE ||
field->type() == MYSQL_TYPE_DATETIME))
field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES;
- {
- // Note that value may be a stored function call, executed here.
- err= value->save_in_field_no_warnings(field, 1);
- }
+
+ /*
+ We want to change "field > value" to "field OP V"
+ where:
+ * V is what is in "field" after we stored "value" in it via
+ save_in_field_no_warning() (such store operation may have done
+ rounding...)
+ * OP is > or >=, depending on what's correct.
+ For example, if c is an INT column,
+ "c > 2.9" is changed to "c OP 3"
+ where OP is ">=" (">" would not be correct, as 3 > 2.9, a comparison
+ done with stored_field_cmp_to_item()). And
+ "c > 3.1" is changed to "c OP 3" where OP is ">" (3 < 3.1...).
+ */
+
+ // Note that value may be a stored function call, executed here.
+ err= value->save_in_field_no_warnings(field, 1);
+
if (err > 0)
{
if (field->cmp_type() != value->result_type())
@@ -8691,10 +8705,12 @@ ha_rows check_quick_select(PARAM *param,
param->is_ror_scan= FALSE;
*mrr_flags= param->force_default_mrr? HA_MRR_USE_DEFAULT_IMPL: 0;
+ *mrr_flags|= HA_MRR_NO_ASSOCIATION;
/*
Pass HA_MRR_SORTED to see if MRR implementation can handle sorting.
*/
- *mrr_flags|= HA_MRR_NO_ASSOCIATION | HA_MRR_SORTED;
+ if (param->order_direction != ORDER::ORDER_NOT_RELEVANT)
+ *mrr_flags|= HA_MRR_SORTED;
bool pk_is_clustered= file->primary_key_is_clustered();
if (index_only &&
@@ -8703,7 +8719,7 @@ ha_rows check_quick_select(PARAM *param,
*mrr_flags |= HA_MRR_INDEX_ONLY;
if (current_thd->lex->sql_command != SQLCOM_SELECT)
- *mrr_flags |= HA_MRR_USE_DEFAULT_IMPL;
+ *mrr_flags|= HA_MRR_SORTED; // Assumed to give faster ins/upd/del
*bufsize= param->thd->variables.read_rnd_buff_size;
// Sets is_ror_scan to false for some queries, e.g. multi-ranges
@@ -9228,7 +9244,7 @@ QUICK_RANGE_SELECT *get_quick_select_for
quick->mrr_flags= HA_MRR_NO_ASSOCIATION |
(table->key_read ? HA_MRR_INDEX_ONLY : 0);
if (thd->lex->sql_command != SQLCOM_SELECT)
- quick->mrr_flags |= HA_MRR_USE_DEFAULT_IMPL;
+ quick->mrr_flags|= HA_MRR_SORTED; // Assumed to give faster ins/upd/del
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
if (!ref->null_ref_key && !key_has_nulls(key_info, range->min_key,
ref->key_length))
@@ -10915,7 +10931,7 @@ get_best_group_min_max(PARAM *param, SEL
&cur_param_idx);
/* Check if this range tree can be used for prefix retrieval. */
Cost_estimate dummy_cost;
- uint mrr_flags= HA_MRR_USE_DEFAULT_IMPL;
+ uint mrr_flags= HA_MRR_SORTED;
uint mrr_bufsize=0;
cur_quick_prefix_records= check_quick_select(param, cur_param_idx,
FALSE /*don't care*/,
@@ -11550,7 +11566,6 @@ TRP_GROUP_MIN_MAX::make_quick(PARAM *par
/* Make a QUICK_RANGE_SELECT to be used for group prefix retrieval. */
quick->quick_prefix_select= get_quick_select(param, param_idx,
index_tree,
- HA_MRR_USE_DEFAULT_IMPL |
HA_MRR_SORTED,
0,
&quick->alloc);
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2012-01-25 10:07:23 +0000
+++ b/sql/sql_parse.cc 2012-01-30 06:59:39 +0000
@@ -4205,6 +4205,13 @@ create_sp_error:
case SQLCOM_CALL:
{
sp_head *sp;
+
+ /* Here we check for the execute privilege on stored procedure. */
+ if (check_routine_access(thd, EXECUTE_ACL, lex->spname->m_db.str,
+ lex->spname->m_name.str,
+ lex->sql_command == SQLCOM_CALL, 0))
+ goto error;
+
/*
This will cache all SP and SF and open and lock all tables
required for execution.
=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc 2011-11-01 11:52:24 +0000
+++ b/storage/example/ha_example.cc 2012-01-26 09:29:33 +0000
@@ -554,7 +554,7 @@ int ha_example::index_last(uchar *buf)
int ha_example::rnd_init(bool scan)
{
DBUG_ENTER("ha_example::rnd_init");
- DBUG_RETURN(HA_ERR_WRONG_COMMAND);
+ DBUG_RETURN(0);
}
int ha_example::rnd_end()
=== modified file 'storage/innobase/btr/btr0btr.cc'
--- a/storage/innobase/btr/btr0btr.cc 2011-11-20 20:17:41 +0000
+++ b/storage/innobase/btr/btr0btr.cc 2012-01-26 11:57:53 +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.
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
@@ -43,6 +43,27 @@ Created 6/2/1994 Heikki Tuuri
#include "trx0trx.h"
#include "srv0mon.h"
+/**************************************************************//**
+Report that an index page is corrupted. */
+UNIV_INTERN
+void
+btr_corruption_report(
+/*==================*/
+ const buf_block_t* block, /*!< in: corrupted block */
+ const dict_index_t* index) /*!< in: index tree */
+{
+ fprintf(stderr, "InnoDB: flag mismatch in space %u page %u"
+ " index %s of table %s\n",
+ (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));
+ }
+}
+
#ifdef UNIV_BLOB_DEBUG
# include "srv0srv.h"
# include "ut0rbt.h"
@@ -693,8 +714,7 @@ btr_root_block_get(
block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH,
index, mtr);
- ut_a((ibool)!!page_is_comp(buf_block_get_frame(block))
- == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(block, index);
#ifdef UNIV_BTR_DEBUG
if (!dict_index_is_ibuf(index)) {
const page_t* root = buf_block_get_frame(block);
@@ -1717,7 +1737,7 @@ btr_page_reorganize_low(
ibool success = FALSE;
ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
- ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(block, index);
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
@@ -3347,7 +3367,7 @@ btr_compress(
page = btr_cur_get_page(cursor);
index = btr_cur_get_index(cursor);
- ut_a((ibool) !!page_is_comp(page) == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(block, index);
ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
=== modified file 'storage/innobase/btr/btr0cur.cc'
--- a/storage/innobase/btr/btr0cur.cc 2012-01-25 08:25:07 +0000
+++ b/storage/innobase/btr/btr0cur.cc 2012-01-26 11:57:53 +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
@@ -768,11 +768,11 @@ retry_page_get:
if (level != 0) {
/* x-latch the page */
- page = btr_page_get(
+ buf_block_t* child_block = btr_block_get(
space, zip_size, page_no, RW_X_LATCH, index, mtr);
- ut_a((ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ page = buf_block_get_frame(child_block);
+ btr_assert_not_corrupted(child_block, index);
} else {
cursor->low_match = low_match;
cursor->low_bytes = low_bytes;
=== modified file 'storage/innobase/buf/buf0buf.cc'
--- a/storage/innobase/buf/buf0buf.cc 2012-01-16 08:15:20 +0000
+++ b/storage/innobase/buf/buf0buf.cc 2012-01-26 11:57:53 +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.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -690,6 +690,8 @@ buf_page_print(
#endif /* !UNIV_HOTBACKUP */
ulint size = zip_size;
+ ut_ad(0);
+
if (!size) {
size = UNIV_PAGE_SIZE;
}
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2012-01-25 19:31:50 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2012-01-26 12:50:34 +0000
@@ -14548,10 +14548,10 @@ static MYSQL_SYSVAR_ULONG(ft_sort_pll_de
"InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number",
NULL, NULL, 2, 1, 16, 0);
-static MYSQL_SYSVAR_ULONG(sort_buf_size, srv_sort_buf_size,
+static MYSQL_SYSVAR_ULONG(sort_buffer_size, srv_sort_buf_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
- "InnoDB Fulltext search sort buffer size",
- NULL, NULL, 1048576, 524288, 64836480, 0);
+ "Memory buffer size for index creation",
+ NULL, NULL, 1048576, 524288, 64<<20, 0);
static MYSQL_SYSVAR_BOOL(optimize_fulltext_only, innodb_optimize_fulltext_only,
PLUGIN_VAR_NOCMDARG,
@@ -14864,7 +14864,7 @@ static struct st_mysql_sys_var* innobase
MYSQL_SYSVAR(status_file),
MYSQL_SYSVAR(strict_mode),
MYSQL_SYSVAR(support_xa),
- MYSQL_SYSVAR(sort_buf_size),
+ MYSQL_SYSVAR(sort_buffer_size),
MYSQL_SYSVAR(analyze_is_persistent),
MYSQL_SYSVAR(sync_spin_loops),
MYSQL_SYSVAR(spin_wait_delay),
=== modified file 'storage/innobase/ibuf/ibuf0ibuf.cc'
--- a/storage/innobase/ibuf/ibuf0ibuf.cc 2012-01-16 12:30:58 +0000
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc 2012-01-26 12:31:26 +0000
@@ -3753,6 +3753,7 @@ ibuf_insert_to_index_page_low(
fputs("InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
}
/************************************************************************
@@ -3946,6 +3947,11 @@ ibuf_set_del_mark(
TRUE, mtr);
}
} else {
+ const page_t* page
+ = page_cur_get_page(&page_cur);
+ const buf_block_t* block
+ = page_cur_get_block(&page_cur);
+
ut_print_timestamp(stderr);
fputs(" InnoDB: unable to find a record to delete-mark\n",
stderr);
@@ -3954,10 +3960,14 @@ ibuf_set_del_mark(
fputs("\n"
"InnoDB: record ", stderr);
rec_print(stderr, page_cur_get_rec(&page_cur), index);
- putc('\n', stderr);
- fputs("\n"
- "InnoDB: Submit a detailed bug report"
- " to http://bugs.mysql.com\n", stderr);
+ fprintf(stderr, "\nspace %u offset %u"
+ " (%u records, index id %llu)\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n",
+ (unsigned) buf_block_get_space(block),
+ (unsigned) buf_block_get_page_no(block),
+ (unsigned) page_get_n_recs(page),
+ (ulonglong) btr_page_get_index_id(page));
ut_ad(0);
}
}
@@ -4001,12 +4011,31 @@ ibuf_delete(
offsets = rec_get_offsets(
rec, index, offsets, ULINT_UNDEFINED, &heap);
- /* Refuse to delete the last record. */
- ut_a(page_get_n_recs(page) > 1);
+ if (page_get_n_recs(page) <= 1
+ || !(REC_INFO_DELETED_FLAG
+ & rec_get_info_bits(rec, page_is_comp(page)))) {
+ /* Refuse to purge the last record or a
+ record that has not been marked for deletion. */
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: unable to purge a record\n",
+ stderr);
+ fputs("InnoDB: tuple ", stderr);
+ dtuple_print(stderr, entry);
+ fputs("\n"
+ "InnoDB: record ", stderr);
+ rec_print_new(stderr, rec, offsets);
+ fprintf(stderr, "\nspace %u offset %u"
+ " (%u records, index id %llu)\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n",
+ (unsigned) buf_block_get_space(block),
+ (unsigned) buf_block_get_page_no(block),
+ (unsigned) page_get_n_recs(page),
+ (ulonglong) btr_page_get_index_id(page));
- /* The record should have been marked for deletion. */
- ut_ad(REC_INFO_DELETED_FLAG
- & rec_get_info_bits(rec, page_is_comp(page)));
+ ut_ad(0);
+ return;
+ }
lock_update_delete(block, rec);
@@ -4092,6 +4121,7 @@ ibuf_restore_pos(
fprintf(stderr, "InnoDB: ibuf tree ok\n");
fflush(stderr);
+ ut_ad(0);
}
return(FALSE);
=== modified file 'storage/innobase/include/btr0btr.h'
--- a/storage/innobase/include/btr0btr.h 2011-11-20 20:17:41 +0000
+++ b/storage/innobase/include/btr0btr.h 2012-01-26 11:57:53 +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.
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
@@ -92,6 +92,26 @@ insert/delete buffer when the record is
buffer when the record is not in the buffer pool. */
#define BTR_DELETE 8192
+/**************************************************************//**
+Report that an index page is corrupted. */
+UNIV_INTERN
+void
+btr_corruption_report(
+/*==================*/
+ const buf_block_t* block, /*!< in: corrupted block */
+ const dict_index_t* index) /*!< in: index tree */
+ UNIV_COLD __attribute__((nonnull));
+
+/** Assert that a B-tree page is not corrupted.
+@param block buffer block containing a B-tree page
+@param index the B-tree index */
+#define btr_assert_not_corrupted(block, index) \
+ if ((ibool) !!page_is_comp(buf_block_get_frame(block)) \
+ != dict_table_is_comp((index)->table)) { \
+ btr_corruption_report(block, index); \
+ ut_error; \
+ }
+
#ifdef UNIV_BLOB_DEBUG
# include "ut0rbt.h"
/** An index->blobs entry for keeping track of off-page column references */
=== modified file 'storage/innobase/include/mtr0log.ic'
--- a/storage/innobase/include/mtr0log.ic 2011-12-23 13:17:36 +0000
+++ b/storage/innobase/include/mtr0log.ic 2012-01-26 11:57:53 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2009, 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
@@ -217,6 +217,7 @@ mlog_write_initial_log_record_fast(
"Please post a bug report to "
"bugs.mysql.com.\n",
type, offset, space);
+ ut_ad(0);
}
}
=== modified file 'storage/innobase/lock/lock0lock.cc'
--- a/storage/innobase/lock/lock0lock.cc 2011-12-19 08:43:28 +0000
+++ b/storage/innobase/lock/lock0lock.cc 2012-01-27 04:18:55 +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.
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
@@ -45,6 +45,7 @@ Created 5/7/1996 Heikki Tuuri
#include "row0types.h" /* sel_node_t */
#include "srv0mon.h"
#include "ut0vec.h"
+#include "btr0btr.h"
/* Restricts the length of search we will do in the waits-for
graph of transactions */
@@ -1760,7 +1761,7 @@ lock_rec_create(
page_no = buf_block_get_page_no(block);
page = block->frame;
- ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(block, index);
/* If rec is the supremum record, then we reset the gap and
LOCK_REC_NOT_GAP bits, as all locks on the supremum are
@@ -1885,6 +1886,7 @@ lock_rec_enqueue_waiting(
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n",
stderr);
+ ut_ad(0);
}
/* Enqueue the lock request that will wait to be granted, note that
@@ -4238,6 +4240,7 @@ lock_table_enqueue_waiting(
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n",
stderr);
+ ut_ad(0);
}
/* Enqueue the lock request that will wait to be granted */
=== modified file 'storage/innobase/page/page0page.cc'
--- a/storage/innobase/page/page0page.cc 2011-12-12 12:03:34 +0000
+++ b/storage/innobase/page/page0page.cc 2012-01-26 11:57:53 +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.
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
@@ -549,8 +549,7 @@ page_copy_rec_list_end_no_locks(
page_cur_move_to_next(&cur1);
}
- ut_a((ibool)!!page_is_comp(new_page)
- == dict_table_is_comp(index->table));
+ btr_assert_not_corrupted(new_block, index);
ut_a(page_is_comp(new_page) == page_rec_is_comp(rec));
ut_a(mach_read_from_2(new_page + UNIV_PAGE_SIZE - 10) == (ulint)
(page_is_comp(new_page) ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
=== modified file 'storage/innobase/row/row0ins.cc'
--- a/storage/innobase/row/row0ins.cc 2011-12-19 08:43:28 +0000
+++ b/storage/innobase/row/row0ins.cc 2012-01-26 11:57:53 +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.
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
@@ -1070,7 +1070,7 @@ row_ins_foreign_check_on_constraint(
fputs("\n"
"InnoDB: Submit a detailed bug report to"
" http://bugs.mysql.com\n", stderr);
-
+ ut_ad(0);
err = DB_SUCCESS;
goto nonstandard_exit_func;
=== modified file 'storage/innobase/row/row0sel.cc'
--- a/storage/innobase/row/row0sel.cc 2011-12-29 14:32:49 +0000
+++ b/storage/innobase/row/row0sel.cc 2012-01-26 11:57:53 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -3123,6 +3123,7 @@ row_sel_get_clust_rec_for_mysql(
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
}
clust_rec = NULL;
=== modified file 'storage/innobase/row/row0umod.cc'
--- a/storage/innobase/row/row0umod.cc 2011-11-16 15:31:08 +0000
+++ b/storage/innobase/row/row0umod.cc 2012-01-26 11:57:53 +0000
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 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
@@ -509,6 +509,7 @@ row_undo_mod_del_unmark_sec_and_undo_upd
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
break;
case ROW_FOUND:
btr_cur = btr_pcur_get_btr_cur(&pcur);
=== modified file 'storage/innobase/row/row0upd.cc'
--- a/storage/innobase/row/row0upd.cc 2011-11-20 20:17:41 +0000
+++ b/storage/innobase/row/row0upd.cc 2012-01-26 11:57:53 +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.
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
@@ -1723,6 +1723,7 @@ row_upd_sec_index_entry(
fputs("\n"
"InnoDB: Submit a detailed bug report"
" to http://bugs.mysql.com\n", stderr);
+ ut_ad(0);
break;
case ROW_FOUND:
/* Delete mark the old index record; it can already be
=== modified file 'storage/innobase/srv/srv0srv.cc'
--- a/storage/innobase/srv/srv0srv.cc 2011-12-28 08:37:08 +0000
+++ b/storage/innobase/srv/srv0srv.cc 2012-01-26 11:57:53 +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.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -1594,6 +1594,7 @@ loop:
"InnoDB: Please submit a bug report"
" to http://bugs.mysql.com\n",
old_lsn, new_lsn);
+ ut_ad(0);
}
old_lsn = new_lsn;
=== modified file 'storage/innobase/trx/trx0purge.cc'
--- a/storage/innobase/trx/trx0purge.cc 2011-11-30 10:09:12 +0000
+++ b/storage/innobase/trx/trx0purge.cc 2012-01-26 11:57:53 +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.
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
@@ -603,6 +603,7 @@ trx_purge_rseg_get_next_history_log(
"InnoDB: report, and submit it"
" to http://bugs.mysql.com\n",
(ulong) trx_sys->rseg_history_len);
+ ut_ad(0);
}
mutex_exit(&trx_sys->mutex);
=== modified file 'storage/innobase/trx/trx0rec.cc'
--- a/storage/innobase/trx/trx0rec.cc 2011-11-08 10:32:23 +0000
+++ b/storage/innobase/trx/trx0rec.cc 2012-01-26 11:57:53 +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.
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
@@ -1009,6 +1009,7 @@ trx_undo_update_rec_get_update(
fprintf(stderr, "\n"
"InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
(ulong) n_fields, (ulong) i, ptr);
+ ut_ad(0);
*upd = NULL;
return(NULL);
}
=== modified file 'storage/myisammrg/ha_myisammrg.cc'
--- a/storage/myisammrg/ha_myisammrg.cc 2011-11-17 13:41:28 +0000
+++ b/storage/myisammrg/ha_myisammrg.cc 2012-01-27 08:16:43 +0000
@@ -1469,31 +1469,36 @@ void ha_myisammrg::update_create_info(HA
if (!(create_info->used_fields & HA_CREATE_USED_UNION))
{
- MYRG_TABLE *open_table;
+ TABLE_LIST *child_table;
THD *thd=current_thd;
create_info->merge_list.next= &create_info->merge_list.first;
create_info->merge_list.elements=0;
- for (open_table=file->open_tables ;
- open_table != file->end_table ;
- open_table++)
+ if (children_l != NULL)
{
- TABLE_LIST *ptr;
- LEX_STRING db, name;
- LINT_INIT(db.str);
-
- if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
- goto err;
- split_file_name(open_table->table->filename, &db, &name);
- if (!(ptr->table_name= thd->strmake(name.str, name.length)))
- goto err;
- if (db.length && !(ptr->db= thd->strmake(db.str, db.length)))
- goto err;
-
- create_info->merge_list.elements++;
- (*create_info->merge_list.next) = ptr;
- create_info->merge_list.next= &ptr->next_local;
+ for (child_table= children_l;;
+ child_table= child_table->next_global)
+ {
+ TABLE_LIST *ptr;
+
+ if (!(ptr= (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
+ goto err;
+
+ if (!(ptr->table_name= thd->strmake(child_table->table_name,
+ child_table->table_name_length)))
+ goto err;
+ if (child_table->db && !(ptr->db= thd->strmake(child_table->db,
+ child_table->db_length)))
+ goto err;
+
+ create_info->merge_list.elements++;
+ (*create_info->merge_list.next)= ptr;
+ create_info->merge_list.next= &ptr->next_local;
+
+ if (&child_table->next_global == children_last_l)
+ break;
+ }
}
*create_info->merge_list.next=0;
}
=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc 2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/pfs_instr_class.cc 2012-01-25 22:37:55 +0000
@@ -47,7 +47,13 @@
*/
my_bool pfs_enabled= TRUE;
-DYNAMIC_ARRAY pfs_instr_init_array;
+/**
+ PFS_INSTRUMENT option settings array and associated state variable to
+ serialize access during shutdown.
+ */
+DYNAMIC_ARRAY pfs_instr_config_array;
+int pfs_instr_config_state= PFS_INSTR_CONFIG_NOT_INITIALIZED;
+
static void configure_instr_class(PFS_instr_class *entry);
static void init_instr_class(PFS_instr_class *klass,
@@ -619,10 +625,10 @@ static void configure_instr_class(PFS_in
{
uint match_length= 0; /* length of matching pattern */
- for (uint i= 0; i < pfs_instr_init_array.elements; i++)
+ for (uint i= 0; i < pfs_instr_config_array.elements; i++)
{
- PFS_instr_init* e;
- get_dynamic(&pfs_instr_init_array, (uchar*)&e, i);
+ PFS_instr_config* e;
+ get_dynamic(&pfs_instr_config_array, (uchar*)&e, i);
/**
Compare class name to all configuration entries. In case of multiple
=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h 2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/pfs_instr_class.h 2012-01-25 22:37:55 +0000
@@ -87,7 +87,7 @@ enum PFS_class_type
};
/** User-defined instrument configuration. */
-struct PFS_instr_init
+struct PFS_instr_config
{
/* Instrument name. */
char *m_name;
@@ -99,7 +99,12 @@ struct PFS_instr_init
bool m_timed;
};
-extern DYNAMIC_ARRAY pfs_instr_init_array;
+extern DYNAMIC_ARRAY pfs_instr_config_array;
+extern int pfs_instr_config_state;
+
+static const int PFS_INSTR_CONFIG_NOT_INITIALIZED= 0;
+static const int PFS_INSTR_CONFIG_ALLOCATED= 1;
+static const int PFS_INSTR_CONFIG_DEALLOCATED= 2;
struct PFS_thread;
=== modified file 'storage/perfschema/pfs_server.cc'
--- a/storage/perfschema/pfs_server.cc 2012-01-24 23:42:36 +0000
+++ b/storage/perfschema/pfs_server.cc 2012-01-26 17:49:01 +0000
@@ -46,6 +46,7 @@ static void destroy_pfs_thread(void *key
C_MODE_END
static void cleanup_performance_schema(void);
+void cleanup_instrument_config(void);
struct PSI_bootstrap*
initialize_performance_schema(const PFS_global_param *param)
@@ -65,6 +66,7 @@ initialize_performance_schema(const PFS_
init_timers();
PFS_atomic::init();
+
init_event_name_sizing(param);
register_global_classes();
@@ -150,6 +152,8 @@ static void destroy_pfs_thread(void *key
static void cleanup_performance_schema(void)
{
+ cleanup_instrument_config();
+/* Disabled: Bug#5666
cleanup_instruments();
cleanup_sync_class();
cleanup_thread_class();
@@ -174,12 +178,14 @@ static void cleanup_performance_schema(v
cleanup_account();
cleanup_account_hash();
PFS_atomic::cleanup();
+*/
}
void shutdown_performance_schema(void)
{
pfs_initialized= false;
cleanup_performance_schema();
+#if 0
/*
Be careful to not delete un-initialized keys,
this would affect key 0, which is THR_KEY_mysys,
@@ -190,6 +196,7 @@ void shutdown_performance_schema(void)
pthread_key_delete(THR_PFS);
THR_PFS_initialized= false;
}
+#endif
}
/**
@@ -198,7 +205,21 @@ void shutdown_performance_schema(void)
*/
void init_pfs_instrument_array()
{
- my_init_dynamic_array(&pfs_instr_init_array, sizeof(PFS_instr_init*), 10, 10);
+ my_init_dynamic_array(&pfs_instr_config_array, sizeof(PFS_instr_config*), 10, 10);
+ pfs_instr_config_state= PFS_INSTR_CONFIG_ALLOCATED;
+}
+
+/**
+ Deallocate the PFS_INSTRUMENT array. Use an atomic compare-and-swap to ensure
+ that it is deallocated only once in the chaotic environment of server shutdown.
+*/
+void cleanup_instrument_config()
+{
+ int desired_state= PFS_INSTR_CONFIG_ALLOCATED;
+
+ /* Ignore if another thread has already deallocated the array */
+ if (my_atomic_cas32(&pfs_instr_config_state, &desired_state, PFS_INSTR_CONFIG_DEALLOCATED))
+ delete_dynamic(&pfs_instr_config_array);
}
/**
@@ -217,12 +238,12 @@ int add_pfs_instr_to_array(const char* n
int value_length= strlen(value);
/* Allocate structure plus string buffers plus null terminators */
- PFS_instr_init* e = (PFS_instr_init*)my_malloc(sizeof(PFS_instr_init)
+ PFS_instr_config* e = (PFS_instr_config*)my_malloc(sizeof(PFS_instr_config)
+ name_length + 1 + value_length + 1, MYF(MY_WME));
if (!e) return 1;
/* Copy the instrument name */
- e->m_name= (char*)e + sizeof(PFS_instr_init);
+ e->m_name= (char*)e + sizeof(PFS_instr_config);
memcpy(e->m_name, name, name_length);
e->m_name_length= name_length;
e->m_name[name_length]= '\0';
@@ -258,7 +279,7 @@ int add_pfs_instr_to_array(const char* n
}
/* Add to the array of default startup options */
- if (insert_dynamic(&pfs_instr_init_array, &e))
+ if (insert_dynamic(&pfs_instr_config_array, &e))
{
my_free(e);
return 1;
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk-wl5259 branch (marc.alff:3363 to 3364) | Marc Alff | 30 Jan |