#At file:///home/bzr/mkindahl/w5465-trunk-bugfixing/ based on revid:mats.kindahl@stripped
3342 Mats Kindahl 2010-11-16 [merge]
Merging WL#5465 with mysql-trunk-bugfixing.
removed:
mysql-test/collections/mysql-next-mr-rpl-merge.push
mysql-test/collections/mysql-next-mr-wl4445.push
mysql-test/collections/mysql-next-mr.push
added:
mysql-test/collections/mysql-trunk-bugfixing.daily
mysql-test/collections/mysql-trunk-bugfixing.push
modified:
cmd-line-utils/readline/bind.c
include/m_string.h
include/my_compiler.h
mysql-test/collections/default.experimental
mysql-test/collections/default.weekly
mysql-test/r/information_schema-big.result
mysql-test/r/not_embedded_server.result
mysql-test/r/partition.result
mysql-test/r/partition_exchange.result
mysql-test/r/variables-big.result
mysql-test/suite/parts/inc/partition_auto_increment.inc
mysql-test/suite/parts/r/partition_auto_increment_blackhole.result
mysql-test/suite/parts/r/partition_auto_increment_innodb.result
mysql-test/suite/parts/r/partition_auto_increment_memory.result
mysql-test/suite/parts/r/partition_auto_increment_myisam.result
mysql-test/suite/perfschema/t/threads_mysql.test
mysql-test/t/disabled.def
mysql-test/t/not_embedded_server.test
mysql-test/t/partition.test
mysql-test/t/partition_exchange.test
mysql-test/t/variables-big.test
mysys/default.c
mysys/mf_iocache.c
mysys/mf_keycache.c
regex/regexec.c
sql/binlog.cc
sql/debug_sync.cc
sql/ha_partition.cc
sql/handler.h
sql/log.cc
sql/log.h
sql/mysqld.cc
sql/mysqld.h
sql/rpl_slave.cc
sql/sql_class.cc
sql/sql_insert.cc
sql/sql_partition.cc
sql/sql_partition_admin.cc
sql/sql_prepare.cc
sql/sql_update.cc
sql/sql_yacc.yy
storage/myisam/ft_nlq_search.c
storage/myisammrg/myrg_open.c
storage/perfschema/pfs_global.h
storage/perfschema/pfs_instr.cc
storage/perfschema/pfs_instr.h
storage/perfschema/pfs_instr_class.cc
storage/perfschema/pfs_instr_class.h
storage/perfschema/table_events_waits.cc
tests/mysql_client_test.c
=== modified file 'cmd-line-utils/readline/bind.c'
--- a/cmd-line-utils/readline/bind.c 2009-08-28 16:21:54 +0000
+++ b/cmd-line-utils/readline/bind.c 2010-11-10 21:14:47 +0000
@@ -855,7 +855,7 @@ _rl_read_init_file (filename, include_le
{
register int i;
char *buffer, *openname, *line, *end;
- size_t file_size;
+ size_t file_size = 0;
current_readline_init_file = filename;
current_readline_init_include_level = include_level;
=== modified file 'include/m_string.h'
--- a/include/m_string.h 2010-07-23 20:59:42 +0000
+++ b/include/m_string.h 2010-11-16 10:05:56 +0000
@@ -76,7 +76,9 @@ extern "C" {
extern void *(*my_str_malloc)(size_t);
extern void (*my_str_free)(void *);
-#if defined(HAVE_STPCPY)
+#if MY_GNUC_PREREQ(3, 4)
+#define strmov(dest, src) __builtin_stpcpy(dest, src)
+#elif defined(HAVE_STPCPY)
#define strmov(A,B) stpcpy((A),(B))
#ifndef stpcpy
extern char *stpcpy(char *, const char *); /* For AIX with gcc 2.95.3 */
=== modified file 'include/my_compiler.h'
--- a/include/my_compiler.h 2010-10-20 18:21:40 +0000
+++ b/include/my_compiler.h 2010-11-10 21:14:47 +0000
@@ -76,6 +76,11 @@
/**
Generic (compiler-independent) features.
*/
+
+#ifndef MY_GNUC_PREREQ
+# define MY_GNUC_PREREQ(maj, min) (0)
+#endif
+
#ifndef MY_ALIGNOF
# ifdef __cplusplus
template<typename type> struct my_alignof_helper { char m1; type m2; };
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental 2010-11-15 09:26:03 +0000
+++ b/mysql-test/collections/default.experimental 2010-11-16 06:46:10 +0000
@@ -31,7 +31,7 @@ perfschema.server_init
rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again
rpl.rpl_innodb_bug28430* # Bug#46029
rpl.rpl_row_sp011* @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-rpl.rpl_delayed_slave # BUG#57514 rpl_delayed_slave fails sporadically in pb
+rpl.rpl_delayed_slave* # BUG#57514 rpl_delayed_slave fails sporadically in pb
sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
sys_vars.slow_query_log_func @solaris # Bug#54819 2010-06-26 alik sys_vars.slow_query_log_func fails sporadically on Solaris 10
=== modified file 'mysql-test/collections/default.weekly'
--- a/mysql-test/collections/default.weekly 2010-09-24 09:39:47 +0000
+++ b/mysql-test/collections/default.weekly 2010-11-16 00:11:06 +0000
@@ -1,2 +1,2 @@
perl mysql-test-run.pl --timer --force --comment=1st --experimental=collections/default.experimental 1st
-perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb main.variables-big rpl_ndb.rpl_truncate_7ndb_2
+perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 large_tests.alter_table main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_ndb parts.partition_alter1_2_innodb parts.partition_alter1_2_ndb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb rpl_ndb.rpl_truncate_7ndb_2
=== removed file 'mysql-test/collections/mysql-next-mr-rpl-merge.push'
--- a/mysql-test/collections/mysql-next-mr-rpl-merge.push 2010-06-17 20:38:09 +0000
+++ b/mysql-test/collections/mysql-next-mr-rpl-merge.push 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
-perl suite/rpl/extension/bhs.pl --trans-test-list=update_test_cases --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_bhs --vardir=var-rpl_bhs --suite=rpl_bhs
=== removed file 'mysql-test/collections/mysql-next-mr-wl4445.push'
--- a/mysql-test/collections/mysql-next-mr-wl4445.push 2010-06-17 11:02:31 +0000
+++ b/mysql-test/collections/mysql-next-mr-wl4445.push 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema,parts
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema,parts
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema,parts
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
-perl mysql-test-run.pl --force --timer --parallel=auto --comment=partitions --suite=parts --experimental=collections/default.experimental
=== removed file 'mysql-test/collections/mysql-next-mr.push'
--- a/mysql-test/collections/mysql-next-mr.push 2010-06-23 10:58:24 +0000
+++ b/mysql-test/collections/mysql-next-mr.push 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema --skip-test-list=collections/disabled-per-push.list
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
=== added file 'mysql-test/collections/mysql-trunk-bugfixing.daily'
--- a/mysql-test/collections/mysql-trunk-bugfixing.daily 1970-01-01 00:00:00 +0000
+++ b/mysql-test/collections/mysql-trunk-bugfixing.daily 2010-11-16 04:02:46 +0000
@@ -0,0 +1,5 @@
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1
+perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb
=== added file 'mysql-test/collections/mysql-trunk-bugfixing.push'
--- a/mysql-test/collections/mysql-trunk-bugfixing.push 1970-01-01 00:00:00 +0000
+++ b/mysql-test/collections/mysql-trunk-bugfixing.push 2010-11-16 04:02:46 +0000
@@ -0,0 +1,4 @@
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_ps_row --suite=main --vardir=var-main-ps_row --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_embedded --vardir=var-main-emebbed --embedded --experimental=collections/default.experimental --skip-ndb
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --experimental=collections/default.experimental --skip-ndb
=== modified file 'mysql-test/r/information_schema-big.result'
--- a/mysql-test/r/information_schema-big.result 2009-10-05 14:22:48 +0000
+++ b/mysql-test/r/information_schema-big.result 2010-11-16 00:11:06 +0000
@@ -30,6 +30,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -42,6 +43,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
@@ -74,6 +76,7 @@ FILES TABLE_SCHEMA
GLOBAL_STATUS VARIABLE_NAME
GLOBAL_VARIABLES VARIABLE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
+PARAMETERS SPECIFIC_SCHEMA
PARTITIONS TABLE_SCHEMA
PLUGINS PLUGIN_NAME
PROCESSLIST ID
@@ -86,6 +89,7 @@ SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
STATISTICS TABLE_SCHEMA
TABLES TABLE_SCHEMA
+TABLESPACES TABLESPACE_NAME
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
=== modified file 'mysql-test/r/not_embedded_server.result'
--- a/mysql-test/r/not_embedded_server.result 2009-12-04 23:02:48 +0000
+++ b/mysql-test/r/not_embedded_server.result 2010-11-15 15:18:04 +0000
@@ -14,3 +14,32 @@ flush privileges;
ERROR HY000: Table 'host' was not locked with LOCK TABLES
unlock tables;
drop table t1;
+#
+# Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
+#
+CREATE USER nopriv_user@localhost;
+connection: default
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP FUNCTION IF EXISTS f;
+CREATE TABLE t1 (key1 INT PRIMARY KEY);
+CREATE TABLE t2 (key2 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
+FLUSH PRIVILEGES;
+connection: con1
+SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
+ERROR 42000: execute command denied to user 'nopriv_user'@'localhost' for routine 'test.f'
+connection: default
+DROP TABLE t1,t2;
+DROP FUNCTION f;
+DROP USER nopriv_user@localhost;
+#
+# End Bug#54812
+#
=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result 2010-10-26 09:10:59 +0000
+++ b/mysql-test/r/partition.result 2010-11-16 00:21:26 +0000
@@ -1,5 +1,38 @@
drop table if exists t1, t2;
#
+# Bug#57778: failed primary key add to partitioned innodb table
+# inconsistent and crashes
+#
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL)
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (0,1), (0,2);
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ERROR 23000: Duplicate entry '0' for key 'PRIMARY'
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` int(11) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (a)
+PARTITIONS 2 */
+SELECT * FROM t1;
+a b
+0 1
+0 2
+UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+SELECT * FROM t1;
+a b
+1 1
+0 1
+ALTER TABLE t1 DROP PRIMARY KEY;
+SELECT * FROM t1;
+a b
+1 1
+0 1
+DROP TABLE t1;
+#
# Bug#57113: ha_partition::extra(ha_extra_function):
# Assertion `m_extra_cache' failed
CREATE TABLE t1
=== modified file 'mysql-test/r/partition_exchange.result'
--- a/mysql-test/r/partition_exchange.result 2010-10-21 22:25:09 +0000
+++ b/mysql-test/r/partition_exchange.result 2010-11-16 00:55:42 +0000
@@ -1,10 +1,24 @@
DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
-CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb;
-CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) engine=innodb;
+#
+# Bug#56484: !table || (!table->read_set ||
+# bitmap_is_set(table->read_set, field_index))
+#
+CREATE TABLE t1 (a INT NOT NULL,b TIME NOT NULL DEFAULT '00:00:00')
+ENGINE=MyISAM
+PARTITION BY HASH (a) PARTITIONS 2;
+CREATE TABLE t2 (a INT) ENGINE=MYISAM;
+ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
+ERROR HY000: Tables have different definitions
+DROP TABLE t1, t2;
+#
+# Bug#55784: Foreign key integrity broken by alter table
+#
+CREATE TABLE t1 (s1 INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (1),(2),(3);
CREATE TABLE t3 (s1 INT PRIMARY KEY)
-engine=innodb
+ENGINE=InnoDB
PARTITION BY LIST (s1)
(PARTITION p1 VALUES IN (1,2,3));
ALTER TABLE t3 EXCHANGE PARTITION p1 WITH TABLE t1;
@@ -135,46 +149,6 @@ a b
64 Sixty four
ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t;
ERROR HY000: Found row that does not match the partition
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
-SHOW CREATE TABLE t;
-Table Create Table
-t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` varchar(55) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW CREATE TABLE tp;
-Table Create Table
-tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` varchar(55) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
-SELECT * FROM t;
-a b
-161 161
-162 162
-163 163
-164 164
-200 Two hundred, end of values
-SELECT * FROM tp;
-a b
-1 First value
-10 Ten
-2 First value
-3 Three
-5 Five
-50 Fifty
-61 Sixty one
-62 Sixty two
-63 Sixty three
-64 Sixty four
-99 End of values
-# No need to use ignore on the original partition
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
@@ -213,15 +187,19 @@ a b
63 Sixty three
64 Sixty four
# Test list of partitions
+ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IGNORE' at line 1
ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t IGNORE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p1 WITH TABLE t IGNORE' at line 1
+ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p1 WITH TABLE t' at line 1
ALTER TABLE tp EXCHANGE PARTITION (p0,p1) WITH TABLE t;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(p0,p1) WITH TABLE t' at line 1
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2) IGNORE;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(t,t2) IGNORE' at line 1
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2);
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(t,t2)' at line 1
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t,t2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't2' at line 1
-ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t;
ERROR HY000: Unknown partition 'non_existent' in table 'tp'
ALTER TABLE tsp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Subpartitioned table, use subpartition instead of partition
@@ -280,7 +258,7 @@ a b
63 Sixty three
64 Sixty four
# Test exchange partition
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
@@ -356,46 +334,8 @@ a b
62 Sixty two
63 Sixty three
64 Sixty four
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
-SHOW CREATE TABLE t;
-Table Create Table
-t CREATE TABLE `t` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` varchar(55) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW CREATE TABLE tp;
-Table Create Table
-tp CREATE TABLE `tp` (
- `a` int(11) NOT NULL DEFAULT '0',
- `b` varchar(55) DEFAULT NULL,
- PRIMARY KEY (`a`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-/*!50100 PARTITION BY RANGE (a)
-(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
- PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
-SELECT * FROM t;
-a b
-10 Ten
-2 First value
-50 Fifty
-61 Sixty one
-62 Sixty two
-63 Sixty three
-64 Sixty four
-SELECT * FROM tp;
-a b
-1 First value
-161 161
-162 162
-163 163
-164 164
-200 Two hundred, end of values
-3 Three
-5 Five
-99 End of values
-# Test exchange subpartition with IGNORE
-ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE;
+# Test exchange subpartition
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
@@ -420,28 +360,25 @@ SUBPARTITION BY HASH (a)
SUBPARTITION sp3 ENGINE = MyISAM)) */
SELECT * FROM t;
a b
-161 161
-163 163
+61 Sixty one
+63 Sixty three
SELECT * FROM tsp;
a b
+1 First value
10 Ten
-10 Ten
+161 161
162 162
+163 163
164 164
2 First value
-2 First value
200 Two hundred, end of values
+3 Three
+5 Five
50 Fifty
-50 Fifty
-61 Sixty one
-61 Sixty one
62 Sixty two
-62 Sixty two
-63 Sixty three
-63 Sixty three
64 Sixty four
-64 Sixty four
-ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE;
+99 End of values
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
ALTER TABLE t ENGINE = InnoDB;
ALTER TABLE tp ENGINE = InnoDB;
SHOW CREATE TABLE t;
@@ -463,25 +400,25 @@ tp CREATE TABLE `tp` (
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT * FROM t;
a b
-10 Ten
-2 First value
-50 Fifty
-61 Sixty one
-62 Sixty two
-63 Sixty three
-64 Sixty four
+1 First value
+3 Three
+5 Five
+99 End of values
SELECT * FROM tp;
a b
-1 First value
+10 Ten
161 161
162 162
163 163
164 164
+2 First value
200 Two hundred, end of values
-3 Three
-5 Five
-99 End of values
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+50 Fifty
+61 Sixty one
+62 Sixty two
+63 Sixty three
+64 Sixty four
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
@@ -501,25 +438,25 @@ tp CREATE TABLE `tp` (
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT * FROM t;
a b
-1 First value
-3 Three
-5 Five
-99 End of values
-SELECT * FROM tp;
-a b
10 Ten
-161 161
-162 162
-163 163
-164 164
2 First value
-200 Two hundred, end of values
50 Fifty
61 Sixty one
62 Sixty two
63 Sixty three
64 Sixty four
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+SELECT * FROM tp;
+a b
+1 First value
+161 161
+162 162
+163 163
+164 164
+200 Two hundred, end of values
+3 Three
+5 Five
+99 End of values
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
# test different engines
ALTER TABLE t ENGINE = MyISAM;
ALTER TABLE tp ENGINE = InnoDB;
@@ -540,7 +477,7 @@ tp CREATE TABLE `tp` (
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL
SHOW CREATE TABLE t;
Table Create Table
@@ -566,7 +503,7 @@ INSERT INTO tmp SELECT * FROM t;
RENAME TABLE t TO tmp2, tmp TO t;
ALTER TABLE tp ENGINE = MyISAM;
ALTER TABLE t CHARACTER SET = koi8r COLLATE koi8r_general_ci;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Non matching attribute 'CHARACTER SET' between partition and table
DROP TABLE t;
# Test multiple different table options
@@ -592,7 +529,7 @@ tp CREATE TABLE `tp` (
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Non matching attribute 'MAX_ROWS' between partition and table
SHOW WARNINGS;
Level Code Message
@@ -603,7 +540,7 @@ RENAME TABLE tmp2 TO t;
ALTER TABLE t ADD KEY ba_key (b, a);
ALTER TABLE tp ADD KEY ba_key (b, a);
ALTER TABLE tsp ADD KEY ba_key (b, a);
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
@@ -625,35 +562,35 @@ tp CREATE TABLE `tp` (
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
SELECT * FROM t;
a b
-161 161
-162 162
-163 163
-164 164
-200 Two hundred, end of values
-SELECT * FROM tp;
-a b
-1 First value
10 Ten
2 First value
-3 Three
-5 Five
50 Fifty
61 Sixty one
62 Sixty two
63 Sixty three
64 Sixty four
+SELECT * FROM tp;
+a b
+1 First value
+161 161
+162 162
+163 163
+164 164
+200 Two hundred, end of values
+3 Three
+5 Five
99 End of values
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ALTER TABLE t DROP KEY ba_key;
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Tables have different definitions
ALTER TABLE t ADD KEY b_key (b);
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE;
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
ERROR HY000: Tables have different definitions
ALTER TABLE t ADD KEY ba_key (b, a);
ALTER TABLE t DROP KEY b_key;
ALTER TABLE t CHANGE a c INT;
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE;
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
ERROR HY000: Tables have different definitions
ALTER TABLE t CHANGE c a INT;
# test temporary table
@@ -682,7 +619,7 @@ tp CREATE TABLE `tp` (
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = MyISAM,
PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Table to exchange with partition is temporary: 't'
SHOW CREATE TABLE t;
Table Create Table
@@ -707,7 +644,7 @@ DROP TEMPORARY TABLE t;
ALTER TABLE tmp2 RENAME TO t;
# Test non partitioned table
ALTER TABLE tp REMOVE PARTITIONING;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ERROR HY000: Partition management on a not partitioned table is not possible
DROP TABLE t, tp, tsp;
# Test with general_log
=== modified file 'mysql-test/r/variables-big.result'
--- a/mysql-test/r/variables-big.result 2009-03-30 10:03:25 +0000
+++ b/mysql-test/r/variables-big.result 2010-11-15 15:17:38 +0000
@@ -1,20 +1,20 @@
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
SHOW PROCESSLIST;
Id User Host db Command Time State Info
-<Id> root localhost test Query <Time> NULL SHOW PROCESSLIST
+<Id> root <Host> test Query <Time> NULL SHOW PROCESSLIST
=== modified file 'mysql-test/suite/parts/inc/partition_auto_increment.inc'
--- a/mysql-test/suite/parts/inc/partition_auto_increment.inc 2010-05-26 08:07:20 +0000
+++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc 2010-11-16 00:21:26 +0000
@@ -114,6 +114,30 @@ OPTIMIZE TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+if (!$skip_update)
+{
+eval CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+ UNIQUE KEY (a))
+ENGINE=$engine;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+DROP TABLE t1;
+SET INSERT_ID = 1;
+}
+
-- echo # Simple test with NULL
eval CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -905,5 +929,30 @@ SELECT * FROM t ORDER BY c1 ASC;
DROP TABLE t;
+if (!$skip_update)
+{
+eval CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+ UNIQUE KEY (a))
+ENGINE=$engine
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+SELECT * FROM t1;
+DROP TABLE t1;
+}
+
+
--echo ##############################################################################
}
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_blackhole.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result 2010-05-26 08:07:20 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_blackhole.result 2010-11-16 00:21:26 +0000
@@ -124,6 +124,38 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='Blackhole';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_innodb.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result 2010-05-26 08:07:20 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result 2010-11-16 00:21:26 +0000
@@ -143,6 +143,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='InnoDB';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -1026,4 +1062,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='InnoDB'
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
##############################################################################
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_memory.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_memory.result 2010-05-26 08:07:20 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_memory.result 2010-11-16 00:21:26 +0000
@@ -143,6 +143,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='Memory';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -1054,4 +1090,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='Memory'
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
##############################################################################
=== modified file 'mysql-test/suite/parts/r/partition_auto_increment_myisam.result'
--- a/mysql-test/suite/parts/r/partition_auto_increment_myisam.result 2010-05-26 08:07:20 +0000
+++ b/mysql-test/suite/parts/r/partition_auto_increment_myisam.result 2010-11-16 00:21:26 +0000
@@ -143,6 +143,42 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='MyISAM';
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
+SET INSERT_ID = 1;
# Simple test with NULL
CREATE TABLE t1 (
c1 INT NOT NULL AUTO_INCREMENT,
@@ -1073,4 +1109,40 @@ c1 c2
2 20
127 40
DROP TABLE t;
+CREATE TABLE t1
+(a INT NULL AUTO_INCREMENT,
+UNIQUE KEY (a))
+ENGINE='MyISAM'
+PARTITION BY KEY(a) PARTITIONS 2;
+SET LAST_INSERT_ID = 999;
+SET INSERT_ID = 0;
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+1
+INSERT INTO t1 SET a = 1 ON DUPLICATE KEY UPDATE a = NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = 1 WHERE a IS NULL;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+UPDATE t1 SET a = NULL WHERE a = 1;
+SELECT LAST_INSERT_ID();
+LAST_INSERT_ID()
+999
+SELECT * FROM t1;
+a
+0
+DROP TABLE t1;
##############################################################################
=== modified file 'mysql-test/suite/perfschema/t/threads_mysql.test'
--- a/mysql-test/suite/perfschema/t/threads_mysql.test 2010-11-09 14:34:29 +0000
+++ b/mysql-test/suite/perfschema/t/threads_mysql.test 2010-11-11 14:34:48 +0000
@@ -22,13 +22,25 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
-# Ensure that the event scheduler (started via threads_events-master.opt)
+# Ensure that the event scheduler (started via threads_mysql-master.opt)
# is really running.
--source include/running_event_scheduler.inc
SET GLOBAL event_scheduler = OFF;
--source include/no_running_event_scheduler.inc
+# threads are removed from:
+# - information_schema.processlist
+# - performance_schema.threads
+# at different times, so we may have to wait a little more
+# for the event_scheduler to shutdown
+#
+let $wait_timeout= 1;
+let $wait_condition=
+ SELECT COUNT(*) = 0 FROM performance_schema.threads
+ WHERE name like 'thread/sql/event%';
+--source include/wait_condition.inc
+
--vertical_results
# Show all "system" threads except the event scheduler
=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def 2010-10-27 14:52:20 +0000
+++ b/mysql-test/t/disabled.def 2010-11-16 01:06:29 +0000
@@ -17,3 +17,8 @@ query_cache_28249 : Bug#43861 200
ctype_utf8mb4_ndb : Bug#55799, Bug#51907, disabled by Konstantin 2010-08-06
main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
+log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists
+read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists
+sum_distinct-big : Bug#56927 2010-11-15 mattiasj was not tested
+alter_table-big : Bug#37248 2010-11-15 mattiasj was not tested
+create-big : Bug#37248 2010-11-15 mattiasj was not tested
=== modified file 'mysql-test/t/not_embedded_server.test'
--- a/mysql-test/t/not_embedded_server.test 2009-12-04 23:02:48 +0000
+++ b/mysql-test/t/not_embedded_server.test 2010-11-15 15:18:04 +0000
@@ -54,3 +54,57 @@ lock tables t1 read;
flush privileges;
unlock tables;
drop table t1;
+
+--echo #
+--echo # Bug#54812: assert in Diagnostics_area::set_ok_status during EXPLAIN
+--echo #
+
+CREATE USER nopriv_user@localhost;
+
+connection default;
+--echo connection: default
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3;
+DROP FUNCTION IF EXISTS f;
+--enable_warnings
+
+CREATE TABLE t1 (key1 INT PRIMARY KEY);
+CREATE TABLE t2 (key2 INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE FUNCTION f() RETURNS INT RETURN 1;
+
+GRANT FILE ON *.* TO 'nopriv_user'@'localhost';
+
+FLUSH PRIVILEGES;
+
+connect (con1,localhost,nopriv_user,,);
+connection con1;
+--echo connection: con1
+
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT MAX(key1) FROM t1 WHERE f() < 1 INTO OUTFILE 'mytest';
+
+--error ER_PROCACCESS_DENIED_ERROR
+INSERT INTO t2 SELECT MAX(key1) FROM t1 WHERE f() < 1;
+
+--error ER_PROCACCESS_DENIED_ERROR
+SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
+
+--error ER_PROCACCESS_DENIED_ERROR
+CREATE TABLE t3 (i INT) AS SELECT MAX(key1) FROM t1 WHERE f() < 1;
+
+disconnect con1;
+--source include/wait_until_disconnected.inc
+
+connection default;
+--echo connection: default
+
+DROP TABLE t1,t2;
+DROP FUNCTION f;
+DROP USER nopriv_user@localhost;
+
+--echo #
+--echo # End Bug#54812
+--echo #
=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test 2010-10-26 09:10:59 +0000
+++ b/mysql-test/t/partition.test 2010-11-16 00:21:26 +0000
@@ -15,6 +15,24 @@ drop table if exists t1, t2;
--enable_warnings
--echo #
+--echo # Bug#57778: failed primary key add to partitioned innodb table
+--echo # inconsistent and crashes
+--echo #
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL)
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (0,1), (0,2);
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2;
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+SELECT * FROM t1;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+--echo #
--echo # Bug#57113: ha_partition::extra(ha_extra_function):
--echo # Assertion `m_extra_cache' failed
CREATE TABLE t1
=== modified file 'mysql-test/t/partition_exchange.test'
--- a/mysql-test/t/partition_exchange.test 2010-08-25 14:00:02 +0000
+++ b/mysql-test/t/partition_exchange.test 2010-11-16 00:55:42 +0000
@@ -5,16 +5,32 @@
DROP TABLE IF EXISTS t1, t2, t3, t, tp, tsp, tmp;
--enable_warnings
-CREATE TABLE t1 (s1 INT PRIMARY KEY) engine=innodb;
+--echo #
+--echo # Bug#56484: !table || (!table->read_set ||
+--echo # bitmap_is_set(table->read_set, field_index))
+--echo #
+CREATE TABLE t1 (a INT NOT NULL,b TIME NOT NULL DEFAULT '00:00:00')
+ENGINE=MyISAM
+PARTITION BY HASH (a) PARTITIONS 2;
-CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) engine=innodb;
+CREATE TABLE t2 (a INT) ENGINE=MYISAM;
+--error ER_TABLES_DIFFERENT_METADATA
+ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t2;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#55784: Foreign key integrity broken by alter table
+--echo #
+CREATE TABLE t1 (s1 INT PRIMARY KEY) ENGINE=InnoDB;
+
+CREATE TABLE t2 (s1 INT, FOREIGN KEY (s1) REFERENCES t1 (s1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (1),(2),(3);
CREATE TABLE t3 (s1 INT PRIMARY KEY)
- engine=innodb
+ ENGINE=InnoDB
PARTITION BY LIST (s1)
(PARTITION p1 VALUES IN (1,2,3));
@@ -73,15 +89,6 @@ SELECT * FROM t;
SELECT * FROM tp;
--error ER_ROW_DOES_NOT_MATCH_PARTITION
ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t;
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
---echo # No need to use ignore on the original partition
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
--sorted_result
@@ -90,15 +97,19 @@ SELECT * FROM t;
SELECT * FROM tp;
--echo # Test list of partitions
--error ER_PARSE_ERROR
+ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+--error ER_PARSE_ERROR
ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t IGNORE;
--error ER_PARSE_ERROR
+ALTER TABLE tp EXCHANGE PARTITION p0,p1 WITH TABLE t;
+--error ER_PARSE_ERROR
ALTER TABLE tp EXCHANGE PARTITION (p0,p1) WITH TABLE t;
--error ER_PARSE_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2) IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE (t,t2);
--error ER_PARSE_ERROR
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t,t2;
--error ER_UNKNOWN_PARTITION
-ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION non_existent WITH TABLE t;
--error ER_PARTITION_INSTEAD_OF_SUBPARTITION
ALTER TABLE tsp EXCHANGE PARTITION p0 WITH TABLE t;
--error ER_PARTITION_EXCHANGE_PART_TABLE
@@ -111,13 +122,6 @@ SELECT * FROM t;
--sorted_result
SELECT * FROM tp;
--echo # Test exchange partition
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
-SHOW CREATE TABLE t;
-SHOW CREATE TABLE tp;
---sorted_result
-SELECT * FROM t;
---sorted_result
-SELECT * FROM tp;
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
@@ -132,15 +136,15 @@ SHOW CREATE TABLE tp;
SELECT * FROM t;
--sorted_result
SELECT * FROM tp;
---echo # Test exchange subpartition with IGNORE
-ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE;
+--echo # Test exchange subpartition
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tsp;
--sorted_result
SELECT * FROM t;
--sorted_result
SELECT * FROM tsp;
-ALTER TABLE tsp EXCHANGE PARTITION sp3 WITH TABLE t IGNORE;
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
ALTER TABLE t ENGINE = InnoDB;
ALTER TABLE tp ENGINE = InnoDB;
SHOW CREATE TABLE t;
@@ -149,21 +153,21 @@ SHOW CREATE TABLE tp;
SELECT * FROM t;
--sorted_result
SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
--sorted_result
SELECT * FROM t;
--sorted_result
SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
--echo # test different engines
ALTER TABLE t ENGINE = MyISAM;
ALTER TABLE tp ENGINE = InnoDB;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
--error ER_MIX_HANDLER_ERROR
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
--echo # Test different charsets
@@ -174,7 +178,7 @@ RENAME TABLE t TO tmp2, tmp TO t;
ALTER TABLE tp ENGINE = MyISAM;
ALTER TABLE t CHARACTER SET = koi8r COLLATE koi8r_general_ci;
--error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
DROP TABLE t;
--echo # Test multiple different table options
CREATE TABLE t (a INT,
@@ -185,7 +189,7 @@ INSERT INTO t SELECT * FROM tmp2;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
--error ER_PARTITION_EXCHANGE_DIFFERENT_OPTION
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW WARNINGS;
DROP TABLE t;
RENAME TABLE tmp2 TO t;
@@ -193,27 +197,27 @@ RENAME TABLE tmp2 TO t;
ALTER TABLE t ADD KEY ba_key (b, a);
ALTER TABLE tp ADD KEY ba_key (b, a);
ALTER TABLE tsp ADD KEY ba_key (b, a);
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
--sorted_result
SELECT * FROM t;
--sorted_result
SELECT * FROM tp;
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ALTER TABLE t DROP KEY ba_key;
--error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE tp EXCHANGE PARTITION p1 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
ALTER TABLE t ADD KEY b_key (b);
--error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE;
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
ALTER TABLE t ADD KEY ba_key (b, a);
ALTER TABLE t DROP KEY b_key;
# test different index types
# test different columns
ALTER TABLE t CHANGE a c INT;
--error ER_TABLES_DIFFERENT_METADATA
-ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t IGNORE;
+ALTER TABLE tsp EXCHANGE PARTITION sp1 WITH TABLE t;
ALTER TABLE t CHANGE c a INT;
# test different data/index dir
# test different options (row_format, max/min_rows, comments, tablespace,
@@ -229,7 +233,7 @@ ALTER TABLE tmp RENAME TO t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
--error ER_PARTITION_EXCHANGE_TEMP_TABLE
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
SHOW CREATE TABLE t;
SHOW CREATE TABLE tp;
DROP TEMPORARY TABLE t;
@@ -237,7 +241,7 @@ ALTER TABLE tmp2 RENAME TO t;
--echo # Test non partitioned table
ALTER TABLE tp REMOVE PARTITIONING;
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
-ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t IGNORE;
+ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t;
# TODO:
# Verify that it is possible to read a table that is going to be exchanged
=== modified file 'mysql-test/t/variables-big.test'
--- a/mysql-test/t/variables-big.test 2009-03-30 10:03:25 +0000
+++ b/mysql-test/t/variables-big.test 2010-11-15 15:17:38 +0000
@@ -37,19 +37,19 @@
--disable_warnings
SET SESSION transaction_prealloc_size=1024*1024*1024*1;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
---replace_column 1 <Id> 6 <Time>
+--replace_column 1 <Id> 3 <Host> 6 <Time>
SHOW PROCESSLIST;
--enable_warnings
=== modified file 'mysys/default.c'
--- a/mysys/default.c 2010-11-10 11:48:00 +0000
+++ b/mysys/default.c 2010-11-16 11:07:17 +0000
@@ -68,6 +68,9 @@ const char *my_defaults_file=0;
const char *my_defaults_group_suffix=0;
const char *my_defaults_extra_file=0;
+static char my_defaults_file_buffer[FN_REFLEN];
+static char my_defaults_extra_file_buffer[FN_REFLEN];
+
static my_bool defaults_already_read= FALSE;
/* Which directories are searched for options (and in which order) */
@@ -152,22 +155,19 @@ static char *remove_end_comment(char *pt
*/
static int
-fn_expand(const char *filename, const char **filename_var)
+fn_expand(const char *filename, char *result_buf)
{
- char dir[FN_REFLEN], buf[FN_REFLEN];
+ char dir[FN_REFLEN];
const int flags= MY_UNPACK_FILENAME | MY_SAFE_PATH | MY_RELATIVE_PATH;
- const char *result_path= NULL;
DBUG_ENTER("fn_expand");
- DBUG_PRINT("enter", ("filename: %s, buf: 0x%lx", filename, (unsigned long) buf));
+ DBUG_PRINT("enter", ("filename: %s, result_buf: 0x%lx",
+ filename, (unsigned long) result_buf));
if (my_getwd(dir, sizeof(dir), MYF(0)))
DBUG_RETURN(3);
DBUG_PRINT("debug", ("dir: %s", dir));
- if (fn_format(buf, filename, dir, NULL, flags) == NULL ||
- (result_path= my_strdup(buf, MYF(0))) == NULL)
+ if (fn_format(result_buf, filename, dir, NULL, flags) == NULL)
DBUG_RETURN(2);
- DBUG_PRINT("return", ("result: %s", result_path));
- DBUG_ASSERT(result_path != NULL);
- *filename_var= result_path;
+ DBUG_PRINT("return", ("result: %s", result_buf));
DBUG_RETURN(0);
}
@@ -224,16 +224,18 @@ int my_search_option_files(const char *c
if (forced_extra_defaults && !defaults_already_read)
{
- int error= fn_expand(forced_extra_defaults, &my_defaults_extra_file);
+ int error= fn_expand(forced_extra_defaults, my_defaults_extra_file_buffer);
if (error)
DBUG_RETURN(error);
+ my_defaults_extra_file= my_defaults_extra_file_buffer;
}
if (forced_default_file && !defaults_already_read)
{
- int error= fn_expand(forced_default_file, &my_defaults_file);
+ int error= fn_expand(forced_default_file, my_defaults_file_buffer);
if (error)
DBUG_RETURN(error);
+ my_defaults_file= my_defaults_file_buffer;
}
defaults_already_read= TRUE;
=== modified file 'mysys/mf_iocache.c'
--- a/mysys/mf_iocache.c 2010-07-29 12:33:56 +0000
+++ b/mysys/mf_iocache.c 2010-11-16 06:27:18 +0000
@@ -173,7 +173,7 @@ int init_io_cache(IO_CACHE *info, File f
if (file >= 0)
{
- pos= my_tell(file, MYF(0));
+ pos= mysql_file_tell(file, MYF(0));
if ((pos == (my_off_t) -1) && (my_errno == ESPIPE))
{
/*
@@ -205,7 +205,7 @@ int init_io_cache(IO_CACHE *info, File f
if (!(cache_myflags & MY_DONT_CHECK_FILESIZE))
{
/* Calculate end of file to avoid allocating oversized buffers */
- end_of_file=my_seek(file,0L,MY_SEEK_END,MYF(0));
+ end_of_file= mysql_file_seek(file, 0L, MY_SEEK_END, MYF(0));
/* Need to reset seek_not_done now that we just did a seek. */
info->seek_not_done= end_of_file == seek_offset ? 0 : 1;
if (end_of_file < seek_offset)
@@ -485,7 +485,7 @@ int _my_b_read(register IO_CACHE *info,
*/
if (info->seek_not_done)
{
- if ((my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0))
+ if ((mysql_file_seek(info->file, pos_in_file, MY_SEEK_SET, MYF(0))
!= MY_FILEPOS_ERROR))
{
/* No error, reset seek_not_done flag. */
@@ -529,7 +529,7 @@ int _my_b_read(register IO_CACHE *info,
end aligned with a block.
*/
length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
- if ((read_length= my_read(info->file,Buffer, length, info->myflags))
+ if ((read_length= mysql_file_read(info->file,Buffer, length, info->myflags))
!= length)
{
/*
@@ -572,7 +572,7 @@ int _my_b_read(register IO_CACHE *info,
}
length=0; /* Didn't read any chars */
}
- else if ((length= my_read(info->file,info->buffer, max_length,
+ else if ((length= mysql_file_read(info->file,info->buffer, max_length,
info->myflags)) < Count ||
length == (size_t) -1)
{
@@ -1056,7 +1056,7 @@ int _my_b_read_r(register IO_CACHE *cach
*/
if (cache->seek_not_done)
{
- if (my_seek(cache->file, pos_in_file, MY_SEEK_SET, MYF(0))
+ if (mysql_file_seek(cache->file, pos_in_file, MY_SEEK_SET, MYF(0))
== MY_FILEPOS_ERROR)
{
cache->error= -1;
@@ -1064,7 +1064,7 @@ int _my_b_read_r(register IO_CACHE *cach
DBUG_RETURN(1);
}
}
- len= my_read(cache->file, cache->buffer, length, cache->myflags);
+ len= mysql_file_read(cache->file, cache->buffer, length, cache->myflags);
}
DBUG_PRINT("io_cache_share", ("read %lu bytes", (ulong) len));
@@ -1203,7 +1203,7 @@ int _my_b_seq_read(register IO_CACHE *in
With read-append cache we must always do a seek before we read,
because the write could have moved the file pointer astray
*/
- if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) == MY_FILEPOS_ERROR)
+ if (mysql_file_seek(info->file, pos_in_file, MY_SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR)
{
info->error= -1;
unlock_append_buffer(info);
@@ -1220,8 +1220,8 @@ int _my_b_seq_read(register IO_CACHE *in
size_t read_length;
length=(Count & (size_t) ~(IO_SIZE-1))-diff_length;
- if ((read_length= my_read(info->file,Buffer, length,
- info->myflags)) == (size_t) -1)
+ if ((read_length= mysql_file_read(info->file,Buffer, length,
+ info->myflags)) == (size_t) -1)
{
info->error= -1;
unlock_append_buffer(info);
@@ -1254,7 +1254,7 @@ int _my_b_seq_read(register IO_CACHE *in
}
else
{
- length= my_read(info->file,info->buffer, max_length, info->myflags);
+ length= mysql_file_read(info->file,info->buffer, max_length, info->myflags);
if (length == (size_t) -1)
{
info->error= -1;
@@ -1431,7 +1431,7 @@ int _my_b_async_read(register IO_CACHE *
return 1;
}
- if (my_seek(info->file,next_pos_in_file,MY_SEEK_SET,MYF(0))
+ if (mysql_file_seek(info->file, next_pos_in_file, MY_SEEK_SET, MYF(0))
== MY_FILEPOS_ERROR)
{
info->error= -1;
@@ -1441,8 +1441,8 @@ int _my_b_async_read(register IO_CACHE *
read_length=IO_SIZE*2- (size_t) (next_pos_in_file & (IO_SIZE-1));
if (Count < read_length)
{ /* Small block, read to cache */
- if ((read_length=my_read(info->file,info->request_pos,
- read_length, info->myflags)) == (size_t) -1)
+ if ((read_length=mysql_file_read(info->file,info->request_pos,
+ read_length, info->myflags)) == (size_t) -1)
return info->error= -1;
use_length=min(Count,read_length);
memcpy(Buffer,info->request_pos,(size_t) use_length);
@@ -1462,7 +1462,7 @@ int _my_b_async_read(register IO_CACHE *
}
else
{ /* Big block, don't cache it */
- if ((read_length= my_read(info->file,Buffer, Count,info->myflags))
+ if ((read_length= mysql_file_read(info->file, Buffer, Count,info->myflags))
!= Count)
{
info->error= read_length == (size_t) -1 ? -1 : read_length+left_length;
@@ -1569,14 +1569,14 @@ int _my_b_write(register IO_CACHE *info,
"seek_not_done" to indicate this to other functions operating
on the IO_CACHE.
*/
- if (my_seek(info->file,info->pos_in_file,MY_SEEK_SET,MYF(0)))
+ if (mysql_file_seek(info->file, info->pos_in_file, MY_SEEK_SET, MYF(0)))
{
info->error= -1;
return (1);
}
info->seek_not_done=0;
}
- if (my_write(info->file, Buffer, length, info->myflags | MY_NABP))
+ if (mysql_file_write(info->file, Buffer, length, info->myflags | MY_NABP))
return info->error= -1;
#ifdef THREAD
@@ -1639,7 +1639,7 @@ int my_b_append(register IO_CACHE *info,
if (Count >= IO_SIZE)
{ /* Fill first intern buffer */
length=Count & (size_t) ~(IO_SIZE-1);
- if (my_write(info->file,Buffer, length, info->myflags | MY_NABP))
+ if (mysql_file_write(info->file,Buffer, length, info->myflags | MY_NABP))
{
unlock_append_buffer(info);
return info->error= -1;
@@ -1695,11 +1695,11 @@ int my_block_write(register IO_CACHE *in
{
/* Of no overlap, write everything without buffering */
if (pos + Count <= info->pos_in_file)
- return my_pwrite(info->file, Buffer, Count, pos,
- info->myflags | MY_NABP);
+ return mysql_file_pwrite(info->file, Buffer, Count, pos,
+ info->myflags | MY_NABP);
/* Write the part of the block that is before buffer */
length= (uint) (info->pos_in_file - pos);
- if (my_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP))
+ if (mysql_file_pwrite(info->file, Buffer, length, pos, info->myflags | MY_NABP))
info->error= error= -1;
Buffer+=length;
pos+= length;
@@ -1789,7 +1789,7 @@ int my_b_flush_io_cache(IO_CACHE *info,
*/
if (!append_cache && info->seek_not_done)
{ /* File touched, do seek */
- if (my_seek(info->file,pos_in_file,MY_SEEK_SET,MYF(0)) ==
+ if (mysql_file_seek(info->file, pos_in_file, MY_SEEK_SET, MYF(0)) ==
MY_FILEPOS_ERROR)
{
UNLOCK_APPEND_BUFFER;
@@ -1803,7 +1803,7 @@ int my_b_flush_io_cache(IO_CACHE *info,
info->write_end= (info->write_buffer+info->buffer_length-
((pos_in_file+length) & (IO_SIZE-1)));
- if (my_write(info->file,info->write_buffer,length,
+ if (mysql_file_write(info->file,info->write_buffer,length,
info->myflags | MY_NABP))
info->error= -1;
else
@@ -1815,7 +1815,7 @@ int my_b_flush_io_cache(IO_CACHE *info,
else
{
info->end_of_file+=(info->write_pos-info->append_read_pos);
- DBUG_ASSERT(info->end_of_file == my_tell(info->file,MYF(0)));
+ DBUG_ASSERT(info->end_of_file == mysql_file_tell(info->file, MYF(0)));
}
info->append_read_pos=info->write_pos=info->write_buffer;
=== modified file 'mysys/mf_keycache.c'
--- a/mysys/mf_keycache.c 2010-07-23 20:15:41 +0000
+++ b/mysys/mf_keycache.c 2010-11-16 09:45:07 +0000
@@ -3963,11 +3963,11 @@ restart:
if (!(block->status & (BLOCK_IN_EVICTION | BLOCK_IN_SWITCH |
BLOCK_REASSIGNED)))
{
- struct st_hash_link *next_hash_link;
- my_off_t next_diskpos;
- File next_file;
- uint next_status;
- uint hash_requests;
+ struct st_hash_link *UNINIT_VAR(next_hash_link);
+ my_off_t UNINIT_VAR(next_diskpos);
+ File UNINIT_VAR(next_file);
+ uint UNINIT_VAR(next_status);
+ uint UNINIT_VAR(hash_requests);
total_found++;
found++;
=== modified file 'regex/regexec.c'
--- a/regex/regexec.c 2010-07-26 10:39:38 +0000
+++ b/regex/regexec.c 2010-11-16 10:05:56 +0000
@@ -117,6 +117,7 @@ size_t nmatch;
my_regmatch_t pmatch[];
int eflags;
{
+ char *pstr = (char *) str;
register struct re_guts *g = preg->re_g;
#ifdef REDEBUG
# define GOODFLAGS(f) (f)
@@ -133,7 +134,7 @@ int eflags;
if ((size_t) g->nstates <= CHAR_BIT*sizeof(states1) &&
!(eflags&MY_REG_LARGE))
- return(smatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
+ return(smatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
else
- return(lmatcher(preg->charset, g, (char *)str, nmatch, pmatch, eflags));
+ return(lmatcher(preg->charset, g, pstr, nmatch, pmatch, eflags));
}
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc 2010-11-16 09:38:43 +0000
+++ b/sql/binlog.cc 2010-11-16 12:38:17 +0000
@@ -1597,8 +1597,8 @@ bool MYSQL_BIN_LOG::open(const char *log
write_error= 0;
/* open the main log file */
- if (MYSQL_LOG::open(log_name, log_type_arg, new_name,
- io_cache_type_arg))
+ if (MYSQL_LOG::open(key_file_binlog,
+ log_name, log_type_arg, new_name, io_cache_type_arg))
{
#ifdef HAVE_REPLICATION
close_purge_index_file();
=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc 2010-07-08 21:42:23 +0000
+++ b/sql/debug_sync.cc 2010-11-16 10:05:56 +0000
@@ -1691,7 +1691,7 @@ static void debug_sync_execute(THD *thd,
if (action->execute)
{
- const char *old_proc_info;
+ const char *UNINIT_VAR(old_proc_info);
action->execute--;
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2010-10-21 11:34:17 +0000
+++ b/sql/ha_partition.cc 2010-11-16 00:21:26 +0000
@@ -3094,7 +3094,9 @@ int ha_partition::write_row(uchar * buf)
bool have_auto_increment= table->next_number_field && buf == table->record[0];
my_bitmap_map *old_map;
THD *thd= ha_thd();
- timestamp_auto_set_type orig_timestamp_type= table->timestamp_field_type;
+ timestamp_auto_set_type saved_timestamp_type= table->timestamp_field_type;
+ ulong saved_sql_mode= thd->variables.sql_mode;
+ bool saved_auto_inc_field_not_null= table->auto_increment_field_not_null;
#ifdef NOT_NEEDED
uchar *rec0= m_rec0;
#endif
@@ -3130,6 +3132,22 @@ int ha_partition::write_row(uchar * buf)
*/
if (error)
goto exit;
+
+ /*
+ Don't allow generation of auto_increment value the partitions handler.
+ If a partitions handler would change the value, then it might not
+ match the partition any longer.
+ This can occur if 'SET INSERT_ID = 0; INSERT (NULL)',
+ So allow this by adding 'MODE_NO_AUTO_VALUE_ON_ZERO' to sql_mode.
+ The partitions handler::next_insert_id must always be 0. Otherwise
+ we need to forward release_auto_increment, or reset it for all
+ partitions.
+ */
+ if (table->next_number_field->val_int() == 0)
+ {
+ table->auto_increment_field_not_null= TRUE;
+ thd->variables.sql_mode|= MODE_NO_AUTO_VALUE_ON_ZERO;
+ }
}
old_map= dbug_tmp_use_all_columns(table, table->read_set);
@@ -3163,7 +3181,9 @@ int ha_partition::write_row(uchar * buf)
set_auto_increment_if_higher(table->next_number_field);
reenable_binlog(thd);
exit:
- table->timestamp_field_type= orig_timestamp_type;
+ thd->variables.sql_mode= saved_sql_mode;
+ table->auto_increment_field_not_null= saved_auto_inc_field_not_null;
+ table->timestamp_field_type= saved_timestamp_type;
DBUG_RETURN(error);
}
@@ -3230,11 +3250,24 @@ int ha_partition::update_row(const uchar
}
else
{
+ Field *saved_next_number_field= table->next_number_field;
+ /*
+ Don't allow generation of auto_increment value for update.
+ table->next_number_field is never set on UPDATE.
+ But is set for INSERT ... ON DUPLICATE KEY UPDATE,
+ and since update_row() does not generate or update an auto_inc value,
+ we cannot have next_number_field set when moving a row
+ to another partition with write_row(), since that could
+ generate/update the auto_inc value.
+ This gives the same behavior for partitioned vs non partitioned tables.
+ */
+ table->next_number_field= NULL;
DBUG_PRINT("info", ("Update from partition %d to partition %d",
old_part_id, new_part_id));
tmp_disable_binlog(thd); /* Do not replicate the low-level changes. */
error= m_file[new_part_id]->ha_write_row(new_data);
reenable_binlog(thd);
+ table->next_number_field= saved_next_number_field;
if (error)
goto exit;
@@ -6376,9 +6409,42 @@ bool ha_partition::get_error_message(int
*/
uint ha_partition::alter_table_flags(uint flags)
{
+ uint flags_to_return, flags_to_check;
DBUG_ENTER("ha_partition::alter_table_flags");
- DBUG_RETURN(ht->alter_table_flags(flags) |
- m_file[0]->alter_table_flags(flags));
+
+ flags_to_return= ht->alter_table_flags(flags);
+ flags_to_return|= m_file[0]->alter_table_flags(flags);
+
+ /*
+ If one partition fails we must be able to revert the change for the other,
+ already altered, partitions. So both ADD and DROP can only be supported in
+ pairs.
+ */
+ flags_to_check= HA_ONLINE_ADD_INDEX_NO_WRITES;
+ flags_to_check|= HA_ONLINE_DROP_INDEX_NO_WRITES;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES;
+ flags_to_check|= HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_PK_INDEX_NO_WRITES;
+ flags_to_check|= HA_ONLINE_DROP_PK_INDEX_NO_WRITES;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_INDEX;
+ flags_to_check|= HA_ONLINE_DROP_INDEX;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_UNIQUE_INDEX;
+ flags_to_check|= HA_ONLINE_DROP_UNIQUE_INDEX;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_ONLINE_ADD_PK_INDEX;
+ flags_to_check|= HA_ONLINE_DROP_PK_INDEX;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ DBUG_RETURN(flags_to_return);
}
@@ -6413,6 +6479,7 @@ int ha_partition::add_index(TABLE *table
handler **file;
int ret= 0;
+ DBUG_ENTER("ha_partition::add_index");
/*
There has already been a check in fix_partition_func in mysql_alter_table
before this call, which checks for unique/primary key violations of the
@@ -6420,8 +6487,28 @@ int ha_partition::add_index(TABLE *table
*/
for (file= m_file; *file; file++)
if ((ret= (*file)->add_index(table_arg, key_info, num_of_keys)))
- break;
- return ret;
+ goto err;
+ DBUG_RETURN(ret);
+err:
+ if (file > m_file)
+ {
+ uint *key_numbers= (uint*) ha_thd()->alloc(sizeof(uint) * num_of_keys);
+ uint old_num_of_keys= table_arg->s->keys;
+ uint i;
+ /* The newly created keys have the last id's */
+ for (i= 0; i < num_of_keys; i++)
+ key_numbers[i]= i + old_num_of_keys;
+ if (!table_arg->key_info)
+ table_arg->key_info= key_info;
+ while (--file >= m_file)
+ {
+ (void) (*file)->prepare_drop_index(table_arg, key_numbers, num_of_keys);
+ (void) (*file)->final_drop_index(table_arg);
+ }
+ if (table_arg->key_info == key_info)
+ table_arg->key_info= NULL;
+ }
+ DBUG_RETURN(ret);
}
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2010-11-05 16:23:32 +0000
+++ b/sql/handler.h 2010-11-16 00:21:26 +0000
@@ -183,6 +183,8 @@
/*
These bits are set if different kinds of indexes can be created
off-line without re-create of the table (but with a table lock).
+ Partitioning needs both ADD and DROP to be supported by its underlying
+ handlers, due to error handling, see bug#57778.
*/
#define HA_ONLINE_ADD_INDEX_NO_WRITES (1L << 0) /*add index w/lock*/
#define HA_ONLINE_DROP_INDEX_NO_WRITES (1L << 1) /*drop index w/lock*/
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2010-11-16 09:38:43 +0000
+++ b/sql/log.cc 2010-11-16 12:38:17 +0000
@@ -1359,7 +1359,11 @@ bool MYSQL_LOG::init_and_set_log_file_na
1 error
*/
-bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
+bool MYSQL_LOG::open(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_file_key log_file_key,
+#endif
+ const char *log_name, enum_log_type log_type_arg,
const char *new_name, enum cache_type io_cache_type_arg)
{
char buff[FN_REFLEN];
@@ -1387,7 +1391,12 @@ bool MYSQL_LOG::open(const char *log_nam
db[0]= 0;
- if ((file= mysql_file_open(key_file_MYSQL_LOG,
+#ifdef HAVE_PSI_INTERFACE
+ /* Keep the key for reopen */
+ m_log_file_key= log_file_key;
+#endif
+
+ if ((file= mysql_file_open(log_file_key,
log_file_name, open_flags,
MYF(MY_WME | ME_WAITTANG))) < 0 ||
init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
@@ -1571,7 +1580,11 @@ void MYSQL_QUERY_LOG::reopen_file()
Note that at this point, log_state != LOG_CLOSED (important for is_open()).
*/
- open(save_name, log_type, 0, io_cache_type);
+ open(
+#ifdef HAVE_PSI_INTERFACE
+ m_log_file_key,
+#endif
+ save_name, log_type, 0, io_cache_type);
my_free(save_name);
mysql_mutex_unlock(&LOCK_log);
=== modified file 'sql/log.h'
--- a/sql/log.h 2010-11-16 09:38:43 +0000
+++ b/sql/log.h 2010-11-16 12:38:17 +0000
@@ -179,7 +179,11 @@ public:
MYSQL_LOG();
void init_pthread_objects();
void cleanup();
- bool open(const char *log_name,
+ bool open(
+#ifdef HAVE_PSI_INTERFACE
+ PSI_file_key log_file_key,
+#endif
+ const char *log_name,
enum_log_type log_type,
const char *new_name,
enum cache_type io_cache_type_arg);
@@ -206,6 +210,10 @@ public:
volatile enum_log_state log_state;
enum cache_type io_cache_type;
friend class Log_event;
+#ifdef HAVE_PSI_INTERFACE
+ /** Instrumentation key to use for file io in @c log_file */
+ PSI_file_key m_log_file_key;
+#endif
};
class MYSQL_QUERY_LOG: public MYSQL_LOG
@@ -224,14 +232,22 @@ public:
bool open_slow_log(const char *log_name)
{
char buf[FN_REFLEN];
- return open(generate_name(log_name, "-slow.log", 0, buf), LOG_NORMAL, 0,
- WRITE_CACHE);
+ return open(
+#ifdef HAVE_PSI_INTERFACE
+ key_file_slow_log,
+#endif
+ generate_name(log_name, "-slow.log", 0, buf),
+ LOG_NORMAL, 0, WRITE_CACHE);
}
bool open_query_log(const char *log_name)
{
char buf[FN_REFLEN];
- return open(generate_name(log_name, ".log", 0, buf), LOG_NORMAL, 0,
- WRITE_CACHE);
+ return open(
+#ifdef HAVE_PSI_INTERFACE
+ key_file_query_log,
+#endif
+ generate_name(log_name, ".log", 0, buf),
+ LOG_NORMAL, 0, WRITE_CACHE);
}
private:
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-11-16 09:38:43 +0000
+++ b/sql/mysqld.cc 2010-11-16 12:38:17 +0000
@@ -8035,9 +8035,10 @@ PSI_file_key key_file_binlog, key_file_b
key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
- key_file_master_info, key_file_misc, key_file_MYSQL_LOG, key_file_partition,
+ key_file_master_info, key_file_misc, key_file_partition,
key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
key_file_trg, key_file_trn, key_file_init;
+PSI_file_key key_file_query_log, key_file_slow_log;
static PSI_file_info all_server_files[]=
{
@@ -8060,11 +8061,12 @@ static PSI_file_info all_server_files[]=
{ &key_file_log_event_info, "log_event_info", 0},
{ &key_file_master_info, "master_info", 0},
{ &key_file_misc, "misc", 0},
- { &key_file_MYSQL_LOG, "MYSQL_LOG", 0},
{ &key_file_partition, "partition", 0},
{ &key_file_pid, "pid", 0},
+ { &key_file_query_log, "query_log", 0},
{ &key_file_relay_log_info, "relay_log_info", 0},
{ &key_file_send_file, "send_file", 0},
+ { &key_file_slow_log, "slow_log", 0},
{ &key_file_tclog, "tclog", 0},
{ &key_file_trg, "trigger_name", 0},
{ &key_file_trn, "trigger", 0},
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2010-11-08 14:35:45 +0000
+++ b/sql/mysqld.h 2010-11-16 06:27:18 +0000
@@ -275,9 +275,10 @@ extern PSI_file_key key_file_binlog, key
key_file_dbopt, key_file_des_key_file, key_file_ERRMSG, key_select_to_file,
key_file_fileparser, key_file_frm, key_file_global_ddl_log, key_file_load,
key_file_loadfile, key_file_log_event_data, key_file_log_event_info,
- key_file_master_info, key_file_misc, key_file_MYSQL_LOG, key_file_partition,
+ key_file_master_info, key_file_misc, key_file_partition,
key_file_pid, key_file_relay_log_info, key_file_send_file, key_file_tclog,
key_file_trg, key_file_trn, key_file_init;
+extern PSI_file_key key_file_query_log, key_file_slow_log;
void init_server_psi_keys();
#endif /* HAVE_PSI_INTERFACE */
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2010-11-16 09:38:43 +0000
+++ b/sql/rpl_slave.cc 2010-11-16 12:38:17 +0000
@@ -2795,7 +2795,7 @@ static int exec_relay_log_event(THD* thd
if (slave_trans_retries)
{
- int temp_err;
+ int UNINIT_VAR(temp_err);
if (exec_res && (temp_err= has_temporary_error(thd)))
{
const char *errmsg;
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2010-10-25 12:13:13 +0000
+++ b/sql/sql_class.cc 2010-11-16 00:21:26 +0000
@@ -1846,8 +1846,9 @@ void select_to_file::send_error(uint err
bool select_to_file::send_eof()
{
int error= test(end_io_cache(&cache));
- if (mysql_file_close(file, MYF(MY_WME)))
- error= 1;
+ if (mysql_file_close(file, MYF(MY_WME)) || thd->is_error())
+ error= true;
+
if (!error)
{
::my_ok(thd,row_count);
@@ -2888,6 +2889,13 @@ bool select_dumpvar::send_eof()
if (! row_count)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
+ /*
+ Don't send EOF if we're in error condition (which implies we've already
+ sent or are sending an error)
+ */
+ if (thd->is_error())
+ return true;
+
::my_ok(thd,row_count);
return 0;
}
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2010-11-04 15:40:18 +0000
+++ b/sql/sql_insert.cc 2010-11-16 00:21:26 +0000
@@ -3540,6 +3540,9 @@ bool select_insert::send_eof()
error= (thd->locked_tables_mode <= LTM_LOCK_TABLES ?
table->file->ha_end_bulk_insert() : 0);
+ if (!error && thd->is_error())
+ error= thd->stmt_da->sql_errno();
+
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
@@ -4083,7 +4086,7 @@ bool select_create::send_eof()
{
bool tmp=select_insert::send_eof();
if (tmp)
- abort();
+ abort_result_set();
else
{
/*
@@ -4115,7 +4118,7 @@ void select_create::abort_result_set()
DBUG_ENTER("select_create::abort_result_set");
/*
- In select_insert::abort() we roll back the statement, including
+ In select_insert::abort_result_set() we roll back the statement, including
truncating the transaction cache of the binary log. To do this, we
pretend that the statement is transactional, even though it might
be the case that it was not.
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2010-11-08 14:35:45 +0000
+++ b/sql/sql_partition.cc 2010-11-16 10:05:56 +0000
@@ -7622,8 +7622,8 @@ int get_part_iter_for_interval_via_mappi
PARTITION_ITERATOR *part_iter)
{
Field *field= part_info->part_field_array[0];
- uint32 max_endpoint_val;
- get_endpoint_func get_endpoint;
+ uint32 UNINIT_VAR(max_endpoint_val);
+ get_endpoint_func UNINIT_VAR(get_endpoint);
bool can_match_multiple_values; /* is not '=' */
uint field_len= field->pack_length_in_rec();
DBUG_ENTER("get_part_iter_for_interval_via_mapping");
=== modified file 'sql/sql_partition_admin.cc'
--- a/sql/sql_partition_admin.cc 2010-10-29 10:34:33 +0000
+++ b/sql/sql_partition_admin.cc 2010-11-16 00:55:42 +0000
@@ -191,6 +191,9 @@ static bool compare_table_with_partition
update_create_info_from_table(&table_create_info, table);
/* get the current auto_increment value */
table->file->update_create_info(&table_create_info);
+ /* mark all columns used, since they are used when preparing the new table */
+ part_table->use_all_columns();
+ table->use_all_columns();
if (mysql_prepare_alter_table(thd, part_table, &part_create_info,
&part_alter_info))
{
@@ -448,13 +451,13 @@ err_no_action_written:
@brief Swap places between a partition and a table.
@details Verify that the tables are compatible (same engine, definition etc),
- if not IGNORE is given, verify that all rows in the table will fit in the
- partition, if all OK, rename table to tmp name, rename partition to table
+ verify that all rows in the table will fit in the partition,
+ if all OK, rename table to tmp name, rename partition to table
and finally rename tmp name to partition.
1) Take upgradable mdl, open tables and then lock them (inited in parse)
2) Verify that metadata matches
- 3) If not ignore, verify data
+ 3) verify data
4) Upgrade to exclusive mdl for both tables
5) Rename table <-> partition
6) Rely on close_thread_tables to release mdl and table locks
@@ -463,7 +466,6 @@ err_no_action_written:
@param table_list Table where the partition exists as first table,
Table to swap with the partition as second table
@param alter_info Contains partition name to swap
- @param ignore flag to skip verification of partition values
@note This is a DDL operation so triggers will not be used.
*/
@@ -484,7 +486,7 @@ bool Sql_cmd_alter_table_exchange_partit
Alter_table_prelocking_strategy alter_prelocking_strategy(alter_info);
MDL_ticket *swap_table_mdl_ticket= NULL;
MDL_ticket *part_table_mdl_ticket= NULL;
- bool error= TRUE, ignore= thd->lex->ignore;
+ bool error= TRUE;
DBUG_ENTER("mysql_exchange_partition");
DBUG_ASSERT(alter_info->flags & ALTER_EXCHANGE_PARTITION);
@@ -574,11 +576,10 @@ bool Sql_cmd_alter_table_exchange_partit
/* Table and partition has same structure/options, OK to exchange */
- if (!ignore)
- {
- if (verify_data_with_partition(swap_table, part_table, swap_part_id))
- DBUG_RETURN(TRUE);
- }
+ thd_proc_info(thd, "verifying data with partition");
+
+ if (verify_data_with_partition(swap_table, part_table, swap_part_id))
+ DBUG_RETURN(TRUE);
/*
Get exclusive mdl lock on both tables, alway the non partitioned table
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2010-11-14 18:09:32 +0000
+++ b/sql/sql_prepare.cc 2010-11-16 00:21:26 +0000
@@ -2899,8 +2899,15 @@ bool Select_fetch_protocol_binary::send_
bool Select_fetch_protocol_binary::send_eof()
{
+ /*
+ Don't send EOF if we're in error condition (which implies we've already
+ sent or are sending an error)
+ */
+ if (thd->is_error())
+ return true;
+
::my_eof(thd);
- return FALSE;
+ return false;
}
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2010-10-21 12:18:25 +0000
+++ b/sql/sql_update.cc 2010-11-16 00:21:26 +0000
@@ -2065,7 +2065,9 @@ bool multi_update::send_eof()
Does updates for the last n - 1 tables, returns 0 if ok;
error takes into account killed status gained in do_updates()
*/
- int local_error = (table_count) ? do_updates() : 0;
+ int local_error= thd->is_error();
+ if (!local_error)
+ local_error = (table_count) ? do_updates() : 0;
/*
if local_error is not set ON until after do_updates() then
later carried out killing should not affect binlogging.
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2010-11-05 12:03:40 +0000
+++ b/sql/sql_yacc.yy 2010-11-16 00:39:46 +0000
@@ -6595,7 +6595,6 @@ alter_commands:
if (lex->m_sql_cmd == NULL)
MYSQL_YYABORT;
}
- opt_ignore
;
remove_partitioning:
=== modified file 'storage/myisam/ft_nlq_search.c'
--- a/storage/myisam/ft_nlq_search.c 2010-07-23 20:16:29 +0000
+++ b/storage/myisam/ft_nlq_search.c 2010-11-16 09:45:07 +0000
@@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int subkeys, r;
+ int UNINIT_VAR(subkeys), r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
TREE_ELEMENT *selem;
=== modified file 'storage/myisammrg/myrg_open.c'
--- a/storage/myisammrg/myrg_open.c 2010-07-20 19:30:10 +0000
+++ b/storage/myisammrg/myrg_open.c 2010-11-16 09:45:07 +0000
@@ -220,7 +220,7 @@ MYRG_INFO *myrg_parent_open(const char *
int (*callback)(void*, const char*),
void *callback_param)
{
- MYRG_INFO *m_info;
+ MYRG_INFO *UNINIT_VAR(m_info);
int rc;
int errpos;
int save_errno;
=== modified file 'storage/perfschema/pfs_global.h'
--- a/storage/perfschema/pfs_global.h 2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/pfs_global.h 2010-11-16 06:27:18 +0000
@@ -79,5 +79,21 @@ inline uint randomized_index(const void
void pfs_print_error(const char *format, ...);
+/**
+ Given an array defined as T ARRAY[MAX],
+ check that an UNSAFE pointer actually points to an element
+ within the array.
+*/
+#define SANITIZE_ARRAY_BODY(T, ARRAY, MAX, UNSAFE) \
+ intptr offset; \
+ if ((&ARRAY[0] <= UNSAFE) && \
+ (UNSAFE < &ARRAY[MAX])) \
+ { \
+ offset= ((intptr) UNSAFE - (intptr) ARRAY) % sizeof(T); \
+ if (offset == 0) \
+ return UNSAFE; \
+ } \
+ return NULL
+
#endif
=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc 2010-07-30 09:02:32 +0000
+++ b/storage/perfschema/pfs_instr.cc 2010-11-16 06:27:18 +0000
@@ -775,9 +775,26 @@ PFS_thread* create_thread(PFS_thread_cla
*/
PFS_thread *sanitize_thread(PFS_thread *unsafe)
{
- if ((&thread_array[0] <= unsafe) &&
- (unsafe < &thread_array[thread_max]))
- return unsafe;
+ SANITIZE_ARRAY_BODY(PFS_thread, thread_array, thread_max, unsafe);
+}
+
+const char *sanitize_file_name(const char *unsafe)
+{
+ intptr ptr= (intptr) unsafe;
+ intptr first= (intptr) &file_array[0];
+ intptr last= (intptr) &file_array[file_max];
+
+ /* Check if unsafe points inside file_array[] */
+ if (likely((first <= ptr) && (ptr < last)))
+ {
+ /* Check if unsafe points to PFS_file::m_filename */
+ intptr offset= (ptr - first) % sizeof(PFS_file);
+ intptr valid_offset= my_offsetof(PFS_file, m_filename[0]);
+ if (likely(offset == valid_offset))
+ {
+ return unsafe;
+ }
+ }
return NULL;
}
=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h 2010-07-30 09:02:32 +0000
+++ b/storage/perfschema/pfs_instr.h 2010-11-16 06:27:18 +0000
@@ -260,6 +260,7 @@ struct PFS_thread
};
PFS_thread *sanitize_thread(PFS_thread *unsafe);
+const char *sanitize_file_name(const char *unsafe);
PFS_single_stat_chain*
find_per_thread_mutex_class_wait_stat(PFS_thread *thread,
=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc 2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/pfs_instr_class.cc 2010-11-16 06:27:18 +0000
@@ -602,15 +602,9 @@ PFS_mutex_class *find_mutex_class(PFS_sy
FIND_CLASS_BODY(key, mutex_class_allocated_count, mutex_class_array);
}
-#define SANITIZE_ARRAY_BODY(ARRAY, MAX, UNSAFE) \
- if ((&ARRAY[0] <= UNSAFE) && \
- (UNSAFE < &ARRAY[MAX])) \
- return UNSAFE; \
- return NULL
-
PFS_mutex_class *sanitize_mutex_class(PFS_mutex_class *unsafe)
{
- SANITIZE_ARRAY_BODY(mutex_class_array, mutex_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_mutex_class, mutex_class_array, mutex_class_max, unsafe);
}
/**
@@ -625,7 +619,7 @@ PFS_rwlock_class *find_rwlock_class(PFS_
PFS_rwlock_class *sanitize_rwlock_class(PFS_rwlock_class *unsafe)
{
- SANITIZE_ARRAY_BODY(rwlock_class_array, rwlock_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_rwlock_class, rwlock_class_array, rwlock_class_max, unsafe);
}
/**
@@ -640,7 +634,7 @@ PFS_cond_class *find_cond_class(PFS_sync
PFS_cond_class *sanitize_cond_class(PFS_cond_class *unsafe)
{
- SANITIZE_ARRAY_BODY(cond_class_array, cond_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_cond_class, cond_class_array, cond_class_max, unsafe);
}
/**
@@ -695,7 +689,7 @@ PFS_thread_class *find_thread_class(PFS_
PFS_thread_class *sanitize_thread_class(PFS_thread_class *unsafe)
{
- SANITIZE_ARRAY_BODY(thread_class_array, thread_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_thread_class, thread_class_array, thread_class_max, unsafe);
}
/**
@@ -746,7 +740,7 @@ PFS_file_class *find_file_class(PFS_file
PFS_file_class *sanitize_file_class(PFS_file_class *unsafe)
{
- SANITIZE_ARRAY_BODY(file_class_array, file_class_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_file_class, file_class_array, file_class_max, unsafe);
}
/**
@@ -936,7 +930,59 @@ void drop_table_share(PFS_thread *thread
*/
PFS_table_share *sanitize_table_share(PFS_table_share *unsafe)
{
- SANITIZE_ARRAY_BODY(table_share_array, table_share_max, unsafe);
+ SANITIZE_ARRAY_BODY(PFS_table_share, table_share_array, table_share_max, unsafe);
+}
+
+const char *sanitize_table_schema_name(const char *unsafe)
+{
+ intptr ptr= (intptr) unsafe;
+ intptr first= (intptr) &table_share_array[0];
+ intptr last= (intptr) &table_share_array[table_share_max];
+
+ PFS_table_share dummy;
+
+ /* Check if unsafe points inside table_share_array[] */
+ if (likely((first <= ptr) && (ptr < last)))
+ {
+ intptr offset= (ptr - first) % sizeof(PFS_table_share);
+ intptr from= my_offsetof(PFS_table_share, m_key.m_hash_key);
+ intptr len= sizeof(dummy.m_key.m_hash_key);
+ /* Check if unsafe points inside PFS_table_share::m_key::m_hash_key */
+ if (likely((from <= offset) && (offset < from + len)))
+ {
+ PFS_table_share *base= (PFS_table_share*) (ptr - offset);
+ /* Check if unsafe really is the schema name */
+ if (likely(base->m_schema_name == unsafe))
+ return unsafe;
+ }
+ }
+ return NULL;
+}
+
+const char *sanitize_table_object_name(const char *unsafe)
+{
+ intptr ptr= (intptr) unsafe;
+ intptr first= (intptr) &table_share_array[0];
+ intptr last= (intptr) &table_share_array[table_share_max];
+
+ PFS_table_share dummy;
+
+ /* Check if unsafe points inside table_share_array[] */
+ if (likely((first <= ptr) && (ptr < last)))
+ {
+ intptr offset= (ptr - first) % sizeof(PFS_table_share);
+ intptr from= my_offsetof(PFS_table_share, m_key.m_hash_key);
+ intptr len= sizeof(dummy.m_key.m_hash_key);
+ /* Check if unsafe points inside PFS_table_share::m_key::m_hash_key */
+ if (likely((from <= offset) && (offset < from + len)))
+ {
+ PFS_table_share *base= (PFS_table_share*) (ptr - offset);
+ /* Check if unsafe really is the table name */
+ if (likely(base->m_table_name == unsafe))
+ return unsafe;
+ }
+ }
+ return NULL;
}
static void reset_mutex_class_waits(void)
=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h 2010-07-23 17:08:41 +0000
+++ b/storage/perfschema/pfs_instr_class.h 2010-11-16 06:27:18 +0000
@@ -229,6 +229,8 @@ PFS_thread_class *find_thread_class(PSI_
PFS_thread_class *sanitize_thread_class(PFS_thread_class *unsafe);
PFS_file_class *find_file_class(PSI_file_key key);
PFS_file_class *sanitize_file_class(PFS_file_class *unsafe);
+const char *sanitize_table_schema_name(const char *unsafe);
+const char *sanitize_table_object_name(const char *unsafe);
PFS_table_share *find_or_create_table_share(PFS_thread *thread,
bool temporary,
=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc 2010-11-09 08:16:50 +0000
+++ b/storage/perfschema/table_events_waits.cc 2010-11-16 06:27:18 +0000
@@ -197,6 +197,9 @@ void table_events_waits_common::make_row
PFS_instr_class *safe_class;
const char *base;
const char *safe_source_file;
+ const char *safe_table_schema_name;
+ const char *safe_table_object_name;
+ const char *safe_file_name;
m_row_exists= false;
safe_thread= sanitize_thread(pfs_thread);
@@ -264,15 +267,19 @@ void table_events_waits_common::make_row
m_row.m_object_type_length= 15;
}
m_row.m_object_schema_length= wait->m_schema_name_length;
+ safe_table_schema_name= sanitize_table_schema_name(wait->m_schema_name);
if (unlikely((m_row.m_object_schema_length == 0) ||
- (m_row.m_object_schema_length > sizeof(m_row.m_object_schema))))
+ (m_row.m_object_schema_length > sizeof(m_row.m_object_schema)) ||
+ (safe_table_schema_name == NULL)))
return;
- memcpy(m_row.m_object_schema, wait->m_schema_name, m_row.m_object_schema_length);
+ memcpy(m_row.m_object_schema, safe_table_schema_name, m_row.m_object_schema_length);
m_row.m_object_name_length= wait->m_object_name_length;
+ safe_table_object_name= sanitize_table_object_name(wait->m_object_name);
if (unlikely((m_row.m_object_name_length == 0) ||
- (m_row.m_object_name_length > sizeof(m_row.m_object_name))))
+ (m_row.m_object_name_length > sizeof(m_row.m_object_name)) ||
+ (safe_table_object_name == NULL)))
return;
- memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length);
+ memcpy(m_row.m_object_name, safe_table_object_name, m_row.m_object_name_length);
safe_class= &global_table_class;
break;
case WAIT_CLASS_FILE:
@@ -280,10 +287,12 @@ void table_events_waits_common::make_row
m_row.m_object_type_length= 4;
m_row.m_object_schema_length= 0;
m_row.m_object_name_length= wait->m_object_name_length;
+ safe_file_name= sanitize_file_name(wait->m_object_name);
if (unlikely((m_row.m_object_name_length == 0) ||
- (m_row.m_object_name_length > sizeof(m_row.m_object_name))))
+ (m_row.m_object_name_length > sizeof(m_row.m_object_name)) ||
+ (safe_file_name == NULL)))
return;
- memcpy(m_row.m_object_name, wait->m_object_name, m_row.m_object_name_length);
+ memcpy(m_row.m_object_name, safe_file_name, m_row.m_object_name_length);
safe_class= sanitize_file_class((PFS_file_class*) wait->m_class);
break;
case NO_WAIT_CLASS:
=== modified file 'tests/mysql_client_test.c'
--- a/tests/mysql_client_test.c 2010-11-14 18:09:32 +0000
+++ b/tests/mysql_client_test.c 2010-11-16 10:05:56 +0000
@@ -1201,7 +1201,7 @@ my_bool fetch_n(const char **query_list,
/* Separate thread query to test some cases */
-static my_bool thread_query(char *query)
+static my_bool thread_query(const char *query)
{
MYSQL *l_mysql;
my_bool error;
@@ -1223,7 +1223,7 @@ static my_bool thread_query(char *query)
goto end;
}
l_mysql->reconnect= 1;
- if (mysql_query(l_mysql, (char *)query))
+ if (mysql_query(l_mysql, query))
{
fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));
error= 1;
@@ -6449,7 +6449,7 @@ static void test_prepare_alter()
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
- if (thread_query((char *)"ALTER TABLE test_prep_alter change id id_new varchar(20)"))
+ if (thread_query("ALTER TABLE test_prep_alter change id id_new varchar(20)"))
exit(1);
is_null= 1;
Attachment: [text/bzr-bundle] bzr/mats.kindahl@oracle.com-20101116123817-2vml33d984cifl7e.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (mats.kindahl:3342) WL#5465 | Mats Kindahl | 16 Nov |