Commit c1d6a2d7 authored by Sergei Golubchik's avatar Sergei Golubchik

merge few bug fixes from 5.6

parent 1b825129
This diff is collapsed.
...@@ -2538,6 +2538,21 @@ t2 CREATE TABLE `t2` ( ...@@ -2538,6 +2538,21 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH LONGTEXT, UNION, USER VARIABLE
#
CREATE TABLE t1(f1 LONGTEXT CHARACTER SET utf8mb4);
INSERT INTO t1 VALUES ('a');
SELECT @a:= CAST(f1 AS SIGNED) FROM t1
UNION ALL
SELECT CAST(f1 AS SIGNED) FROM t1;
@a:= CAST(f1 AS SIGNED)
0
0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'a'
Warning 1292 Truncated incorrect INTEGER value: 'a'
DROP TABLE t1;
#
# End of 5.5 tests # End of 5.5 tests
# #
# #
......
...@@ -65,3 +65,26 @@ select @@event_scheduler; ...@@ -65,3 +65,26 @@ select @@event_scheduler;
ON ON
drop table execution_log; drop table execution_log;
drop database events_test; drop database events_test;
#
# Test for bug#11748899 -- EVENT SET TO DISABLED AND ON COMPLETION
# NOT PRESERVE IS DELETED AT SERVER
#
SELECT @@event_scheduler;
@@event_scheduler
ON
USE test;
DROP EVENT IF EXISTS e1;
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO SELECT 1;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
"Now we restart the server"
USE test;
SELECT @@event_scheduler;
@@event_scheduler
ON
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT e1;
# end test for bug#11748899
...@@ -67,6 +67,19 @@ AND A.b = '06' ...@@ -67,6 +67,19 @@ AND A.b = '06'
AND A.c = 343; AND A.c = 343;
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#59503: explain extended crash in get_mm_leaf
#
CREATE TABLE t1 (a VARCHAR(51) CHARACTER SET latin1)
ENGINE=MyISAM
PARTITION BY KEY (a) PARTITIONS 1;
INSERT INTO t1 VALUES ('a'),('b'),('c');
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 1)
DROP TABLE t1;
#
# Bug#57778: failed primary key add to partitioned innodb table # Bug#57778: failed primary key add to partitioned innodb table
# inconsistent and crashes # inconsistent and crashes
# #
...@@ -303,6 +316,32 @@ INSERT INTO t1 VALUES (NULL); ...@@ -303,6 +316,32 @@ INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1 WHERE pk < 0 ORDER BY pk; SELECT * FROM t1 WHERE pk < 0 ORDER BY pk;
pk pk
DROP TABLE t1; DROP TABLE t1;
SET sql_mode=no_engine_substitution;
CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine;
ERROR 42000: Unknown storage engine 'NonExistentEngine'
CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine
PARTITION BY HASH (a);
ERROR 42000: Unknown storage engine 'NonExistentEngine'
CREATE TABLE t1 (a INT)
ENGINE=Memory;
ALTER TABLE t1 ENGINE=NonExistentEngine;
ERROR 42000: Unknown storage engine 'NonExistentEngine'
ALTER TABLE t1
PARTITION BY HASH (a)
(PARTITION p0 ENGINE=Memory,
PARTITION p1 ENGINE=NonExistentEngine);
ERROR 42000: Unknown storage engine 'NonExistentEngine'
ALTER TABLE t1 ENGINE=NonExistentEngine;
ERROR 42000: Unknown storage engine 'NonExistentEngine'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT) CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine; ENGINE=NonExistentEngine;
Warnings: Warnings:
...@@ -339,6 +378,7 @@ t1 CREATE TABLE `t1` ( ...@@ -339,6 +378,7 @@ t1 CREATE TABLE `t1` (
(PARTITION p0 ENGINE = MEMORY, (PARTITION p0 ENGINE = MEMORY,
PARTITION p1 ENGINE = MEMORY) */ PARTITION p1 ENGINE = MEMORY) */
DROP TABLE t1; DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) CREATE TABLE t1 (a INT NOT NULL, KEY(a))
PARTITION BY RANGE(a) PARTITION BY RANGE(a)
(PARTITION p1 VALUES LESS THAN (200), PARTITION pmax VALUES LESS THAN MAXVALUE); (PARTITION p1 VALUES LESS THAN (200), PARTITION pmax VALUES LESS THAN MAXVALUE);
...@@ -1056,13 +1096,13 @@ select * from t1 where f1 = 10; ...@@ -1056,13 +1096,13 @@ select * from t1 where f1 = 10;
f1 f2 f1 f2
10 1 10 1
drop table t1; drop table t1;
set session storage_engine= 'memory'; set session default_storage_engine= 'memory';
create table t1 (f_int1 int(11) default null) engine = memory create table t1 (f_int1 int(11) default null) engine = memory
partition by range (f_int1) subpartition by hash (f_int1) partition by range (f_int1) subpartition by hash (f_int1)
(partition part1 values less than (1000) (partition part1 values less than (1000)
(subpartition subpart11 engine = memory)); (subpartition subpart11 engine = memory));
drop table t1; drop table t1;
set session storage_engine='myisam'; set session default_storage_engine='myisam';
create table t1 (f_int1 integer, f_int2 integer, primary key (f_int1)) create table t1 (f_int1 integer, f_int2 integer, primary key (f_int1))
partition by hash(f_int1) partitions 2; partition by hash(f_int1) partitions 2;
insert into t1 values (1,1),(2,2); insert into t1 values (1,1),(2,2);
...@@ -1885,8 +1925,7 @@ WHERE t1.id IN ( ...@@ -1885,8 +1925,7 @@ WHERE t1.id IN (
SELECT distinct id SELECT distinct id
FROM t4 FROM t4
WHERE taken BETWEEN @f_date AND date_add(@t_date, INTERVAL 1 DAY)) WHERE taken BETWEEN @f_date AND date_add(@t_date, INTERVAL 1 DAY))
ORDER BY t1.id ORDER BY t1.id;
;
MyISAM_part MyISAM_part
16421 16421
19092 19092
......
...@@ -5,7 +5,9 @@ SET DEBUG_SYNC= 'RESET'; ...@@ -5,7 +5,9 @@ SET DEBUG_SYNC= 'RESET';
# Test when remove partitioning is done while drop table is waiting # Test when remove partitioning is done while drop table is waiting
# for the table. # for the table.
# After MDL was introduced, there is no longer any race, so test is done # After MDL was introduced, there is no longer any race, so test is done
# by adding a small sleep to verify that the delete waits. # by adding a small sleep to verify that the delete waits. This happens
# only until ALTER tries to upgrade its MDL lock, which ends up in MDL
# deadlock which is correctly reported.
# Con 1 # Con 1
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1 CREATE TABLE t1
...@@ -64,3 +66,27 @@ SET DEBUG_SYNC= 'RESET'; ...@@ -64,3 +66,27 @@ SET DEBUG_SYNC= 'RESET';
# Con default # Con default
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
End of 5.1 tests End of 5.1 tests
#
# Coverage test for non pruned ha_partition::store_lock()
#
CREATE TABLE t1 (a int) ENGINE = InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY)
ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 3;
HANDLER t1 OPEN;
# Con1
LOCK TABLES t1 WRITE, t2 READ;
# Default
SET DEBUG_SYNC="wait_for_lock SIGNAL locking";
INSERT INTO t2 VALUES (1), (2), (3);
# Con1
SET DEBUG_SYNC="now WAIT_FOR locking";
ALTER TABLE t1 ADD COLUMN b int;
# Default
ERROR HY000: Wait on a lock was aborted due to a pending exclusive lock
SELECT 1;
1
1
# Con1
UNLOCK TABLES;
# Default
DROP TABLE t1, t2;
...@@ -31,6 +31,17 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -31,6 +31,17 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index 1 SIMPLE t1 range PRIMARY,b b 67 NULL 18 Using where; Using index
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
# and PARTITIONING
#
CREATE TABLE t1 (a INT, KEY(a))
ENGINE = InnoDB
PARTITION BY KEY (a) PARTITIONS 1;
SELECT 1 FROM t1 WHERE a > (SELECT LAST_INSERT_ID() FROM t1 LIMIT 0)
ORDER BY a;
1
DROP TABLE t1;
#
# Bug#56287: crash when using Partition datetime in sub in query # Bug#56287: crash when using Partition datetime in sub in query
# #
CREATE TABLE t1 CREATE TABLE t1
...@@ -60,7 +71,7 @@ DROP TABLE t1; ...@@ -60,7 +71,7 @@ DROP TABLE t1;
# Bug#54747: Deadlock between REORGANIZE PARTITION and # Bug#54747: Deadlock between REORGANIZE PARTITION and
# SELECT is not detected # SELECT is not detected
# #
SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency; SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency;
SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay; SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay;
SET GLOBAL innodb_thread_concurrency = 1; SET GLOBAL innodb_thread_concurrency = 1;
CREATE TABLE t1 CREATE TABLE t1
......
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
# #
# BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE
#
CREATE TABLE t1 (
i INT
)
ENGINE=MyISAM
PARTITION BY RANGE (i)
(PARTITION p3 VALUES LESS THAN (3),
PARTITION p5 VALUES LESS THAN (5),
PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6);
CHECKSUM TABLE t1;
Table Checksum
test.t1 2653438147
ALTER TABLE t1 CHECKSUM = 1;
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2653438147
# Before patch this returned 0!
CHECKSUM TABLE t1;
Table Checksum
test.t1 2653438147
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1
/*!50100 PARTITION BY RANGE (i)
(PARTITION p3 VALUES LESS THAN (3) ENGINE = MyISAM,
PARTITION p5 VALUES LESS THAN (5) ENGINE = MyISAM,
PARTITION pMax VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
DROP TABLE t1;
# Same test without partitioning
CREATE TABLE t1 (
i INT
) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6);
CHECKSUM TABLE t1;
Table Checksum
test.t1 2653438147
ALTER TABLE t1 CHECKSUM = 1;
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2653438147
CHECKSUM TABLE t1;
Table Checksum
test.t1 2653438147
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1
DROP TABLE t1;
#
# Bug#31931: Mix of handlers error message # Bug#31931: Mix of handlers error message
# #
CREATE TABLE t1 (a INT) CREATE TABLE t1 (a INT)
...@@ -171,3 +230,18 @@ PARTITION p1 VALUES LESS THAN (100) MAX_ROWS=100, ...@@ -171,3 +230,18 @@ PARTITION p1 VALUES LESS THAN (100) MAX_ROWS=100,
PARTITION pMax VALUES LESS THAN MAXVALUE); PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row"); INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1; DROP TABLE t1;
#
# bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
# TABLE CORRUPTS MYISAM
DROP TABLE if exists `t1`;
CREATE TABLE `t1`(`a` INT)ENGINE=myisam;
ALTER TABLE `t1` ADD COLUMN `b` INT;
CREATE UNIQUE INDEX `i1` ON `t1`(`b`);
CREATE UNIQUE INDEX `i2` ON `t1`(`a`);
ALTER TABLE `t1` ADD PRIMARY KEY (`a`);
ALTER TABLE `t1` REMOVE PARTITIONING;
ERROR HY000: Partition management on a not partitioned table is not possible
CHECK TABLE `t1` EXTENDED;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
This diff is collapsed.
...@@ -1811,6 +1811,17 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; ...@@ -1811,6 +1811,17 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # Bug#13581962 HIGH MEMORY USAGE ATTEMPT, THEN CRASH WITH LONGTEXT, UNION, USER VARIABLE
--echo #
CREATE TABLE t1(f1 LONGTEXT CHARACTER SET utf8mb4);
INSERT INTO t1 VALUES ('a');
SELECT @a:= CAST(f1 AS SIGNED) FROM t1
UNION ALL
SELECT CAST(f1 AS SIGNED) FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
......
...@@ -107,3 +107,25 @@ let $wait_condition= ...@@ -107,3 +107,25 @@ let $wait_condition=
where db='events_test' and command = 'Connect' and user=current_user(); where db='events_test' and command = 'Connect' and user=current_user();
--source include/wait_condition.inc --source include/wait_condition.inc
--echo #
--echo # Test for bug#11748899 -- EVENT SET TO DISABLED AND ON COMPLETION
--echo # NOT PRESERVE IS DELETED AT SERVER
--echo #
SELECT @@event_scheduler;
USE test;
--disable_warnings
DROP EVENT IF EXISTS e1;
--enable_warnings
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DISABLE DO SELECT 1;
--replace_column 6 # 9 # 10 #
SHOW EVENTS;
--echo "Now we restart the server"
--source include/restart_mysqld.inc
USE test;
SELECT @@event_scheduler;
--replace_column 6 # 9 # 10 #
SHOW EVENTS;
DROP EVENT e1;
--echo # end test for bug#11748899
...@@ -88,6 +88,16 @@ AND A.c = 343; ...@@ -88,6 +88,16 @@ AND A.c = 343;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#59503: explain extended crash in get_mm_leaf
--echo #
CREATE TABLE t1 (a VARCHAR(51) CHARACTER SET latin1)
ENGINE=MyISAM
PARTITION BY KEY (a) PARTITIONS 1;
INSERT INTO t1 VALUES ('a'),('b'),('c');
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
DROP TABLE t1;
--echo # --echo #
--echo # Bug#57778: failed primary key add to partitioned innodb table --echo # Bug#57778: failed primary key add to partitioned innodb table
--echo # inconsistent and crashes --echo # inconsistent and crashes
...@@ -303,6 +313,31 @@ DROP TABLE t1; ...@@ -303,6 +313,31 @@ DROP TABLE t1;
# #
# Bug#35765: ALTER TABLE produces wrong error when non-existent storage engine # Bug#35765: ALTER TABLE produces wrong error when non-existent storage engine
# used # used
SET sql_mode=no_engine_substitution;
--error ER_UNKNOWN_STORAGE_ENGINE
CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine;
--error ER_UNKNOWN_STORAGE_ENGINE
CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine
PARTITION BY HASH (a);
CREATE TABLE t1 (a INT)
ENGINE=Memory;
--error ER_UNKNOWN_STORAGE_ENGINE
ALTER TABLE t1 ENGINE=NonExistentEngine;
# OK to only specify one partitions engine, since it is already assigned at
# table level (after create, it is specified on all levels and all parts).
--error ER_UNKNOWN_STORAGE_ENGINE
ALTER TABLE t1
PARTITION BY HASH (a)
(PARTITION p0 ENGINE=Memory,
PARTITION p1 ENGINE=NonExistentEngine);
--error ER_UNKNOWN_STORAGE_ENGINE
ALTER TABLE t1 ENGINE=NonExistentEngine;
SHOW CREATE TABLE t1;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT) CREATE TABLE t1 (a INT)
ENGINE=NonExistentEngine; ENGINE=NonExistentEngine;
DROP TABLE t1; DROP TABLE t1;
...@@ -322,6 +357,7 @@ PARTITION BY HASH (a) ...@@ -322,6 +357,7 @@ PARTITION BY HASH (a)
ALTER TABLE t1 ENGINE=NonExistentEngine; ALTER TABLE t1 ENGINE=NonExistentEngine;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
SET sql_mode=DEFAULT;
# #
# Bug#40494: Crash MYSQL server crashes on range access with partitioning # Bug#40494: Crash MYSQL server crashes on range access with partitioning
...@@ -990,13 +1026,13 @@ drop table t1; ...@@ -990,13 +1026,13 @@ drop table t1;
# #
# Bug #16775: Wrong engine type stored for subpartition # Bug #16775: Wrong engine type stored for subpartition
# #
set session storage_engine= 'memory'; set session default_storage_engine= 'memory';
create table t1 (f_int1 int(11) default null) engine = memory create table t1 (f_int1 int(11) default null) engine = memory
partition by range (f_int1) subpartition by hash (f_int1) partition by range (f_int1) subpartition by hash (f_int1)
(partition part1 values less than (1000) (partition part1 values less than (1000)
(subpartition subpart11 engine = memory)); (subpartition subpart11 engine = memory));
drop table t1; drop table t1;
set session storage_engine='myisam'; set session default_storage_engine='myisam';
# #
# Bug #16782: Crash using REPLACE on table with primary key # Bug #16782: Crash using REPLACE on table with primary key
...@@ -1840,8 +1876,7 @@ WHERE t1.id IN ( ...@@ -1840,8 +1876,7 @@ WHERE t1.id IN (
SELECT distinct id SELECT distinct id
FROM t4 FROM t4
WHERE taken BETWEEN @f_date AND date_add(@t_date, INTERVAL 1 DAY)) WHERE taken BETWEEN @f_date AND date_add(@t_date, INTERVAL 1 DAY))
ORDER BY t1.id ORDER BY t1.id;
;
drop table t1, t2, t4; drop table t1, t2, t4;
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
# #
--source include/have_partition.inc --source include/have_partition.inc
--source include/have_debug_sync.inc --source include/have_debug_sync.inc
--source include/have_debug.inc
--source include/have_innodb.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
...@@ -16,7 +18,9 @@ SET DEBUG_SYNC= 'RESET'; ...@@ -16,7 +18,9 @@ SET DEBUG_SYNC= 'RESET';
--echo # Test when remove partitioning is done while drop table is waiting --echo # Test when remove partitioning is done while drop table is waiting
--echo # for the table. --echo # for the table.
--echo # After MDL was introduced, there is no longer any race, so test is done --echo # After MDL was introduced, there is no longer any race, so test is done
--echo # by adding a small sleep to verify that the delete waits. --echo # by adding a small sleep to verify that the delete waits. This happens
--echo # only until ALTER tries to upgrade its MDL lock, which ends up in MDL
--echo # deadlock which is correctly reported.
connect(con1, localhost, root,,); connect(con1, localhost, root,,);
--echo # Con 1 --echo # Con 1
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
...@@ -83,8 +87,54 @@ connection con1; ...@@ -83,8 +87,54 @@ connection con1;
--reap --reap
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
disconnect con1; disconnect con1;
--source include/wait_until_disconnected.inc
connection default; connection default;
--echo # Con default --echo # Con default
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
--echo End of 5.1 tests --echo End of 5.1 tests
--echo #
--echo # Coverage test for non pruned ha_partition::store_lock()
--echo #
CREATE TABLE t1 (a int) ENGINE = InnoDB;
CREATE TABLE t2 (a int PRIMARY KEY)
ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 3;
HANDLER t1 OPEN;
--echo # Con1
connect (con1, localhost, root,,);
LOCK TABLES t1 WRITE, t2 READ;
--echo # Default
connection default;
SET DEBUG_SYNC="wait_for_lock SIGNAL locking";
send INSERT INTO t2 VALUES (1), (2), (3);
--echo # Con1
connection con1;
SET DEBUG_SYNC="now WAIT_FOR locking";
send ALTER TABLE t1 ADD COLUMN b int;
--echo # Default
connection default;
--error ER_LOCK_ABORTED
--reap
SELECT 1;
--echo # Con1
connection con1;
--reap
UNLOCK TABLES;
--disconnect con1
--echo # Default
connection default;
DROP TABLE t1, t2;
...@@ -40,6 +40,17 @@ ANALYZE TABLE t1; ...@@ -40,6 +40,17 @@ ANALYZE TABLE t1;
EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100; EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#13007154: Crash in keys_to_use_for_scanning with ORDER BY
--echo # and PARTITIONING
--echo #
CREATE TABLE t1 (a INT, KEY(a))
ENGINE = InnoDB
PARTITION BY KEY (a) PARTITIONS 1;
SELECT 1 FROM t1 WHERE a > (SELECT LAST_INSERT_ID() FROM t1 LIMIT 0)
ORDER BY a;
DROP TABLE t1;
--echo # --echo #
--echo # Bug#56287: crash when using Partition datetime in sub in query --echo # Bug#56287: crash when using Partition datetime in sub in query
--echo # --echo #
...@@ -71,7 +82,7 @@ DROP TABLE t1; ...@@ -71,7 +82,7 @@ DROP TABLE t1;
--echo # SELECT is not detected --echo # SELECT is not detected
--echo # --echo #
SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency; SET @old_innodb_thread_concurrency := @@innodb_thread_concurrency;
SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay; SET @old_innodb_thread_sleep_delay := @@innodb_thread_sleep_delay;
SET GLOBAL innodb_thread_concurrency = 1; SET GLOBAL innodb_thread_concurrency = 1;
......
-- source include/have_partition.inc --source include/have_partition.inc
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1, t2; DROP TABLE IF EXISTS t1, t2;
--enable_warnings --enable_warnings
...@@ -10,6 +9,38 @@ DROP TABLE IF EXISTS t1, t2; ...@@ -10,6 +9,38 @@ DROP TABLE IF EXISTS t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`; let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
--echo # BUG#11933226 - 60681: CHECKSUM TABLE RETURNS 0 FOR PARTITIONED TABLE
--echo #
CREATE TABLE t1 (
i INT
)
ENGINE=MyISAM
PARTITION BY RANGE (i)
(PARTITION p3 VALUES LESS THAN (3),
PARTITION p5 VALUES LESS THAN (5),
PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6);
CHECKSUM TABLE t1;
ALTER TABLE t1 CHECKSUM = 1;
CHECKSUM TABLE t1 EXTENDED;
--echo # Before patch this returned 0!
CHECKSUM TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo # Same test without partitioning
CREATE TABLE t1 (
i INT
) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6);
CHECKSUM TABLE t1;
ALTER TABLE t1 CHECKSUM = 1;
CHECKSUM TABLE t1 EXTENDED;
CHECKSUM TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# #
# Disabled by WL#946: binary format for timestamp column is not compatible. # Disabled by WL#946: binary format for timestamp column is not compatible.
...@@ -40,6 +71,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; ...@@ -40,6 +71,7 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
#INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); #INSERT INTO t1 VALUES ('2001-02-03 04:05:06');
#--sorted_result #--sorted_result
#SELECT * FROM t1; #SELECT * FROM t1;
#SELECT a, hex(weight_string(a)) FROM t1;
#ALTER TABLE t1 ADD PARTITION PARTITIONS 2; #ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR #--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR
#ALTER TABLE t1 #ALTER TABLE t1
...@@ -60,7 +92,6 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; ...@@ -60,7 +92,6 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
#SELECT * FROM t1; #SELECT * FROM t1;
#DROP TABLE t1; #DROP TABLE t1;
--echo # --echo #
--echo # Bug#31931: Mix of handlers error message --echo # Bug#31931: Mix of handlers error message
--echo # --echo #
...@@ -184,3 +215,18 @@ PARTITION BY RANGE (a) ...@@ -184,3 +215,18 @@ PARTITION BY RANGE (a)
PARTITION pMax VALUES LESS THAN MAXVALUE); PARTITION pMax VALUES LESS THAN MAXVALUE);
INSERT INTO t1 VALUES (1, "Partition p1, first row"); INSERT INTO t1 VALUES (1, "Partition p1, first row");
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED
--echo # TABLE CORRUPTS MYISAM
--disable_warnings
DROP TABLE if exists `t1`;
--enable_warnings
CREATE TABLE `t1`(`a` INT)ENGINE=myisam;
ALTER TABLE `t1` ADD COLUMN `b` INT;
CREATE UNIQUE INDEX `i1` ON `t1`(`b`);
CREATE UNIQUE INDEX `i2` ON `t1`(`a`);
ALTER TABLE `t1` ADD PRIMARY KEY (`a`);
--error ER_PARTITION_MGMT_ON_NONPARTITIONED
ALTER TABLE `t1` REMOVE PARTITIONING;
CHECK TABLE `t1` EXTENDED;
DROP TABLE t1;
...@@ -622,7 +622,6 @@ insert into t3 values (5),(15); ...@@ -622,7 +622,6 @@ insert into t3 values (5),(15);
explain partitions select * from t3 where a=11; explain partitions select * from t3 where a=11;
explain partitions select * from t3 where a=10; explain partitions select * from t3 where a=10;
explain partitions select * from t3 where a=20; explain partitions select * from t3 where a=20;
explain partitions select * from t3 where a=30; explain partitions select * from t3 where a=30;
# LIST(expr) partitioning # LIST(expr) partitioning
......
...@@ -808,7 +808,16 @@ Events::init(bool opt_noacl_or_bootstrap) ...@@ -808,7 +808,16 @@ Events::init(bool opt_noacl_or_bootstrap)
*/ */
thd->thread_stack= (char*) &thd; thd->thread_stack= (char*) &thd;
thd->store_globals(); thd->store_globals();
/*
Set current time for the thread that handles events.
Current time is stored in data member start_time of THD class.
Subsequently, this value is used to check whether event was expired
when make loading events from storage. Check for event expiration time
is done at Event_queue_element::compute_next_execution_time() where
event's status set to Event_parse_data::DISABLED and dropped flag set
to true if event was expired.
*/
thd->set_time();
/* /*
We will need Event_db_repository anyway, even if the scheduler is We will need Event_db_repository anyway, even if the scheduler is
disabled - to perform events DDL. disabled - to perform events DDL.
...@@ -1098,8 +1107,7 @@ Events::load_events_from_db(THD *thd) ...@@ -1098,8 +1107,7 @@ Events::load_events_from_db(THD *thd)
while (!(read_record_info.read_record(&read_record_info))) while (!(read_record_info.read_record(&read_record_info)))
{ {
Event_queue_element *et; Event_queue_element *et;
bool created; bool created, dropped;
bool drop_on_completion;
if (!(et= new Event_queue_element)) if (!(et= new Event_queue_element))
goto end; goto end;
...@@ -1114,10 +1122,13 @@ Events::load_events_from_db(THD *thd) ...@@ -1114,10 +1122,13 @@ Events::load_events_from_db(THD *thd)
delete et; delete et;
goto end; goto end;
} }
drop_on_completion= (et->on_completion ==
Event_parse_data::ON_COMPLETION_DROP);
/**
Since the Event_queue_element object could be deleted inside
Event_queue::create_event we should save the value of dropped flag
into the temporary variable.
*/
dropped= et->dropped;
if (event_queue->create_event(thd, et, &created)) if (event_queue->create_event(thd, et, &created))
{ {
/* Out of memory */ /* Out of memory */
...@@ -1126,7 +1137,7 @@ Events::load_events_from_db(THD *thd) ...@@ -1126,7 +1137,7 @@ Events::load_events_from_db(THD *thd)
} }
if (created) if (created)
count++; count++;
else if (drop_on_completion) else if (dropped)
{ {
/* /*
If not created, a stale event - drop if immediately if If not created, a stale event - drop if immediately if
......
...@@ -550,7 +550,10 @@ public: ...@@ -550,7 +550,10 @@ public:
longlong val_int(); longlong val_int();
longlong val_int_from_str(int *error); longlong val_int_from_str(int *error);
void fix_length_and_dec() void fix_length_and_dec()
{ fix_char_length(args[0]->max_char_length()); unsigned_flag=0; } {
fix_char_length(MY_MIN(args[0]->max_char_length(), MY_INT64_NUM_DECIMAL_DIGITS));
unsigned_flag=0;
}
virtual void print(String *str, enum_query_type query_type); virtual void print(String *str, enum_query_type query_type);
uint decimal_precision() const { return args[0]->decimal_precision(); } uint decimal_precision() const { return args[0]->decimal_precision(); }
}; };
......
...@@ -6613,6 +6613,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, ...@@ -6613,6 +6613,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
if (def) if (def)
{ // Field is changed { // Field is changed
def->field=field; def->field=field;
/*
Add column being updated to the list of new columns.
Note that columns with AFTER clauses are added to the end
of the list for now. Their positions will be corrected later.
*/
new_create_list.push_back(def);
if (field->stored_in_db != def->stored_in_db) if (field->stored_in_db != def->stored_in_db)
{ {
my_error(ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN, MYF(0)); my_error(ER_UNSUPPORTED_ACTION_ON_VIRTUAL_COLUMN, MYF(0));
...@@ -6620,7 +6626,13 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, ...@@ -6620,7 +6626,13 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
} }
if (!def->after) if (!def->after)
{ {
new_create_list.push_back(def); /*
If this ALTER TABLE doesn't have an AFTER clause for the modified
column then remove this column from the list of columns to be
processed. So later we can iterate over the columns remaining
in this list and process modified columns with AFTER clause or
add new columns.
*/
def_it.remove(); def_it.remove();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment