1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

merge from 5.1 main

This commit is contained in:
Bjorn Munch
2011-05-12 14:08:47 +02:00
63 changed files with 1299 additions and 339 deletions

View File

@ -7,7 +7,7 @@ let $counter= 500;
let $mysql_errno= 0;
while (!$mysql_errno)
{
--error 0,1053,2002,2006,2013
--error 0,1040,1053,2002,2003,2006,2013
show status;
dec $counter;

View File

@ -12756,3 +12756,19 @@ a
1
2
DROP TABLE t1;
#
# BUG#57162 - valgrind errors, random data when returning
# ordered data from archive tables
#
SET sort_buffer_size=32804;
CREATE TABLE t1(a INT, b CHAR(255), c CHAR(255), d CHAR(255),
e CHAR(255), f INT) ENGINE=ARCHIVE DEFAULT CHARSET utf8;
INSERT INTO t1 VALUES(-1,'b','c','d','e',1);
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
SELECT * FROM t1 ORDER BY f LIMIT 1;
a b c d e f
-1 b c d e 1
DROP TABLE t1;
SET sort_buffer_size=DEFAULT;

View File

@ -451,4 +451,21 @@ SELECT CONVERT(t2.a USING UTF8) FROM t1, t1 t2 LIMIT 1
1
1
DROP TABLE t1;
#
# Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
# DOESN'T ADHERE TO MAX_ALLOWED_PACKET
SET @@GLOBAL.max_allowed_packet=2048;
Warnings:
Warning 1105 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT CONVERT('a', BINARY(2049));
CONVERT('a', BINARY(2049))
NULL
Warnings:
Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (2048) - truncated
SELECT CONVERT('a', CHAR(2049));
CONVERT('a', CHAR(2049))
NULL
Warnings:
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
SET @@GLOBAL.max_allowed_packet=default;
End of 5.1 tests

View File

@ -1,3 +1,4 @@
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
drop database if exists events_test;
drop database if exists db_x;
drop database if exists mysqltest_db2;
@ -259,33 +260,36 @@ events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLE
Try to alter mysql.event: the server should fail to load
event information after mysql.event was tampered with.
First, let's add a column to the end and make sure everything
works as before
First, let's add a column to the end and check the error is emitted.
ALTER TABLE mysql.event ADD dummy INT;
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
events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
ERROR HY000: Failed to open mysql.event
SELECT event_name FROM INFORMATION_SCHEMA.events;
event_name
intact_check
ERROR HY000: Failed to open mysql.event
SHOW CREATE EVENT intact_check;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
intact_check SYSTEM CREATE EVENT `intact_check` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT "nothing" latin1 latin1_swedish_ci latin1_swedish_ci
ERROR HY000: Failed to open mysql.event
DROP EVENT no_such_event;
ERROR HY000: Unknown event 'no_such_event'
ERROR HY000: Failed to open mysql.event
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_1;
ERROR HY000: Unknown event 'intact_check_1'
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_2;
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check;
ERROR HY000: Failed to open mysql.event
DROP DATABASE IF EXISTS mysqltest_no_such_database;
Warnings:
Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
Warnings:
Error 1545 Failed to open mysql.event
SELECT @@event_scheduler;
@@event_scheduler
OFF
@ -294,6 +298,7 @@ Variable_name Value
event_scheduler OFF
SET GLOBAL event_scheduler=OFF;
ALTER TABLE mysql.event DROP dummy;
DROP EVENT intact_check;
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
Now let's add a column to the first position: the server
@ -301,30 +306,32 @@ expects to see event schema name there
ALTER TABLE mysql.event ADD dummy INT FIRST;
SHOW EVENTS;
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
ERROR HY000: Failed to open mysql.event
SELECT event_name FROM INFORMATION_SCHEMA.events;
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
ERROR HY000: Failed to open mysql.event
SHOW CREATE EVENT intact_check;
ERROR HY000: Unknown event 'intact_check'
ERROR HY000: Failed to open mysql.event
DROP EVENT no_such_event;
ERROR HY000: Unknown event 'no_such_event'
ERROR HY000: Failed to open mysql.event
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ERROR HY000: Failed to store event name. Error code 2 from storage engine.
ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
ERROR HY000: Unknown event 'intact_check_1'
ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
ERROR HY000: Unknown event 'intact_check_1'
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_1;
ERROR HY000: Unknown event 'intact_check_1'
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_2;
ERROR HY000: Unknown event 'intact_check_2'
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check;
ERROR HY000: Unknown event 'intact_check'
ERROR HY000: Failed to open mysql.event
DROP DATABASE IF EXISTS mysqltest_no_such_database;
Warnings:
Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
Warnings:
Error 1545 Failed to open mysql.event
SELECT @@event_scheduler;
@@event_scheduler
OFF
@ -345,29 +352,32 @@ Drop some columns and try more checks.
ALTER TABLE mysql.event DROP comment, DROP starts;
SHOW EVENTS;
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
ERROR HY000: Failed to open mysql.event
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
ERROR HY000: Failed to open mysql.event
SHOW CREATE EVENT intact_check;
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
ERROR HY000: Failed to open mysql.event
DROP EVENT no_such_event;
ERROR HY000: Unknown event 'no_such_event'
ERROR HY000: Failed to open mysql.event
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ERROR HY000: Column count of mysql.event is wrong. Expected 22, found 20. The table is probably corrupted
ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
ERROR HY000: Unknown event 'intact_check_1'
ERROR HY000: Failed to open mysql.event
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
ERROR HY000: Unknown event 'intact_check_1'
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_1;
ERROR HY000: Unknown event 'intact_check_1'
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check_2;
ERROR HY000: Unknown event 'intact_check_2'
ERROR HY000: Failed to open mysql.event
DROP EVENT intact_check;
ERROR HY000: Failed to open mysql.event
DROP DATABASE IF EXISTS mysqltest_no_such_database;
Warnings:
Note 1008 Can't drop database 'mysqltest_no_such_database'; database doesn't exist
CREATE DATABASE mysqltest_db2;
DROP DATABASE mysqltest_db2;
Warnings:
Error 1545 Failed to open mysql.event
SELECT @@event_scheduler;
@@event_scheduler
OFF
@ -425,4 +435,42 @@ CREATE TABLE mysql.event like event_like;
DROP TABLE event_like;
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
#
# Bug#12394306: the sever may crash if mysql.event is corrupted
#
CREATE EVENT ev1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ALTER EVENT ev1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
CREATE TABLE event_original LIKE mysql.event;
INSERT INTO event_original SELECT * FROM mysql.event;
ALTER TABLE mysql.event MODIFY modified CHAR(1);
Warnings:
Warning 1265 Data truncated for column 'modified' at row 1
SHOW EVENTS;
ERROR HY000: Failed to open mysql.event
SELECT event_name, created, last_altered FROM information_schema.events;
ERROR HY000: Failed to open mysql.event
CREATE EVENT ev2 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ERROR HY000: Failed to open mysql.event
ALTER EVENT ev1 ON SCHEDULE EVERY 9 HOUR DO SELECT 9;
ERROR HY000: Failed to open mysql.event
DROP TABLE mysql.event;
RENAME TABLE event_original TO mysql.event;
DROP EVENT ev1;
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
#
# End of tests
#
drop database events_test;

View File

@ -1,3 +1,4 @@
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
set global event_scheduler=off;
drop database if exists events_test;
create database events_test;
@ -52,6 +53,8 @@ Warnings:
Note 1008 Can't drop database 'mysqltest_database_not_exists'; database doesn't exist
create database mysqltest_db1;
drop database mysqltest_db1;
Warnings:
Error 1545 Failed to open mysql.event
Restore the original mysql.event table
drop table mysql.event;
rename table event_like to mysql.event;

View File

@ -1040,6 +1040,39 @@ drop table t1;
#
create table t1(a char(32) not null) engine=myisam;
create spatial index i on t1 (a);
ERROR HY000: Can't create table '#sql-temporary' (errno: 140)
ERROR HY000: Incorrect arguments to SPATIAL INDEX
drop table t1;
CREATE TABLE t0 (a BINARY(32) NOT NULL);
CREATE SPATIAL INDEX i on t0 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
INSERT INTO t0 VALUES (1);
CREATE TABLE t1(
col0 BINARY NOT NULL,
col2 TIMESTAMP,
SPATIAL INDEX i1 (col0)
) ENGINE=MyISAM;
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t1 (
col0 BINARY NOT NULL,
col2 TIMESTAMP
) ENGINE=MyISAM;
CREATE SPATIAL INDEX idx0 ON t1(col0);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t2 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 POINT
);
CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t3 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 LINESTRING,
SPATIAL INDEX i1 (col1, col2)
);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
DROP TABLE t0, t1, t2;
End of 5.1 tests

View File

@ -109,3 +109,13 @@ count(*)
35840
drop table t1;
drop table t2;
RESET MASTER;
USE test;
SET @old_binlog_format= @@binlog_format;
SET SESSION binlog_format=ROW;
CREATE TABLE t1(c1 INT);
INSERT INTO t1 VALUES (1);
FLUSH LOGS;
DROP TABLE t1;
SET SESSION binlog_format= @old_binlog_format;
RESET MASTER;

View File

@ -1913,4 +1913,17 @@ group by PAY.id + 1;
mult v_net_with_discount v_total
1.0000 27.18 27.180000
DROP TABLE currencies, payments, sub_tasks;
#
# Bug#55436: buffer overflow in debug binary of dbug_buff in
# Field_new_decimal::store_value
#
SET SQL_MODE='';
CREATE TABLE t1(f1 DECIMAL(44,24)) ENGINE=MYISAM;
INSERT INTO t1 SET f1 = -64878E-85;
Warnings:
Note 1265 Data truncated for column 'f1' at row 1
SELECT f1 FROM t1;
f1
0.000000000000000000000000
DROP TABLE IF EXISTS t1;
End of 5.1 tests

View File

@ -35,7 +35,7 @@ connect(default,localhost,root,,test);
# Copied data from t1 into t2 large than max_binlog_cache_size
START TRANSACTION;
--error 1197
--error ER_TRANS_CACHE_FULL
CREATE TABLE t2 SELECT * FROM t1;
COMMIT;
SHOW TABLES LIKE 't%';

View File

@ -0,0 +1,17 @@
create table `bug59410_1`(`a` int)engine=innodb;
insert into `bug59410_1` values (1),(2),(3);
select 1 from `bug59410_1` where `a` <> any (
select 1 from `bug59410_1` where `a` <> 1 for update)
for update;
1
1
1
drop table bug59410_1;
create table bug59410_2(`a` char(1),`b` int)engine=innodb;
insert into bug59410_2 values('0',0);
set transaction isolation level read uncommitted;
start transaction;
set @a=(select b from bug59410_2 where
(select 1 from bug59410_2 where a group by @a=b)
group by @a:=b);
drop table bug59410_2;

View File

@ -0,0 +1,57 @@
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
COMMIT;
XA START '123';
INSERT INTO t VALUES(1,1);
XA END '123';
XA PREPARE '123';
XA START '456';
INSERT INTO t VALUES(3,47),(5,67);
UPDATE t SET b=2*b WHERE a BETWEEN 5 AND 8;
XA END '456';
XA PREPARE '456';
XA START '789';
UPDATE t SET b=4*a WHERE a=32;
XA END '789';
XA PREPARE '789';
call mtr.add_suppression("Found 3 prepared XA transactions");
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
a b
1 1
2 2
3 47
4 4
5 134
8 16
16 16
32 128
COMMIT;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
a b
1 1
2 2
3 47
4 4
5 134
8 16
16 16
32 128
COMMIT;
XA RECOVER;
formatID gtrid_length bqual_length data
1 3 0 789
1 3 0 456
1 3 0 123
XA ROLLBACK '123';
XA ROLLBACK '456';
XA COMMIT '789';
SELECT * FROM t;
a b
2 2
4 4
8 8
16 16
32 128
DROP TABLE t;

View File

@ -0,0 +1,24 @@
#
# Bug#59410 read uncommitted: unlock row could not find a 3 mode lock on the record
#
-- source include/have_innodb.inc
# only interested that the following do not produce something like
# InnoDB: Error: unlock row could not find a 2 mode lock on the record
# in the error log
create table `bug59410_1`(`a` int)engine=innodb;
insert into `bug59410_1` values (1),(2),(3);
select 1 from `bug59410_1` where `a` <> any (
select 1 from `bug59410_1` where `a` <> 1 for update)
for update;
drop table bug59410_1;
create table bug59410_2(`a` char(1),`b` int)engine=innodb;
insert into bug59410_2 values('0',0);
set transaction isolation level read uncommitted;
start transaction;
set @a=(select b from bug59410_2 where
(select 1 from bug59410_2 where a group by @a=b)
group by @a:=b);
drop table bug59410_2;

View File

@ -0,0 +1,66 @@
# Bug #59641 Prepared XA transaction causes shutdown hang after a crash
-- source include/not_embedded.inc
-- source include/have_innodb.inc
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
COMMIT;
XA START '123';
INSERT INTO t VALUES(1,1);
XA END '123';
XA PREPARE '123';
CONNECT (con1,localhost,root,,);
CONNECTION con1;
XA START '456';
INSERT INTO t VALUES(3,47),(5,67);
UPDATE t SET b=2*b WHERE a BETWEEN 5 AND 8;
XA END '456';
XA PREPARE '456';
CONNECT (con2,localhost,root,,);
CONNECTION con2;
XA START '789';
UPDATE t SET b=4*a WHERE a=32;
XA END '789';
XA PREPARE '789';
# The server would issue this warning on restart.
call mtr.add_suppression("Found 3 prepared XA transactions");
# Kill the server without sending a shutdown command
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 0
-- source include/wait_until_disconnected.inc
# Restart the server.
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
COMMIT;
# Shut down the server. This would hang because of the bug.
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server
-- source include/wait_until_disconnected.inc
# Restart the server.
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
COMMIT;
XA RECOVER;
XA ROLLBACK '123';
XA ROLLBACK '456';
XA COMMIT '789';
SELECT * FROM t;
DROP TABLE t;

View File

@ -0,0 +1,17 @@
create table `bug59410_1`(`a` int)engine=innodb;
insert into `bug59410_1` values (1),(2),(3);
select 1 from `bug59410_1` where `a` <> any (
select 1 from `bug59410_1` where `a` <> 1 for update)
for update;
1
1
1
drop table bug59410_1;
create table bug59410_2(`a` char(1),`b` int)engine=innodb;
insert into bug59410_2 values('0',0);
set transaction isolation level read uncommitted;
start transaction;
set @a=(select b from bug59410_2 where
(select 1 from bug59410_2 where a group by @a=b)
group by @a:=b);
drop table bug59410_2;

View File

@ -0,0 +1,57 @@
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
COMMIT;
XA START '123';
INSERT INTO t VALUES(1,1);
XA END '123';
XA PREPARE '123';
XA START '456';
INSERT INTO t VALUES(3,47),(5,67);
UPDATE t SET b=2*b WHERE a BETWEEN 5 AND 8;
XA END '456';
XA PREPARE '456';
XA START '789';
UPDATE t SET b=4*a WHERE a=32;
XA END '789';
XA PREPARE '789';
call mtr.add_suppression("Found 3 prepared XA transactions");
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
a b
1 1
2 2
3 47
4 4
5 134
8 16
16 16
32 128
COMMIT;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
a b
1 1
2 2
3 47
4 4
5 134
8 16
16 16
32 128
COMMIT;
XA RECOVER;
formatID gtrid_length bqual_length data
1 3 0 789
1 3 0 456
1 3 0 123
XA ROLLBACK '123';
XA ROLLBACK '456';
XA COMMIT '789';
SELECT * FROM t;
a b
2 2
4 4
8 8
16 16
32 128
DROP TABLE t;

View File

@ -0,0 +1,24 @@
#
# Bug#59410 read uncommitted: unlock row could not find a 3 mode lock on the record
#
-- source include/have_innodb_plugin.inc
# only interested that the following do not produce something like
# InnoDB: Error: unlock row could not find a 2 mode lock on the record
# in the error log
create table `bug59410_1`(`a` int)engine=innodb;
insert into `bug59410_1` values (1),(2),(3);
select 1 from `bug59410_1` where `a` <> any (
select 1 from `bug59410_1` where `a` <> 1 for update)
for update;
drop table bug59410_1;
create table bug59410_2(`a` char(1),`b` int)engine=innodb;
insert into bug59410_2 values('0',0);
set transaction isolation level read uncommitted;
start transaction;
set @a=(select b from bug59410_2 where
(select 1 from bug59410_2 where a group by @a=b)
group by @a:=b);
drop table bug59410_2;

View File

@ -0,0 +1,70 @@
# Bug #59641 Prepared XA transaction causes shutdown hang after a crash
-- source include/not_embedded.inc
-- source include/have_innodb_plugin.inc
let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
CREATE TABLE t(a INT PRIMARY KEY, b INT)ENGINE=InnoDB;
INSERT INTO t VALUES(2,2),(4,4),(8,8),(16,16),(32,32);
COMMIT;
XA START '123';
INSERT INTO t VALUES(1,1);
XA END '123';
XA PREPARE '123';
CONNECT (con1,localhost,root,,);
CONNECTION con1;
XA START '456';
INSERT INTO t VALUES(3,47),(5,67);
UPDATE t SET b=2*b WHERE a BETWEEN 5 AND 8;
XA END '456';
XA PREPARE '456';
CONNECT (con2,localhost,root,,);
CONNECTION con2;
XA START '789';
UPDATE t SET b=4*a WHERE a=32;
XA END '789';
XA PREPARE '789';
# The server would issue this warning on restart.
call mtr.add_suppression("Found 3 prepared XA transactions");
# Kill the server without sending a shutdown command
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server 0
-- source include/wait_until_disconnected.inc
# Restart the server.
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
COMMIT;
# Shut down the server. This would hang because of the bug.
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- shutdown_server
-- source include/wait_until_disconnected.inc
# Restart the server.
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t;
COMMIT;
XA RECOVER;
XA ROLLBACK '123';
XA ROLLBACK '456';
XA COMMIT '789';
SELECT * FROM t;
DROP TABLE t;
--disable_query_log
eval set global innodb_file_format_check=$innodb_file_format_check_orig;

View File

@ -19,7 +19,7 @@ change master to master_port=MASTER_PORT;
start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS;
include/wait_for_slave_io_to_start.inc
include/wait_for_slave_sql_to_stop.inc
*** checking until postion execution: must be only t1 in the list ***
*** checking until position execution: must be only t1 in the list ***
show tables;
Tables_in_test
t1

View File

@ -9,29 +9,29 @@ connection master;
CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t1 VALUES (1),(2),(3),(4);
DROP TABLE t1;
# Save master log postion for query DROP TABLE t1
# Save master log position for query DROP TABLE t1
save_master_pos;
let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 7);
let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 7);
CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
# Save master log postion for query CREATE TABLE t2
# Save master log position for query CREATE TABLE t2
save_master_pos;
let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8);
INSERT INTO t2 VALUES (1),(2);
save_master_pos;
# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
# Save master log position for query INSERT INTO t2 VALUES (1),(2);
let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12);
sync_slave_with_master;
# Save relay log postion for query INSERT INTO t2 VALUES (1),(2);
# Save relay log position for query INSERT INTO t2 VALUES (1),(2);
let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1);
connection master;
INSERT INTO t2 VALUES (3),(4);
DROP TABLE t2;
# Save master log postion for query INSERT INTO t2 VALUES (1),(2);
# Save master log position for query INSERT INTO t2 VALUES (1),(2);
let $master_pos_drop_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 17);
sync_slave_with_master;

View File

@ -47,7 +47,7 @@ eval start slave until master_log_file='master-bin.000001', master_log_pos=$unti
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
--echo *** checking until postion execution: must be only t1 in the list ***
--echo *** checking until position execution: must be only t1 in the list ***
show tables;
# cleanup

View File

@ -1678,3 +1678,18 @@ SELECT * FROM t1;
REPAIR TABLE t1 EXTENDED;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # BUG#57162 - valgrind errors, random data when returning
--echo # ordered data from archive tables
--echo #
SET sort_buffer_size=32804;
CREATE TABLE t1(a INT, b CHAR(255), c CHAR(255), d CHAR(255),
e CHAR(255), f INT) ENGINE=ARCHIVE DEFAULT CHARSET utf8;
INSERT INTO t1 VALUES(-1,'b','c','d','e',1);
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT t1.* FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6;
SELECT * FROM t1 ORDER BY f LIMIT 1;
DROP TABLE t1;
SET sort_buffer_size=DEFAULT;

View File

@ -282,5 +282,19 @@ SELECT 1 FROM
) AS s LIMIT 1;
DROP TABLE t1;
--echo #
--echo # Bug #11765023: 57934: DOS POSSIBLE SINCE BINARY CASTING
--echo # DOESN'T ADHERE TO MAX_ALLOWED_PACKET
SET @@GLOBAL.max_allowed_packet=2048;
# reconnect to make the new max packet size take effect
--connect (newconn, localhost, root,,)
SELECT CONVERT('a', BINARY(2049));
SELECT CONVERT('a', CHAR(2049));
connection default;
disconnect newconn;
SET @@GLOBAL.max_allowed_packet=default;
--echo End of 5.1 tests

View File

@ -4,6 +4,8 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
--disable_warnings
drop database if exists events_test;
drop database if exists db_x;
@ -270,23 +272,28 @@ SHOW EVENTS;
--echo Try to alter mysql.event: the server should fail to load
--echo event information after mysql.event was tampered with.
--echo
--echo First, let's add a column to the end and make sure everything
--echo works as before
--echo First, let's add a column to the end and check the error is emitted.
--echo
ALTER TABLE mysql.event ADD dummy INT;
--replace_column 8 # 9 #
--error ER_EVENT_OPEN_TABLE_FAILED
SHOW EVENTS;
--error ER_EVENT_OPEN_TABLE_FAILED
SELECT event_name FROM INFORMATION_SCHEMA.events;
--replace_regex /STARTS '[^']+'/STARTS '#'/
--error ER_EVENT_OPEN_TABLE_FAILED
SHOW CREATE EVENT intact_check;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT no_such_event;
--error ER_EVENT_OPEN_TABLE_FAILED
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--error ER_EVENT_OPEN_TABLE_FAILED
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
--error ER_EVENT_OPEN_TABLE_FAILED
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check_1;
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check_2;
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check;
DROP DATABASE IF EXISTS mysqltest_no_such_database;
CREATE DATABASE mysqltest_db2;
@ -296,6 +303,7 @@ SHOW VARIABLES LIKE 'event_scheduler';
SET GLOBAL event_scheduler=OFF;
# Clean up
ALTER TABLE mysql.event DROP dummy;
DROP EVENT intact_check;
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
--echo
--echo Now let's add a column to the first position: the server
@ -303,24 +311,26 @@ CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
--echo
ALTER TABLE mysql.event ADD dummy INT FIRST;
--error ER_CANNOT_LOAD_FROM_TABLE
--error ER_EVENT_OPEN_TABLE_FAILED
SHOW EVENTS;
--error ER_CANNOT_LOAD_FROM_TABLE
--error ER_EVENT_OPEN_TABLE_FAILED
SELECT event_name FROM INFORMATION_SCHEMA.events;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
SHOW CREATE EVENT intact_check;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT no_such_event;
--error ER_EVENT_STORE_FAILED
--error ER_EVENT_OPEN_TABLE_FAILED
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check_1;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check;
# Should work OK
DROP DATABASE IF EXISTS mysqltest_no_such_database;
@ -341,25 +351,25 @@ INSERT INTO event_like SELECT * FROM mysql.event;
--echo
--echo
ALTER TABLE mysql.event DROP comment, DROP starts;
--error ER_CANNOT_LOAD_FROM_TABLE
--error ER_EVENT_OPEN_TABLE_FAILED
SHOW EVENTS;
--error ER_CANNOT_LOAD_FROM_TABLE
--error ER_EVENT_OPEN_TABLE_FAILED
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
--error ER_CANNOT_LOAD_FROM_TABLE
--error ER_EVENT_OPEN_TABLE_FAILED
SHOW CREATE EVENT intact_check;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT no_such_event;
--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED
--error ER_EVENT_OPEN_TABLE_FAILED
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check_1;
--error ER_EVENT_DOES_NOT_EXIST
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check_2;
# Should succeed
--error ER_EVENT_OPEN_TABLE_FAILED
DROP EVENT intact_check;
DROP DATABASE IF EXISTS mysqltest_no_such_database;
CREATE DATABASE mysqltest_db2;
@ -407,9 +417,54 @@ CREATE TABLE mysql.event like event_like;
DROP TABLE event_like;
--replace_column 8 # 9 #
SHOW EVENTS;
#
# End of tests
#
--echo
--echo #
--echo # Bug#12394306: the sever may crash if mysql.event is corrupted
--echo #
--echo
CREATE EVENT ev1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ALTER EVENT ev1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
--echo
CREATE TABLE event_original LIKE mysql.event;
INSERT INTO event_original SELECT * FROM mysql.event;
--echo
ALTER TABLE mysql.event MODIFY modified CHAR(1);
--echo
--error ER_EVENT_OPEN_TABLE_FAILED
SHOW EVENTS;
--echo
--error ER_EVENT_OPEN_TABLE_FAILED
SELECT event_name, created, last_altered FROM information_schema.events;
--echo
--error ER_EVENT_OPEN_TABLE_FAILED
CREATE EVENT ev2 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--echo
--error ER_EVENT_OPEN_TABLE_FAILED
ALTER EVENT ev1 ON SCHEDULE EVERY 9 HOUR DO SELECT 9;
--echo
DROP TABLE mysql.event;
RENAME TABLE event_original TO mysql.event;
--echo
DROP EVENT ev1;
--echo
SHOW EVENTS;
--echo
--echo #
--echo # End of tests
--echo #
let $wait_condition=
select count(*) = 0 from information_schema.processlist

View File

@ -1,6 +1,8 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
#
# Test that when the server is restarted, it checks mysql.event table,
# and disables the scheduler if it's not up to date.

View File

@ -760,10 +760,56 @@ drop table t1;
--echo # on char > 31 bytes".
--echo #
create table t1(a char(32) not null) engine=myisam;
--replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
--error ER_CANT_CREATE_TABLE
--error ER_WRONG_ARGUMENTS
create spatial index i on t1 (a);
drop table t1;
#
# Bug#11767480 - SPATIAL INDEXES ON NON-SPATIAL COLUMNS CAUSE CRASHES.
#
CREATE TABLE t0 (a BINARY(32) NOT NULL);
--error ER_WRONG_ARGUMENTS
CREATE SPATIAL INDEX i on t0 (a);
INSERT INTO t0 VALUES (1);
--error ER_WRONG_ARGUMENTS
CREATE TABLE t1(
col0 BINARY NOT NULL,
col2 TIMESTAMP,
SPATIAL INDEX i1 (col0)
) ENGINE=MyISAM;
# Test other ways to add indices
CREATE TABLE t1 (
col0 BINARY NOT NULL,
col2 TIMESTAMP
) ENGINE=MyISAM;
--error ER_WRONG_ARGUMENTS
CREATE SPATIAL INDEX idx0 ON t1(col0);
--error ER_WRONG_ARGUMENTS
ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
CREATE TABLE t2 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 POINT
);
--error ER_WRONG_ARGUMENTS
CREATE SPATIAL INDEX idx0 ON t2 (col1, col2);
--error ER_WRONG_ARGUMENTS
CREATE TABLE t3 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 LINESTRING,
SPATIAL INDEX i1 (col1, col2)
);
# cleanup
DROP TABLE t0, t1, t2;
--echo End of 5.1 tests

View File

@ -71,3 +71,32 @@ select count(*) from t2;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
drop table t1;
drop table t2;
#
# BUG#12354268
#
# This test verifies that using --start-position with DECODE-ROWS
# does not make mysqlbinlog to output an error stating that it
# does not contain any FD event.
#
RESET MASTER;
USE test;
SET @old_binlog_format= @@binlog_format;
SET SESSION binlog_format=ROW;
CREATE TABLE t1(c1 INT);
--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1)
--let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
--let $MYSQLD_DATADIR= `SELECT @@datadir`
INSERT INTO t1 VALUES (1);
FLUSH LOGS;
--disable_result_log
--exec $MYSQL_BINLOG --base64-output=DECODE-ROWS --start-position=$master_pos -v $MYSQLD_DATADIR/$master_binlog
--enable_result_log
DROP TABLE t1;
SET SESSION binlog_format= @old_binlog_format;
RESET MASTER;

View File

@ -1510,5 +1510,19 @@ group by PAY.id + 1;
DROP TABLE currencies, payments, sub_tasks;
--echo #
--echo # Bug#55436: buffer overflow in debug binary of dbug_buff in
--echo # Field_new_decimal::store_value
--echo #
# this threw memory warnings on Windows. Also make sure future changes
# don't change these results, as per usual.
SET SQL_MODE='';
CREATE TABLE t1(f1 DECIMAL(44,24)) ENGINE=MYISAM;
INSERT INTO t1 SET f1 = -64878E-85;
SELECT f1 FROM t1;
DROP TABLE IF EXISTS t1;
--echo End of 5.1 tests