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

MDEV-6720 - enable connection log in mysqltest by default

This commit is contained in:
Sergey Vojtovich
2016-03-25 20:51:22 +04:00
parent 5052e2479e
commit 282497dd6d
1559 changed files with 38534 additions and 9891 deletions

View File

@ -127,7 +127,7 @@ static my_bool parsing_disabled= 0;
static my_bool display_result_vertically= FALSE, display_result_lower= FALSE,
display_metadata= FALSE, display_result_sorted= FALSE;
static my_bool disable_query_log= 0, disable_result_log= 0;
static my_bool disable_connect_log= 1;
static my_bool disable_connect_log= 0;
static my_bool disable_warnings= 0, disable_column_names= 0;
static my_bool prepare_warnings_enabled= 0;
static my_bool disable_info= 1;

View File

@ -39,29 +39,24 @@ if ($before_truncate) {
eval $before_truncate;
}
--echo # Connection: default
BEGIN;
INSERT INTO t2 SELECT * FROM t1;
connect (truncate,localhost,root,,);
--echo # Connection: truncate
send TRUNCATE TABLE t1;
connection default;
--echo # Connection: default
INSERT INTO t2 SELECT * FROM t1;
SELECT COUNT(*) FROM t2;
COMMIT;
connection truncate;
--echo # Connection: truncate
--echo # Reaping TRUNCATE TABLE
--reap
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2;
connection default;
--echo # Connection: default
source include/show_binlog_events.inc;
disconnect truncate;

View File

@ -14,11 +14,9 @@
connection slave;
let $before = query_get_value("SHOW MASTER STATUS", Position, 1);
--echo [on master]
connection master;
eval $statement;
--echo [on slave]
sync_slave_with_master;
--echo # Expect 0
SELECT COUNT(*) FROM t1;

View File

@ -7,15 +7,9 @@ set timestamp=1000000000;
create database mysqltest2 character set latin2;
set @@character_set_server=latin5;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database mysqltest2;
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database mysqltest2;
show create database mysqltest3;
@ -23,14 +17,8 @@ connection master;
set @@collation_server=armscii8_bin;
drop database mysqltest3;
create database mysqltest3;
--disable_query_log
select "--- --master--" as "";
--enable_query_log
show create database mysqltest3;
sync_slave_with_master;
--disable_query_log
select "--- --slave--" as "";
--enable_query_log
show create database mysqltest3;
connection master;
@ -45,10 +33,8 @@ insert into t1 (b) values(@@character_set_client);
# collation_client does not exist
insert into t1 (b) values(@@character_set_connection);
insert into t1 (b) values(@@collation_connection);
--echo --- --master--
select * from t1 order by a;
sync_slave_with_master;
--echo --- --slave--
select * from mysqltest2.t1 order by a;
connection master;
@ -59,10 +45,8 @@ insert into t1 (b) values(LEAST("M
set collation_connection=latin1_german2_ci;
insert into t1 (b) values(@@collation_connection);
insert into t1 (b) values(LEAST("M<>ller","Muffler"));
--echo --- --master--
select * from t1 order by a;
sync_slave_with_master;
--echo --- --slave--
select * from mysqltest2.t1 order by a;
# Presently charset info is not logged with LOAD DATA but it will
@ -81,10 +65,8 @@ connection master;
set @a= _cp850 'M<>ller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
--echo --- --master--
select * from t1 order by a;
sync_slave_with_master;
--echo --- --slave--
select * from mysqltest2.t1 order by a;
connection master;

View File

@ -57,10 +57,8 @@
--echo ==== Initialize ====
--echo [on master]
connection master;
CREATE TABLE t1(a INT PRIMARY KEY);
--echo [on slave]
sync_slave_with_master;
@ -71,14 +69,12 @@ sync_slave_with_master;
INSERT INTO t1 VALUES (1);
--echo ---- Insert rows on master ----
--echo [on master]
connection master;
# Insert the same row on master
INSERT INTO t1 VALUES (1);
save_master_pos;
SELECT * FROM t1;
--echo [on slave]
connection slave;
# If we are statement-logging or if slave_exec_mode=STRICT, we now
@ -117,23 +113,19 @@ SELECT * FROM t1;
--echo ==== Test: SQL thread sees 'DELETE' of non-existing row ====
--echo ---- On master, insert two rows, the second with binlogging off ----
--echo [on master]
connection master;
DELETE FROM t1;
INSERT INTO t1 VALUES (1);
--echo [on slave]
sync_slave_with_master;
DELETE FROM t1 WHERE a = 1;
--echo ---- On master, remove the row that does not exist on slave ----
--echo [on master]
connection master;
DELETE FROM t1 WHERE a = 1;
SELECT * FROM t1;
save_master_pos;
--echo [on slave]
connection slave;
# If we are row-logging and slave_exec_mode is STRICT, we now expect
@ -172,9 +164,7 @@ SELECT * FROM t1;
--echo ==== Clean up ====
--echo [on master]
connection master;
DROP TABLE t1;
--echo [on slave]
--sync_slave_with_master

View File

@ -133,8 +133,6 @@ set local sql_mode='';
# The sync_slave_with_master is needed to make the xids deterministic.
sync_slave_with_master;
--echo
--echo -------- switch to master -------
connection master;
SET AUTOCOMMIT = 1;
#
@ -186,13 +184,9 @@ eval CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=$temp_engine_type;
SET AUTOCOMMIT = 0;
use mysqltest1;
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
SET AUTOCOMMIT = 1;
use mysqltest1;
--echo
--echo -------- switch to master -------
connection master;
@ -260,12 +254,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't2';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TABLES LIKE 't2';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23;
@ -273,12 +263,8 @@ let $my_master_commit= false;
let $my_slave_commit= false;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't23';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TABLES LIKE 't23';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20;
@ -286,12 +272,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TABLES LIKE 't20';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TABLES LIKE 't20';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT;
@ -299,12 +281,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
describe mysqltest1.t4;
--echo
--echo -------- switch to slave --------
connection slave;
describe mysqltest1.t4;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= $engine_type;
@ -326,12 +304,8 @@ let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT * FROM mysqltest1.t7;
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
SELECT * FROM mysqltest1.t7;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -383,12 +357,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW INDEX FROM mysqltest1.t6;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW INDEX FROM mysqltest1.t6;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1);
@ -396,12 +366,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW INDEX FROM mysqltest1.t5;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW INDEX FROM mysqltest1.t5;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -413,12 +379,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW DATABASES LIKE "mysqltest2";
--echo
--echo -------- switch to slave --------
connection slave;
SHOW DATABASES LIKE "mysqltest2";
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= CREATE DATABASE mysqltest3;
@ -426,12 +388,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW DATABASES LIKE "mysqltest3";
--echo
--echo -------- switch to slave --------
connection slave;
SHOW DATABASES LIKE "mysqltest3";
--echo
--echo -------- switch to master -------
connection master;
# End of 4.1 tests
@ -446,13 +404,9 @@ let $my_slave_commit= true;
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to slave --------
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to master -------
connection master;
--horizontal_results
@ -463,13 +417,9 @@ let $my_slave_commit= true;
--vertical_results
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to slave --------
connection slave;
--replace_column 5 # 6 #
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to master -------
connection master;
--horizontal_results
@ -479,12 +429,8 @@ let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--vertical_results
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to slave --------
connection slave;
SHOW PROCEDURE STATUS LIKE 'p1';
--echo
--echo -------- switch to master -------
connection master;
--horizontal_results
@ -496,12 +442,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= ALTER VIEW v1 AS select f1 from t1;
@ -509,12 +451,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP VIEW IF EXISTS v1;
@ -523,13 +461,9 @@ let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
--error 1146
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to slave --------
connection slave;
--error 1146
SHOW CREATE VIEW v1;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -540,12 +474,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TRIGGERS;
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP TRIGGER trg1;
@ -553,12 +483,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SHOW TRIGGERS;
--echo
--echo -------- switch to slave --------
connection slave;
SHOW TRIGGERS;
--echo
--echo -------- switch to master -------
connection master;
###############################################################
@ -569,12 +495,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'user1';
--echo
--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'user1';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= RENAME USER user1@localhost TO rename1@localhost;
@ -582,12 +504,8 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--echo
--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
--echo
--echo -------- switch to master -------
connection master;
let $my_stmt= DROP USER rename1@localhost;
@ -595,8 +513,6 @@ let $my_master_commit= true;
let $my_slave_commit= true;
--source include/rpl_stmt_seq.inc
SELECT user FROM mysql.user WHERE user = 'rename1';
--echo
--echo -------- switch to slave --------
connection slave;
SELECT user FROM mysql.user WHERE user = 'rename1';
@ -604,8 +520,6 @@ SELECT user FROM mysql.user WHERE user = 'rename1';
# Cleanup
###############################################################
use test;
--echo
--echo -------- switch to master -------
connection master;
DROP TEMPORARY TABLE mysqltest1.t22;
DROP DATABASE mysqltest1;

View File

@ -23,7 +23,6 @@ call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]*. cannot
### Should Stop Slave ###
##############################################
--echo *** On Slave ***
sync_slave_with_master;
STOP SLAVE;
RESET SLAVE;

View File

@ -64,7 +64,6 @@ eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
SET AUTOCOMMIT = 0;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
# We want to verify that the following transactions are written to the
@ -79,7 +78,6 @@ connection slave;
ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
SHOW CREATE TABLE mysqltest1.t1;
--echo -------- switch to master --------
connection master;
INSERT INTO mysqltest1.t1 SET f1= 1;
DROP TEMPORARY TABLE mysqltest1.tmp;
@ -98,7 +96,6 @@ SHOW CREATE TABLE mysqltest1.tmp2;
SELECT COUNT(*) FROM mysqltest1.t1;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE mysqltest1.tmp;
@ -108,7 +105,6 @@ SHOW CREATE TABLE mysqltest1.tmp2;
SELECT COUNT(*) FROM mysqltest1.t1;
FLUSH LOGS;
--echo -------- switch to master --------
connection master;
FLUSH LOGS;
DROP TEMPORARY TABLE IF EXISTS mysqltest1.tmp2;
@ -142,11 +138,9 @@ INSERT INTO t1 (b) VALUES (1),(2),(3);
BEGIN;
INSERT INTO t1(b) VALUES (4);
--echo -------- switch to master1 --------
connection master1;
--send RENAME TABLE t1 TO t3, t2 TO t1;
--echo -------- switch to master --------
connection master;
# Need to wait until RENAME is received
let $wait_condition=
@ -157,23 +151,19 @@ let $wait_condition=
COMMIT;
--echo -------- switch to master1 --------
connection master1;
--reap
--echo -------- switch to master --------
connection master;
SELECT * FROM t1;
SELECT * FROM t3;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
SELECT * FROM t1;
SELECT * FROM t3;
--echo -------- switch to master --------
connection master;
DROP TABLE t1;
DROP TABLE t3;

View File

@ -197,7 +197,6 @@ DROP TABLE t1;
-- eval LOAD DATA $lock_option LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/loaddata5.dat' INTO TABLE t1
-- echo ### create connection without default database
-- echo ### connect (conn2,localhost,root,,*NO-ONE*);
connect (conn2,localhost,root,,*NO-ONE*);
-- connection conn2
-- echo ### assertion: works without stating the default database
@ -216,7 +215,6 @@ connect (conn2,localhost,root,,*NO-ONE*);
-- let $table= $db1.t1
--source include/wait_until_rows_count.inc
-- echo ### disconnect and switch back to master connection
-- disconnect conn2
-- connection master

View File

@ -216,7 +216,7 @@ if (`select char_length('$bit_field_special') > 0`) {
connection master;
eval CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = $type ;
sync_slave_with_master;
--echo --- on slave: original values ---
--echo --- original values ---
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
SELECT * FROM t7 ORDER BY C1;
@ -226,13 +226,13 @@ SELECT * FROM t7 ORDER BY C1;
set @@global.slave_exec_mode= 'IDEMPOTENT';
connection master;
--echo --- on master: new values inserted ---
--echo --- new values inserted ---
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
SELECT * FROM t7 ORDER BY C1;
sync_slave_with_master;
set @@global.slave_exec_mode= default;
--echo --- on slave: old values should be overwritten by replicated values ---
--echo --- old values should be overwritten by replicated values ---
SELECT * FROM t7 ORDER BY C1;
#
@ -240,7 +240,6 @@ SELECT * FROM t7 ORDER BY C1;
# causing a conflict for a key that is not "last".
#
connection master;
--echo --- on master ---
eval CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = $type ;
# First we make sure that the constraints are correctly set.
@ -254,7 +253,6 @@ INSERT INTO t8 VALUES (11,22,99);
SELECT * FROM t8 ORDER BY a;
sync_slave_with_master;
--echo --- on slave ---
SELECT * FROM t8 ORDER BY a;
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
SELECT * FROM t8 ORDER BY a;
@ -265,14 +263,12 @@ SELECT * FROM t8 ORDER BY a;
set @@global.slave_exec_mode= 'IDEMPOTENT';
connection master;
--echo --- on master ---
# We insert a row that will cause conflict on the primary key but not
# on the other keys.
INSERT INTO t8 VALUES (2,4,8);
sync_slave_with_master;
set @@global.slave_exec_mode= default;
--echo --- on slave ---
SELECT * FROM t8 ORDER BY a;
# BUG#31552: Replication breaks when deleting rows from out-of-sync
@ -280,7 +276,6 @@ SELECT * FROM t8 ORDER BY a;
--echo **** Test for BUG#31552 ****
--echo **** On Master ****
# Clean up t1 so that we can use it.
connection master;
DELETE FROM t1;
@ -289,10 +284,8 @@ sync_slave_with_master;
# Just to get a clean binary log
--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
--echo **** On Master ****
sync_slave_with_master;
# since bug#31552/31609 idempotency is not default any longer. In order
# the following test DELETE FROM t1 to pass the mode is switched
@ -313,14 +306,12 @@ query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
# (regression test)
--echo **** Test for BUG#37076 ****
--echo **** On Master ****
connection master;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
INSERT INTO t1 VALUES(
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
--echo **** On Slave ****
sync_slave_with_master slave;
SELECT * FROM t1;

View File

@ -22,25 +22,16 @@ BEGIN
END|
delimiter ;|
let $message=< ---- Master selects-- >;
--source include/show_msg.inc
CALL test.p1(12);
SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
sync_slave_with_master;
SELECT * FROM test.t1;
let $message=< ---- Master selects-- >;
--source include/show_msg.inc
connection master;
CALL test.p1(13);
SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
sync_slave_with_master;
SELECT * FROM test.t1;

View File

@ -78,7 +78,6 @@ INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
--echo **** On Master ****
connection master;
INSERT INTO t1_int VALUES (1,2);
INSERT INTO t1_int VALUES (2,5);
@ -89,7 +88,6 @@ INSERT INTO t1_char VALUES (2,5);
SELECT * FROM t1_int ORDER BY a;
SELECT * FROM t1_bit ORDER BY a;
SELECT * FROM t1_char ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
set @@global.slave_exec_mode= default;
@ -97,7 +95,6 @@ SELECT a,b,x FROM t1_int ORDER BY a;
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
SELECT a,b,x FROM t1_char ORDER BY a;
--echo **** On Master ****
connection master;
UPDATE t1_int SET b=2*b WHERE a=2;
UPDATE t1_char SET b=2*b WHERE a=2;
@ -105,7 +102,6 @@ UPDATE t1_bit SET b=2*b WHERE a=2;
SELECT * FROM t1_int ORDER BY a;
SELECT * FROM t1_bit ORDER BY a;
SELECT * FROM t1_char ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
SELECT a,b,x FROM t1_int ORDER BY a;
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
@ -132,11 +128,9 @@ INSERT INTO t9 VALUES (2);
sync_slave_with_master;
# Now slave is guaranteed to be running
connection master;
--echo **** On Master ****
INSERT INTO t2 VALUES (2,4);
SELECT * FROM t2;
sync_slave_with_master;
--echo **** On Slave ****
SELECT * FROM t2;
--source include/check_slave_is_running.inc
@ -200,7 +194,6 @@ SELECT * FROM t8 ORDER BY a;
# update should not generate an error even though there is no default
# for the extra column.
--echo **** On Master ****
connection master;
TRUNCATE t1_nodef;
SET SQL_LOG_BIN=0;
@ -209,26 +202,21 @@ INSERT INTO t1_nodef VALUES (2,4);
SET SQL_LOG_BIN=1;
sync_slave_with_master;
--echo **** On Slave ****
connection slave;
INSERT INTO t1_nodef VALUES (1,2,3,4,5);
INSERT INTO t1_nodef VALUES (2,4,6,8,10);
--echo **** On Master ****
connection master;
UPDATE t1_nodef SET b=2*b WHERE a=1;
SELECT * FROM t1_nodef ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1_nodef ORDER BY a;
--echo **** On Master ****
connection master;
DELETE FROM t1_nodef WHERE a=2;
SELECT * FROM t1_nodef ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
SELECT * FROM t1_nodef ORDER BY a;

View File

@ -140,11 +140,11 @@ CREATE TABLE t1 (a INT );
sync_slave_with_master;
--connection slave1
--echo # Slave1: lock table for synchronization
--echo # lock table for synchronization
LOCK TABLES t1 WRITE;
--connection master
--echo # Master: insert into the table
--echo # insert into the table
INSERT INTO t1 SELECT SLEEP(4);
--connection slave
@ -155,11 +155,11 @@ let $wait_condition=
AND INFO = "INSERT INTO t1 SELECT SLEEP(4)";
--source include/wait_condition.inc
--echo # Slave: send slave stop
--echo # send slave stop
--send STOP SLAVE
--connection slave1
--echo # Slave1: wait for stop slave
--echo # wait for stop slave
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO = "STOP SLAVE";
@ -169,7 +169,7 @@ let $wait_condition=
UNLOCK TABLES;
--connection slave
--echo # Slave: wait for the slave to stop
--echo # wait for the slave to stop
--reap
--source include/wait_for_slave_to_stop.inc

View File

@ -15,8 +15,6 @@ if (!$tmp_table_stm)
--die $tmp_table_stm is NULL
}
--echo
--echo [ On Master ]
connection master;
BEGIN;
DELETE FROM t1;
@ -25,8 +23,6 @@ INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE tt1;
COMMIT;
--echo
--echo [ On Slave ]
connection slave;
# To check if slave SQL thread is applying INSERT statement
@ -37,16 +33,12 @@ source include/wait_show_condition.inc;
send STOP SLAVE SQL_THREAD;
--echo
--echo [ On Slave1 ]
connection slave1;
--echo # To resume slave SQL thread
SET DEBUG_SYNC= 'now SIGNAL signal.continue';
SET DEBUG_SYNC= 'now WAIT_FOR signal.continued';
SET DEBUG_SYNC= 'RESET';
--echo
--echo [ On Slave ]
connection slave;
reap;
source include/wait_for_slave_sql_to_stop.inc;

View File

@ -62,8 +62,7 @@ while ($masters)
--let $masters= `SELECT SUBSTRING('$masters', LENGTH('$master_i') + 2)`
# Connect to master and execute statement
--let $rpl_connection_name= server_$master_i
--source include/rpl_connection.inc
connection server_$master_i;
DELETE FROM t1;
--eval INSERT INTO t1 VALUES ($next_number)
}

View File

@ -1,11 +1,9 @@
--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
eval CREATE TABLE t1 (a INT, b LONG) ENGINE=$engine;
INSERT INTO t1 VALUES (1,1), (2,2);
sync_slave_with_master;
--echo **** On Master ****
connection master;
eval $trunc_stmt t1;
sync_slave_with_master;
@ -14,13 +12,11 @@ let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo ==== Test using a table with delete triggers ====
--echo **** On Master ****
connection master;
SET @count := 1;
eval CREATE TABLE t2 (a INT, b LONG) ENGINE=$engine;
CREATE TRIGGER trg1 BEFORE DELETE ON t1 FOR EACH ROW SET @count := @count + 1;
sync_slave_with_master;
--echo **** On Master ****
connection master;
eval $trunc_stmt t1;
sync_slave_with_master;

View File

@ -2,16 +2,12 @@
--echo
SHOW GRANTS FOR mysqltest_u1@localhost;
--echo
--echo # connection: con1 (mysqltest_u1@mysqltest_db1)
--connect (con1,localhost,mysqltest_u1,,mysqltest_db1)
--connection con1
--echo
SHOW CREATE TABLE t1;
--echo
--echo # connection: default
--connection default
--disconnect con1

View File

@ -64,7 +64,6 @@ drop table if exists t1;
--echo **
--echo ** two UPDATE's running and both changing distinct result sets
--echo **
--echo ** connection thread1
connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -84,7 +83,6 @@ drop table if exists t1;
--echo ** Get user level lock (ULL) for thread 1
select get_lock("hello",10);
--echo ** connection thread2
connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Start transaction for thread 2
@ -93,7 +91,6 @@ drop table if exists t1;
--echo ** be created and blocked on the first row where tipo=11.
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
@ -121,7 +118,6 @@ drop table if exists t1;
--echo ** Table is now updated with a new eta on tipo=22 for thread 1.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Release the lock and collect result from update on thread 2
reap;
@ -134,7 +130,6 @@ drop table if exists t1;
--echo ** Sending commit on thread 2.
commit;
--echo ** connection thread1
connection thread1;
--echo ** Make sure table reads didn't change yet on thread 1.
select * from t1;
@ -144,16 +139,13 @@ drop table if exists t1;
--echo ** thread 1,2.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Make sure the output is similar for t1.
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -162,7 +154,6 @@ drop table t1;
--echo **
--echo ** two UPDATE's running and one changing result set
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -182,7 +173,6 @@ drop table t1;
--echo ** Get ULL "hello" on thread 1
select get_lock("hello",10);
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Start transaction on thread 2
@ -192,7 +182,6 @@ drop table t1;
--echo ** blocking ULL is released.
send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
@ -219,7 +208,6 @@ drop table t1;
--echo ** The table should still be updated with updates for thread 1 only:
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Release the lock and collect result from thread 2:
reap;
@ -231,7 +219,6 @@ drop table t1;
select * from t1;
commit;
--echo ** connection thread1
connection thread1;
--echo ** Thread 2 has committed but the result should remain the same for
--echo ** thread 1 (updated on three places):
@ -242,15 +229,12 @@ drop table t1;
--echo ** This select should show both updates:
select * from t1;
--echo ** connection thread2
connection thread2;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -259,7 +243,6 @@ drop table t1;
--echo **
--echo ** One UPDATE and one INSERT .... Monty's test
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -269,7 +252,6 @@ drop table t1;
--echo ** Create ULL 'hello2'
select get_lock("hello2",10);
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Begin a new transaction on thread 2
@ -278,7 +260,6 @@ drop table t1;
--echo ** this will hang waiting on thread 1.
send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
--echo ** connection thread1
connection thread1;
let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock';
--source include/wait_condition.inc
@ -292,7 +273,6 @@ drop table t1;
--echo ** ..but thread 1 will still see t1 as if nothing has happend:
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** Collect results from thread 2 and release the lock.
reap;
@ -305,7 +285,6 @@ drop table t1;
--echo ** Commit changes from thread 2
commit;
--echo ** connection default
connection default;
drop table t1;
@ -314,7 +293,6 @@ drop table t1;
--echo **
--echo ** one UPDATE changing result set and SELECT ... FOR UPDATE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -332,7 +310,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Begin a new transaction on thread 2
@ -340,7 +317,6 @@ drop table t1;
--echo ** Select a range for update.
select * from t1 where tipo=2 FOR UPDATE;
--echo ** connection thread1
connection thread1;
--echo ** Begin a new transaction on thread 1
begin;
@ -352,7 +328,6 @@ drop table t1;
--echo ** transaction failed and was rolled back.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** The table should look unmodified from thread 2.
select * from t1;
@ -360,22 +335,18 @@ drop table t1;
--echo ** thread 1 to complete the transaction.
commit;
--echo ** connection thread1
connection thread1;
--echo ** Commit on thread 1.
commit;
--echo ** connection thread2
connection thread2;
--echo ** The table should not have been changed.
select * from t1;
--echo ** connection thread1
connection thread1;
--echo ** Even on thread 1:
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -384,7 +355,6 @@ drop table t1;
--echo **
--echo ** one UPDATE not changing result set and SELECT ... FOR UPDATE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -402,7 +372,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Starting new transaction on thread 2.
@ -410,7 +379,6 @@ drop table t1;
--echo ** Starting SELECT .. FOR UPDATE
select * from t1 where tipo=2 FOR UPDATE;
--echo ** connection thread1
connection thread1;
--echo
--echo ** Starting new transaction on thread 1
@ -433,28 +401,23 @@ drop table t1;
--echo ** have changed.
select * from t1;
--echo ** connection thread2
connection thread2;
--echo ** The same thing should hold true for the transaction on
--echo ** thread 2
select * from t1;
send commit;
--echo ** connection thread1
connection thread1;
commit;
--echo ** connection thread2
connection thread2;
--echo ** Even after committing:
reap;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -463,7 +426,6 @@ drop table t1;
--echo **
--echo ** two SELECT ... FOR UPDATE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -481,14 +443,12 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
--echo ** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
--echo ** connection thread1
connection thread1;
--echo ** Begin a new transaction on thread 1
begin;
@ -497,7 +457,6 @@ drop table t1;
--error ER_LOCK_WAIT_TIMEOUT
select * from t1 where tipo=1 FOR UPDATE;
--echo ** connection thread2
connection thread2;
--echo ** Table will be unchanged and the select command will not be
--echo ** blocked:
@ -505,22 +464,18 @@ drop table t1;
--echo ** Commit transacton on thread 2.
commit;
--echo ** connection thread1
connection thread1;
--echo ** Commit transaction on thread 1.
commit;
--echo ** connection thread2
connection thread2;
--echo ** Make sure table isn't blocked on thread 2:
select * from t1;
--echo ** connection thread1
connection thread1;
--echo ** Make sure table isn't blocked on thread 1:
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -529,7 +484,6 @@ drop table t1;
--echo **
--echo ** one UPDATE changing result set and DELETE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -547,7 +501,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
begin;
@ -557,33 +510,27 @@ drop table t1;
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
sleep 1;
--echo ** connection thread1
connection thread1;
begin;
--error ER_LOCK_WAIT_TIMEOUT
update t1 set tipo=1 where tipo=2;
select * from t1;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
send commit;
--echo ** connection thread1
connection thread1;
commit;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
--echo ** connection default
connection default;
drop table t1;
@ -592,7 +539,6 @@ drop table t1;
--echo **
--echo ** one UPDATE not changing result set and DELETE
--echo **
--echo ** connection thread1
#connect (thread1, localhost, mysqltest,,);
connection thread1;
--echo ** Set up table
@ -610,7 +556,6 @@ drop table t1;
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
--echo ** connection thread2
#connect (thread2, localhost, mysqltest,,);
connection thread2;
begin;
@ -620,7 +565,6 @@ drop table t1;
# 'innodb_deleted_rows' and infos in processlist where not sucessful.
sleep 1;
--echo ** connection thread1
connection thread1;
begin;
--echo ** Update on t1 will cause a table scan which will be blocked because
@ -639,22 +583,18 @@ drop table t1;
}
select * from t1;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
send commit;
--echo ** connection thread1
connection thread1;
commit;
--echo ** connection thread2
connection thread2;
reap;
select * from t1;
--echo ** connection thread1
connection thread1;
select * from t1;
@ -662,11 +602,9 @@ drop table t1;
connection thread1;
disconnect thread1;
--source include/wait_until_disconnected.inc
--echo ** connection thread2
connection thread2;
disconnect thread2;
--source include/wait_until_disconnected.inc
--echo ** connection default
connection default;
drop table t1;
drop user mysqltest@localhost;

View File

@ -10,9 +10,7 @@
# main code went into include/deadlock.inc
#
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
--disable_warnings
@ -23,14 +21,12 @@ drop table if exists t1,t2;
# Testing of FOR UPDATE
#
--echo # Switch to connection con1
connection con1;
eval create table t1 (id integer, x integer) engine = $engine_type;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
--echo # Switch to connection con2
connection con2;
set autocommit=0;
@ -39,18 +35,15 @@ set autocommit=0;
update t1 set x=2 where id = 0;
--sleep 2
--echo # Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
commit;
--echo # Switch to connection con2
connection con2;
reap;
commit;
--echo # Switch to connection con1
connection con1;
select * from t1;
commit;
@ -60,7 +53,6 @@ drop table t1;
# Testing of FOR UPDATE
#
--echo # Switch to connection con1
connection con1;
eval create table t1 (id integer, x integer) engine = $engine_type;
eval create table t2 (b integer, a integer) engine = $engine_type;
@ -73,7 +65,6 @@ update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
select * from t2;
select * from t1;
--echo # Switch to connection con2
connection con2;
set autocommit=0;
@ -82,18 +73,15 @@ set autocommit=0;
update t1 set x=2 where id = 0;
--sleep 2
--echo # Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
commit;
--echo # Switch to connection con2
connection con2;
reap;
commit;
--echo # Switch to connection con1
connection con1;
select * from t1;
commit;
@ -105,13 +93,11 @@ insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30);
commit;
--echo # Switch to connection con1
connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
select * from t2;
select * from t1;
--echo # Switch to connection con2
connection con2;
# The following query should hang because con1 is locking the record
@ -121,24 +107,20 @@ select * from t2;
update t1 set x=2 where id = 0;
--sleep 2
--echo # Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
commit;
--echo # Switch to connection con2
connection con2;
reap;
commit;
--echo # Switch to connection con1
connection con1;
select * from t1;
commit;
# Cleanup
--echo # Switch to connection default + disconnect con1 and con2
connection default;
disconnect con1;
disconnect con2;

View File

@ -51,7 +51,6 @@ set GLOBAL query_cache_size=1355776;
reset query cache;
flush status;
--echo ----- establish connection root -----
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
show grants for current_user;
@ -67,7 +66,6 @@ insert into mysqltest.t2 values (3,3,3);
create table test.t1 (a char (10));
insert into test.t1 values ("test.t1");
select * from t1;
--echo ----- establish connection root2 -----
connect (root2,localhost,root,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root2;
# put queries in cache
@ -86,7 +84,6 @@ grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
# The following queries should be fetched from cache
--echo ----- establish connection user1 (user=mysqltest_1) -----
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
show grants for current_user();
@ -112,14 +109,12 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached";
--echo ----- establish connection unkuser (user=unkuser) -----
# Don't use '' as user because it will pick Unix login
connect (unkuser,localhost,unkuser,,,$MASTER_MYPORT,$MASTER_MYSOCK);
connection unkuser;
show grants for current_user();
# The following queries should be fetched from cache
--echo ----- establish connection user2 (user=mysqltest_2) -----
connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user2;
select "user2";
@ -135,7 +130,6 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached";
# The following queries should not be fetched from cache
--echo ----- establish connection user3 (user=mysqltest_3) -----
connect (user3,localhost,mysqltest_3,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user3;
select "user3";
@ -157,7 +151,6 @@ show status like "Qcache_hits";
show status like "Qcache_not_cached";
# Connect without a database
--echo ----- establish connection user4 (user=mysqltest_1) -----
connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user4;
select "user4";
@ -175,7 +168,6 @@ show status like "Qcache_not_cached";
# Cleanup
--echo ----- close connections -----
connection root;
disconnect root;
--source include/wait_until_disconnected.inc
@ -197,7 +189,6 @@ disconnect user4;
connection unkuser;
disconnect unkuser;
--source include/wait_until_disconnected.inc
--echo ----- switch to connection default -----
connection default;
#

View File

@ -647,23 +647,19 @@ CREATE TABLE t2 (a INT) ENGINE=InnoDB;
CONNECT (c1,localhost,root,,);
CONNECT (c2,localhost,root,,);
--echo switch to connection c1
CONNECTION c1;
SET AUTOCOMMIT=0;
INSERT INTO t2 VALUES (1);
--echo switch to connection c2
CONNECTION c2;
SET AUTOCOMMIT=0;
--error ER_LOCK_WAIT_TIMEOUT
LOCK TABLES t1 READ, t2 READ;
--echo switch to connection c1
CONNECTION c1;
COMMIT;
INSERT INTO t1 VALUES (1);
--echo switch to connection default
CONNECTION default;
SET AUTOCOMMIT=default;
DISCONNECT c1;
@ -1327,7 +1323,6 @@ connect (con2,localhost,root,,);
SET SESSION AUTOCOMMIT = 0;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
set binlog_format=mixed;
--echo # Switch to connection con1
connection con1;
eval
@ -1343,7 +1338,6 @@ UPDATE t1 SET b = 12 WHERE a = 1;
--disable_info
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--enable_info
@ -1352,16 +1346,13 @@ connection con2;
UPDATE t1 SET b = 21 WHERE a = 1;
--disable_info
--echo # Switch to connection con1
connection con1;
SELECT * FROM t1;
ROLLBACK;
--echo # Switch to connection con2
connection con2;
ROLLBACK;
--echo # Switch to connection con1
connection con1;
--echo # 2. test for serialized update:
@ -1395,12 +1386,10 @@ UPDATE t1 SET b = CONCAT(b, '+con1') WHERE a = 1;
--disable_info
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--send CALL p1;
--echo # Switch to connection con1
connection con1;
SELECT * FROM t1;
COMMIT;
@ -1413,13 +1402,11 @@ while ($bug31310)
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--reap
SELECT * FROM t1;
COMMIT;
--echo # Switch to connection con1
connection con1;
--echo # 3. test for updated key column:
@ -1435,12 +1422,10 @@ UPDATE t1 SET a = 2, b = CONCAT(b, '+con1') WHERE a = 1;
--disable_info
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--send CALL p1;
--echo # Switch to connection con1
connection con1;
SELECT * FROM t1;
COMMIT;
@ -1453,7 +1438,6 @@ while ($bug31310)
SELECT * FROM t1;
--echo # Switch to connection con2
connection con2;
--reap
SELECT * FROM t1;
@ -1616,23 +1600,18 @@ eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
INSERT INTO t1 VALUES (1),(2),(3);
BEGIN;
SELECT * FROM t1 ORDER BY a;
--echo # Connection con1
connect (con1, localhost, root,,);
--send TRUNCATE TABLE t1;
--echo # Connection default
connection default;
let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist
WHERE state='Waiting for table metadata lock' AND info='TRUNCATE TABLE t1';
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY a;
ROLLBACK;
--echo # Connection con1
connection con1;
--echo # Reaping TRUNCATE TABLE
--reap
SELECT * FROM t1;
--echo # Disconnect con1
disconnect con1;
--echo # Connection default
connection default;
DROP TABLE t1;

View File

@ -124,7 +124,6 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
SET @@autocommit=1;
connection default;
--echo connection default
# This should be 'YES'.
SHOW VARIABLES LIKE 'have_query_cache';
@ -142,7 +141,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection connection1;
--echo connection connection1
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
INSERT INTO t2 VALUES (5,'w');
@ -153,7 +151,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection default;
--echo connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
COMMIT;
@ -163,7 +160,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
show status like "Qcache_queries_in_cache";
connection connection1;
--echo connection connection1
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
START TRANSACTION;
@ -172,7 +168,6 @@ INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
connection default;
--echo connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
@ -181,7 +176,6 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
COMMIT;
connection connection1;
--echo connection connection1
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';

View File

@ -23,9 +23,7 @@
set GLOBAL query_cache_type=ON;
set LOCAL query_cache_type=ON;
--echo ---- establish connection con1 (root) ----
connect (con1,localhost,root,,test,$MASTER_MYPORT,);
--echo ---- switch to connection default ----
connection default;
set @initial_query_cache_size = @@global.query_cache_size;
@ -55,7 +53,6 @@ show status like 'Qcache_hits';
execute stmt2;
show status like 'Qcache_hits';
# Another prepared statement (same text, other connection), should hit the QC
--echo ---- switch to connection con1 ----
connection con1;
prepare stmt3 from "select * from t1 where c1=10";
execute stmt3;
@ -64,7 +61,6 @@ execute stmt3;
show status like 'Qcache_hits';
execute stmt3;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
# Mixup tests, where statements without PREPARE.../EXECUTE.... meet statements
@ -89,20 +85,16 @@ execute stmt10;
show status like 'Qcache_hits';
eval $my_stmt;
show status like 'Qcache_hits';
--echo ---- switch to connection con1 ----
connection con1;
eval $my_stmt;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
#
# Statement without PREPARE.../EXECUTE.... first
let $my_stmt= SELECT * FROM t1 WHERE c1 = 1;
eval prepare stmt11 from "$my_stmt";
--echo ---- switch to connection con1 ----
connection con1;
eval prepare stmt12 from "$my_stmt";
--echo ---- switch to connection default ----
connection default;
eval $my_stmt;
show status like 'Qcache_hits';
@ -110,11 +102,9 @@ eval $my_stmt;
show status like 'Qcache_hits';
execute stmt11;
show status like 'Qcache_hits';
--echo ---- switch to connection con1 ----
connection con1;
execute stmt12;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
# Query caching also works when statement has parameters
@ -127,7 +117,6 @@ execute stmt1 using @a;
show status like 'Qcache_hits';
execute stmt1 using @a;
show status like 'Qcache_hits';
--echo ---- switch to connection con1 ----
connection con1;
set @a=1;
prepare stmt4 from "select * from t1 where c1=?";
@ -139,7 +128,6 @@ execute stmt4 using @a;
show status like 'Qcache_hits';
execute stmt4 using @a;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
# See if enabling/disabling the query cache between PREPARE and
@ -168,7 +156,6 @@ execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
# Expect to see no additional Qcache_hits.
--echo ---- switch to connection con1 ----
connection con1;
execute stmt3;
show status like 'Qcache_hits';
@ -178,7 +165,6 @@ execute stmt3;
show status like 'Qcache_hits';
#
# then QC is re-enabled for more EXECUTE.
--echo ---- switch to connection default ----
connection default;
set global query_cache_size=102400;
# Expect to see additional Qcache_hits.
@ -193,7 +179,6 @@ show status like 'Qcache_hits';
execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
--echo ---- switch to connection con1 ----
connection con1;
execute stmt3;
show status like 'Qcache_hits';
@ -201,7 +186,6 @@ execute stmt3;
show status like 'Qcache_hits';
execute stmt3;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
#
# then QC is re-disabled for more EXECUTE.
@ -216,7 +200,6 @@ show status like 'Qcache_hits';
execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
--echo ---- switch to connection con1 ----
connection con1;
execute stmt3;
show status like 'Qcache_hits';
@ -226,15 +209,12 @@ execute stmt3;
show status like 'Qcache_hits';
#
--echo ---- switch to connection default ----
connection default;
# QC is disabled at PREPARE
set global query_cache_size=0;
prepare stmt1 from "select * from t1 where c1=10";
--echo ---- switch to connection con1 ----
connection con1;
prepare stmt3 from "select * from t1 where c1=10";
--echo ---- switch to connection default ----
connection default;
# then QC is enabled at EXECUTE
set global query_cache_size=102400;
@ -246,7 +226,6 @@ show status like 'Qcache_hits';
execute stmt1;
show status like 'Qcache_hits';
# The QC is global = affects also other connections.
--echo ---- switch to connection con1 ----
connection con1;
show status like 'Qcache_hits';
execute stmt3;
@ -255,7 +234,6 @@ execute stmt3;
show status like 'Qcache_hits';
execute stmt3;
show status like 'Qcache_hits';
--echo ---- switch to connection default ----
connection default;
#
# QC is disabled at PREPARE
@ -276,7 +254,6 @@ show status like 'Qcache_hits';
drop table t1;
--echo ---- disconnect connection con1 ----
disconnect con1;
#

View File

@ -51,7 +51,9 @@ if ($rpl_debug)
{
--echo connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,)
}
disable_connect_log;
--connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,)
enable_connect_log;
--let $include_filename= rpl_connect.inc

View File

@ -43,5 +43,7 @@ if ($_include_file_depth)
--echo [connection $rpl_connection_name]
}
}
disable_connect_log;
--connection $rpl_connection_name
enable_connect_log;
--let $rpl_connection_name=

View File

@ -1,2 +0,0 @@
let $rpl_connection_name= master;
source include/rpl_connection.inc;

View File

@ -1,2 +0,0 @@
let $rpl_connection_name= slave;
source include/rpl_connection.inc;

View File

@ -1,2 +0,0 @@
let $rpl_connection_name= slave1;
source include/rpl_connection.inc;

View File

@ -1,13 +1,9 @@
--echo connect (master,$IPv6,root,,test,MASTER_MYPORT);
connect (master,$IPv6,root,,test,$MASTER_MYPORT);
--echo connect (slave,127.0.0.1,root,,test,SLAVE_MYPORT);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT);
--echo connection master;
connection master;
reset master;
source include/show_master_status.inc;
save_master_pos;
--echo connection slave;
connection slave;
reset slave;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
@ -15,10 +11,7 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
eval change master to master_host='$IPv6';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
--echo Master-Host: $master_host
--echo disconnect slave;
disconnect slave;
--echo disconnect master;
disconnect master;
--echo connection default;
connection default;

View File

@ -1,13 +1,9 @@
--echo connect (master,127.0.0.1,root,,test,MASTER_MYPORT);
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT);
--echo connect (slave,$IPv6,root,,test,SLAVE_MYPORT);
connect (slave,$IPv6,root,,test,$SLAVE_MYPORT);
--echo connection master;
connection master;
reset master;
source include/show_master_status.inc;
save_master_pos;
--echo connection slave;
connection slave;
reset slave;
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
@ -15,10 +11,7 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
eval change master to master_host='$IPv6';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
--echo Master-Host: $master_host
--echo disconnect slave;
disconnect slave;
--echo disconnect master;
disconnect master;
--echo connection default;
connection default;

View File

@ -1,22 +1,15 @@
--echo connect (master,$IPv6,root,,test,MASTER_MYPORT);
connect (master,$IPv6,root,,test,$MASTER_MYPORT);
--echo connect (slave,$IPv6,root,,test,SLAVE_MYPORT);
connect (slave,$IPv6,root,,test,$SLAVE_MYPORT);
--echo connection master;
connection master;
reset master;
source include/show_master_status.inc;
save_master_pos;
--echo connection slave;
connection slave;
reset slave;
eval change master to master_host='$IPv6';
let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
--echo Master-Host: $master_host
--echo disconnect slave;
disconnect slave;
--echo disconnect master;
disconnect master;
--echo connection default;
connection default;

View File

@ -19,12 +19,10 @@ if ($LOAD_LOCAL)
}
save_master_pos;
echo ----------content on master----------;
SELECT hex(cl) FROM t;
connection slave;
sync_with_master;
echo ----------content on slave----------;
USE mysqltest;
SELECT hex(cl) FROM t;

View File

@ -70,8 +70,6 @@ let $_log_num_s= `select @aux`;
###############################################################
# INSERT
###############################################################
--echo
--echo -------- switch to master -------
connection master;
# Maybe it would be smarter to use a table with an autoincrement column.
let $MAX= `SELECT MAX(f1) FROM t1` ;
@ -85,8 +83,6 @@ if ($show_binlog)
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# results before DDL(to be tested)
SELECT MAX(f1) FROM t1;
@ -99,8 +95,6 @@ if ($show_binlog)
###############################################################
# command to be tested
###############################################################
--echo
--echo -------- switch to master -------
connection master;
eval $my_stmt;
# Devaluate $my_stmt, to detect script bugs
@ -114,8 +108,6 @@ if ($show_binlog)
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# results after DDL(to be tested)
SELECT MAX(f1) FROM t1;
@ -128,8 +120,6 @@ if ($show_binlog)
###############################################################
# ROLLBACK
###############################################################
--echo
--echo -------- switch to master -------
connection master;
ROLLBACK;
# results after final ROLLBACK
@ -151,8 +141,6 @@ if ($show_binlog)
}
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# results after final ROLLBACK
SELECT MAX(f1) FROM t1;
@ -181,16 +169,12 @@ if ($manipulate)
# - flush the master and the slave log
# ---> both start to write into new logs with incremented number
# - increment $_log_num_n
--echo
--echo -------- switch to master -------
connection master;
flush logs;
# sleep 1;
# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s';
sync_slave_with_master;
--echo
--echo -------- switch to slave --------
connection slave;
# the final content of the binary log
flush logs;
@ -202,6 +186,4 @@ flush logs;
inc $_log_num_n;
}
--echo
--echo -------- switch to master -------
connection master;

View File

@ -81,7 +81,9 @@ while ($_rpl_i) {
}
if ($rpl_only_running_threads)
{
disable_connect_log;
--connection server_$_rpl_server
enable_connect_log;
--let $_rpl_slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
--let $_rpl_slave_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1)
if ($rpl_debug)
@ -92,7 +94,9 @@ while ($_rpl_i) {
--let $_rpl_slave_sql_running= `SELECT IF('$_rpl_slave_sql_running' = 'Yes', 1, '')`
if ($_rpl_slave_io_running)
{
disable_query_log;
--connection server_$_rpl_prev_server
enable_query_log;
if ($_rpl_slave_sql_running)
{
if ($rpl_debug)
@ -101,7 +105,9 @@ while ($_rpl_i) {
--let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
--echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos'
}
disable_connect_log;
--sync_slave_with_master server_$_rpl_server
enable_connect_log;
}
if (!$_rpl_slave_sql_running)
{
@ -119,6 +125,7 @@ while ($_rpl_i) {
}
if (!$rpl_only_running_threads)
{
disable_connect_log;
--connection server_$_rpl_prev_server
if ($rpl_debug)
{
@ -127,6 +134,7 @@ while ($_rpl_i) {
--echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos'
}
--sync_slave_with_master server_$_rpl_server
enable_connect_log;
}
}

View File

@ -30,7 +30,6 @@ drop table if exists t1;
# Test 1) Test UDFs via loadable libraries
#
--echo "*** Test 1) Test UDFs via loadable libraries ***
--echo "Running on the master"
--enable_info
--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO";
@ -48,7 +47,6 @@ connection slave;
sync_with_master;
# Check to see that UDF CREATE statements were replicated
--echo "Running on the slave"
--enable_info
--replace_column 3 UDF_LIB
SELECT * FROM mysql.func ORDER BY name;
@ -57,7 +55,6 @@ SELECT * FROM mysql.func ORDER BY name;
connection master;
# Use the UDFs to do something
--echo "Running on the master"
--enable_info
eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
--disable_warnings
@ -72,7 +69,6 @@ SELECT * FROM t1 ORDER BY sum;
sync_slave_with_master;
# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT * FROM t1 ORDER BY sum;
@ -84,7 +80,6 @@ SELECT myfunc_double(75.00);
connection master;
# Drop the functions
--echo "Running on the master"
--enable_info
DROP FUNCTION myfunc_double;
DROP FUNCTION myfunc_int;
@ -94,7 +89,6 @@ SELECT * FROM mysql.func ORDER BY name;
sync_slave_with_master;
# Check to see if the UDFs were dropped on the slave
--echo "Running on the slave"
--enable_info
SELECT * FROM mysql.func ORDER BY name;
--disable_info
@ -102,7 +96,6 @@ SELECT * FROM mysql.func ORDER BY name;
connection master;
# Cleanup
--echo "Running on the master"
--enable_info
DROP TABLE t1;
--disable_info
@ -111,7 +104,6 @@ DROP TABLE t1;
# Test 2) Test UDFs with SQL body
#
--echo "*** Test 2) Test UDFs with SQL body ***
--echo "Running on the master"
--enable_info
CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i;
CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00;
@ -121,7 +113,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
sync_slave_with_master;
# Check to see that UDF CREATE statements were replicated
--echo "Running on the slave"
--enable_info
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info
@ -129,7 +120,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
connection master;
# Use the UDFs to do something
--echo "Running on the master"
--enable_info
eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00));
@ -142,7 +132,6 @@ SELECT * FROM t1 ORDER BY sum;
sync_slave_with_master;
# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT * FROM t1 ORDER BY sum;
--disable_info
@ -150,7 +139,6 @@ SELECT * FROM t1 ORDER BY sum;
connection master;
# Modify the UDFs to add a comment
--echo "Running on the master"
--enable_info
ALTER FUNCTION myfuncsql_int COMMENT "This was altered.";
ALTER FUNCTION myfuncsql_double COMMENT "This was altered.";
@ -160,7 +148,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
sync_slave_with_master;
# Check to see if data was replicated
--echo "Running on the slave"
--enable_info
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
@ -172,7 +159,6 @@ SELECT myfuncsql_double(75.00);
connection master;
# Drop the functions
--echo "Running on the master"
--enable_info
DROP FUNCTION myfuncsql_double;
DROP FUNCTION myfuncsql_int;
@ -182,7 +168,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
sync_slave_with_master;
# Check to see if the UDFs were dropped on the slave
--echo "Running on the slave"
--enable_info
SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%' ORDER BY name;
--disable_info
@ -190,7 +175,6 @@ SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'te
connection master;
# Cleanup
--echo "Running on the master"
--enable_info
DROP TABLE t1;
--disable_info

View File

@ -1,9 +1,15 @@
FLUSH STATUS;
connect con1,localhost,root,,;
disconnect con1;
connection default;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
0
connect con2,localhost,root,,;
KILL CONNECTION_ID();
ERROR 70100: Connection was killed
disconnect con2;
connection default;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='aborted_clients';
VARIABLE_VALUE
1

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,8 @@
drop table if exists t1, t2;
set debug_sync='RESET';
connect addconroot, localhost, root,,;
connect addconroot2, localhost, root,,;
connection default;
create table t1 (n1 int, n2 int, n3 int,
key (n1, n2, n3),
key (n2, n3, n1),
@ -10,10 +13,15 @@ insert into t1 values (1, 2, 3);
reset master;
set debug_sync='alter_table_enable_indexes SIGNAL parked WAIT_FOR go';
alter table t1 enable keys;;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t2 values (1);
insert into t1 values (1, 1, 1);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
@ -25,36 +33,60 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert into t1 values (1, 1, 1)
master-bin.000001 # Query # # COMMIT
drop tables t1, t2;
disconnect addconroot;
disconnect addconroot2;
set debug_sync='RESET';
End of 5.0 tests
drop table if exists t1, t2, t3;
connect addconroot, localhost, root,,;
connect addconroot2, localhost, root,,;
connection default;
create table t1 (i int);
reset master;
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test1';;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t1 values ();;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
select * from t1;
c
Test1
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change c vc varchar(100) default 'Test2';;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
drop table t2;
create table t1 (i int);
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
alter table t1 change i c char(10) default 'Test3', rename to t2;;
connection addconroot;
set debug_sync='now WAIT_FOR parked';
insert into t2 values();;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot;
connection default;
select * from t2;
c
Test3
alter table t2 change c vc varchar(100) default 'Test2', rename to t1;;
connection addconroot;
connection default;
rename table t1 to t3;
disconnect addconroot;
disconnect addconroot2;
drop table t3;
set debug_sync='alter_table_before_main_binlog SIGNAL parked WAIT_FOR go';
set debug_sync='RESET';

View File

@ -1681,16 +1681,17 @@ CREATE TABLE t1(a INT PRIMARY KEY, b INT);
INSERT INTO t1 VALUES (1,1), (2,2);
START TRANSACTION;
INSERT INTO t1 VALUES (3,3);
# Connection con1
connect con1, localhost, root;
# Sending:
ALTER TABLE t1 DISABLE KEYS;
# Connection default
connection default;
# Waiting until ALTER TABLE is blocked.
UPDATE t1 SET b = 4;
COMMIT;
# Connection con1
connection con1;
# Reaping: ALTER TABLE t1 DISABLE KEYS
# Connection default
disconnect con1;
connection default;
DROP TABLE t1;
#
# 7: Which operations require copy and which can be done in-place?

View File

@ -242,6 +242,8 @@ insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
select database();
database()
test
connect con1,localhost,root,,*NO-ONE*;
connection con1;
select database();
database()
NULL
@ -265,6 +267,8 @@ ANALYZE
}
}
}
disconnect con1;
connection default;
drop table t1;
#
# MDEV-7812: ANALYZE FORMAT=JSON UPDATE/DELETE doesnt print

View File

@ -1,12 +1,17 @@
create table t1 (f int, key(f)) engine=myisam;
set global kc1.key_buffer_size = 65536;
connect con1, localhost, root;
set debug_sync='assign_key_cache_op_unlock wait_for op_locked';
cache index t1 in kc1;
connection default;
set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned';
cache index t1 in kc1;
connection con1;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
set debug_sync='now signal assigned';
disconnect con1;
connection default;
Table Op Msg_type Msg_text
test.t1 assign_to_keycache status OK
drop table t1;

View File

@ -1,8 +1,11 @@
INSTALL SONAME 'auth_named_pipe';
CREATE USER 'USERNAME' IDENTIFIED WITH named_pipe;
connect pipe_con,localhost,$USERNAME,,,,,PIPE;
SELECT USER(),CURRENT_USER();
USER() CURRENT_USER()
USERNAME@localhost USERNAME@%
disconnect pipe_con;
connection default;
DROP USER 'USERNAME';
CREATE USER nosuchuser IDENTIFIED WITH named_pipe;
ERROR 28000: Access denied for user 'nosuchuser'@'localhost'

View File

@ -1,16 +1,18 @@
include/master-slave.inc
[connection master]
[connection slave]
connection slave;
include/stop_slave.inc
[connection master]
connection master;
CREATE USER 'plug_user' IDENTIFIED WITH 'test_plugin_server' AS 'plug_user';
GRANT REPLICATION SLAVE ON *.* TO plug_user;
FLUSH PRIVILEGES;
[connection slave]
connection slave;
CHANGE MASTER TO
MASTER_USER= 'plug_user',
MASTER_PASSWORD= 'plug_user';
include/start_slave.inc
connection master;
connection slave;
# Slave in-sync with master now.
SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user';
user plugin authentication_string
@ -20,5 +22,6 @@ include/stop_slave.inc
CHANGE MASTER TO MASTER_USER='root';
DROP USER 'plug_user';
# Cleanup (on master).
connection master;
DROP USER 'plug_user';
include/rpl_end.inc

View File

@ -8,25 +8,30 @@ INSERT INTO t1 VALUES (13,0),(8,1),(9,2),(6,3),
(12,13),(7,14);
INSERT INTO t2 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
(11),(12),(13),(14);
# in thread1
connect thread1, localhost, root,,;
connect thread2, localhost, root,,;
connection thread1;
START TRANSACTION;
# in thread2
connection thread2;
REPLACE INTO t2 VALUES (-17);
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
d
# in thread1
connection thread1;
REPLACE INTO t1(a,b) VALUES (67,20);
# in thread2
connection thread2;
COMMIT;
START TRANSACTION;
REPLACE INTO t1(a,b) VALUES (65,-50);
REPLACE INTO t2 VALUES (-91);
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
# in thread1
connection thread1;
# should not crash
SELECT d FROM t2,t1 WHERE d=(SELECT MAX(a) FROM t1 WHERE t1.a > t2.d) LOCK IN SHARE MODE;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
# in thread2
connection thread2;
d
# in thread1;
disconnect thread2;
connection thread1;
disconnect thread1;
connection default;
DROP TABLE t1,t2;

View File

@ -5,6 +5,8 @@ CREATE USER user1@localhost;
CREATE DATABASE db1;
GRANT ALL PRIVILEGES ON db1.* TO user1@localhost;
CREATE TABLE db1.t1(a INT);
connect con1,localhost,user1,,;
connection con1;
SELECT CURRENT_USER();
CURRENT_USER()
user1@localhost
@ -13,5 +15,7 @@ Variable_name Value
read_only ON
INSERT INTO db1.t1 VALUES (1);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
connection default;
disconnect con1;
DROP DATABASE db1;
DROP USER user1@localhost;

View File

@ -131,9 +131,10 @@ select t1.* from t1, t2, t3 where t3.state & 1 = 0 and t3.t1_id = t1.id and t3.t
id a
1 me
drop table t3,t2,t1;
connect connection1,localhost,root,,;
SET SESSION STORAGE_ENGINE = InnoDB;
SET @@autocommit=1;
connection default
connection default;
SHOW VARIABLES LIKE 'have_query_cache';
Variable_name Value
have_query_cache YES
@ -155,7 +156,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
connection connection1
connection connection1;
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@ -171,7 +172,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
connection default
connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
@ -185,7 +186,7 @@ count(*)
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
connection connection1
connection connection1;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@ -197,7 +198,7 @@ INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
3
connection default
connection default;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
@ -210,7 +211,7 @@ SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
connection connection1
connection connection1;
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
@ -221,6 +222,8 @@ Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
disconnect connection1;
connection default;
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;
SET global query_cache_type=default;

View File

@ -713,6 +713,7 @@ DROP TABLE t1;
SET @@GLOBAL.max_allowed_packet=2048;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
connect newconn, localhost, root,,;
SELECT CONVERT('a', BINARY(2049));
CONVERT('a', BINARY(2049))
a
@ -728,6 +729,8 @@ length(CONVERT(repeat('a',2048), CHAR(2049)))
2048
Warnings:
Warning 1301 Result of cast_as_char() was larger than max_allowed_packet (2048) - truncated
connection default;
disconnect newconn;
SET @@GLOBAL.max_allowed_packet=default;
#
# Bug#13519724 63793: CRASH IN DTCOLLATION::SET(DTCOLLATION &SET)

View File

@ -1,6 +1,10 @@
connect test,localhost,root,,;
connection test;
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: NO)
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
ERROR 08S01: Unknown command
ERROR 08S01: Unknown command
disconnect test;
connection default;
that's all

View File

@ -1,3 +1,6 @@
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
drop table if exists t1,t2;
drop view if exists v1;
create table t1(n int not null, key(n), key(n), key(n), key(n));
@ -6,9 +9,14 @@ Note 1831 Duplicate index 'n_2' defined on the table 'test.t1'. This is deprecat
Note 1831 Duplicate index 'n_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
Note 1831 Duplicate index 'n_4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
check table t1 extended;
connection con2;
insert into t1 values (200000);
connection con1;
Table Op Msg_type Msg_text
test.t1 check status OK
connection default;
disconnect con1;
disconnect con2;
drop table t1;
Create table t1(f1 int);
Create table t2(f1 int);
@ -34,12 +42,13 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT);
LOCK TABLE t1 WRITE;
# Connection con1
connect con1, localhost, root;
SET lock_wait_timeout= 1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Lock wait timeout exceeded; try restarting transaction
test.t1 check status Operation failed
# Connection default
connection default;
UNLOCK TABLES;
DROP TABLE t1;
disconnect con1;

View File

@ -1,3 +1,4 @@
connect con1,localhost,root,,;
#
# Bug#20837 Apparent change of isolation level
# during transaction
@ -43,11 +44,11 @@ s1
2
-1
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1000);
COMMIT;
connection default
connection default;
We should not be able to read the '1000'
SELECT * FROM t1;
s1
@ -65,23 +66,23 @@ s1
1000
COMMIT;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
COUNT(*)
1
Should be 1
COMMIT AND CHAIN;
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
COUNT(*)
1
@ -97,23 +98,23 @@ s1
1002
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
COUNT(*)
1
Should be 1
ROLLBACK AND CHAIN;
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
COUNT(*)
1
@ -129,33 +130,33 @@ s1
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;
SET @@completion_type=1;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
Should see 1001
COMMIT AND NO CHAIN;
default transaction is now in REPEATABLE READ
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
1002
Should see 1001 and 1002
connection con1
connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
@ -174,35 +175,35 @@ DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;
connection default
connection default;
SET @@completion_type=1;
COMMIT AND NO CHAIN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
Should see 1001
ROLLBACK AND NO CHAIN;
default transaction is now in REPEATABLE READ
connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
1002
Should see 1001 and 1002
connection con1
connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;
connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
s1
1001
@ -221,7 +222,7 @@ DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;
connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
START TRANSACTION;
@ -230,10 +231,10 @@ s1
1
2
-1
connection con1
connection con1;
INSERT INTO t1 VALUES (1000);
COMMIT;
connection default
connection default;
SELECT * FROM t1;
s1
1
@ -253,10 +254,10 @@ SELECT * FROM t1;
s1
1000
Should read '1000'
connection con1
connection con1;
INSERT INTO t1 VALUES (1001);
COMMIT;
connection default
connection default;
SELECT * FROM t1;
s1
1000
@ -266,6 +267,7 @@ SET @@completion_type=0;
COMMIT AND NO CHAIN;
SET @@autocommit=1;
COMMIT;
disconnect con1;
DROP TABLE t1;
#
# End of test cases for Bug#20837

View File

@ -1,3 +1,4 @@
connect comp_con,localhost,root,,,,,COMPRESS;
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
@ -2163,3 +2164,5 @@ drop table t1;
SHOW STATUS LIKE 'Compression';
Variable_name Value
Compression ON
connection default;
disconnect comp_con;

View File

@ -1,4 +1,5 @@
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
@ -13,7 +14,8 @@ drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
**
** connection thread1
connect thread1, localhost, mysqltest,,;
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -32,13 +34,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connect thread2, localhost, mysqltest,,;
connection thread2;
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
** connection thread1
connection thread1;
** Start new transaction for thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -65,7 +68,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from update on thread 2
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
@ -85,7 +88,7 @@ eta tipo c
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Sending commit on thread 2.
commit;
** connection thread1
connection thread1;
** Make sure table reads didn't change yet on thread 1.
select * from t1;
eta tipo c
@ -117,7 +120,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Make sure the output is similar for t1.
select * from t1;
eta tipo c
@ -132,7 +135,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -146,13 +149,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two UPDATE's running and one changing result set
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -171,14 +174,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connection thread2;
** Start transaction on thread 2
begin;
** Update will cause a table scan.
** This will cause a hang on the first row where tipo=1 until the
** blocking ULL is released.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
** connection thread1
connection thread1;
** Start transaction on thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -204,7 +207,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from thread 2:
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
@ -223,7 +226,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
** Thread 2 has committed but the result should remain the same for
** thread 1 (updated on three places):
select * from t1;
@ -256,7 +259,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -270,7 +273,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -284,13 +287,13 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** One UPDATE and one INSERT .... Monty's test
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1 (a int not null, b int not null);
@ -299,13 +302,13 @@ insert into t1 values (1,1),(2,1),(3,1),(4,1);
select get_lock("hello2",10);
get_lock("hello2",10)
1
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Update will create a table scan which creates a ULL where a=2;
** this will hang waiting on thread 1.
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
** connection thread1
connection thread1;
** Insert new values to t1 from thread 1; this created an implicit
** commit since there are no on-going transactions.
insert into t1 values (1,1);
@ -319,7 +322,7 @@ a b
3 1
4 1
1 1
** connection thread2
connection thread2;
** Collect results from thread 2 and release the lock.
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
@ -333,13 +336,13 @@ a b
1 1
** Commit changes from thread 2
commit;
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -354,7 +357,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Select a range for update.
@ -363,7 +366,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Update the same range which is marked for update on thread 2; this
@ -385,7 +388,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The table should look unmodified from thread 2.
select * from t1;
eta tipo c
@ -403,10 +406,10 @@ eta tipo c
** Sending a commit should release the row locks and enable
** thread 1 to complete the transaction.
commit;
** connection thread1
connection thread1;
** Commit on thread 1.
commit;
** connection thread2
connection thread2;
** The table should not have been changed.
select * from t1;
eta tipo c
@ -421,7 +424,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Even on thread 1:
select * from t1;
eta tipo c
@ -436,13 +439,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -457,7 +460,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Starting new transaction on thread 2.
begin;
** Starting SELECT .. FOR UPDATE
@ -466,7 +469,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Starting new transaction on thread 1
begin;
@ -492,7 +495,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The same thing should hold true for the transaction on
** thread 2
select * from t1;
@ -509,9 +512,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
** Even after committing:
select * from t1;
eta tipo c
@ -526,7 +529,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -540,13 +543,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -561,7 +564,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
@ -569,14 +572,14 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Selecting a range for update by table scan will be blocked
** because of on-going transaction on thread 2.
select * from t1 where tipo=1 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** connection thread2
connection thread2;
** Table will be unchanged and the select command will not be
** blocked:
select * from t1;
@ -594,10 +597,10 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Commit transacton on thread 2.
commit;
** connection thread1
connection thread1;
** Commit transaction on thread 1.
commit;
** connection thread2
connection thread2;
** Make sure table isn't blocked on thread 2:
select * from t1;
eta tipo c
@ -612,7 +615,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Make sure table isn't blocked on thread 1:
select * from t1;
eta tipo c
@ -627,13 +630,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -648,10 +651,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -668,7 +671,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -680,9 +683,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -693,7 +696,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -704,13 +707,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -725,10 +728,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
@ -750,7 +753,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -762,9 +765,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -775,7 +778,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -787,8 +790,11 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Cleanup
** connection thread2
** connection default
connection thread1;
disconnect thread1;
connection thread2;
disconnect thread2;
connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;

View File

@ -1,4 +1,5 @@
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
connection default;
SET SQL_MODE="";
SELECT @@global.tx_isolation;
@@global.tx_isolation
@ -13,7 +14,8 @@ drop table if exists t1;
**
** two UPDATE's running and both changing distinct result sets
**
** connection thread1
connect thread1, localhost, mysqltest,,;
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -32,13 +34,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connect thread2, localhost, mysqltest,,;
connection thread2;
** Start transaction for thread 2
begin;
** Update will cause a table scan and a new ULL will
** be created and blocked on the first row where tipo=11.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=11;
** connection thread1
connection thread1;
** Start new transaction for thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -64,7 +67,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from update on thread 2
DO release_lock("hello");
** Table should have eta updates where tipo=11 but updates made by
@ -84,7 +87,7 @@ eta tipo c
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Sending commit on thread 2.
commit;
** connection thread1
connection thread1;
** Make sure table reads didn't change yet on thread 1.
select * from t1;
eta tipo c
@ -116,7 +119,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Make sure the output is similar for t1.
select * from t1;
eta tipo c
@ -131,7 +134,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -145,13 +148,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
2 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
1 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two UPDATE's running and one changing result set
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -170,14 +173,14 @@ insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
select get_lock("hello",10);
get_lock("hello",10)
1
** connection thread2
connection thread2;
** Start transaction on thread 2
begin;
** Update will cause a table scan.
** This will cause a hang on the first row where tipo=1 until the
** blocking ULL is released.
update t1 set eta=1+get_lock("hello",10)*0 where tipo=1;
** connection thread1
connection thread1;
** Start transaction on thread 1
begin;
** Update on t1 will cause a table scan which will be blocked because
@ -202,7 +205,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** Release the lock and collect result from thread 2:
DO release_lock("hello");
** Seen from thread 2 the table should have been updated on four
@ -221,7 +224,7 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
** Thread 2 has committed but the result should remain the same for
** thread 1 (updated on three places):
select * from t1;
@ -254,7 +257,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -268,7 +271,7 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -282,13 +285,13 @@ eta tipo c
1 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** One UPDATE and one INSERT .... Monty's test
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1 (a int not null, b int not null);
@ -297,13 +300,13 @@ insert into t1 values (1,1),(2,1),(3,1),(4,1);
select get_lock("hello2",10);
get_lock("hello2",10)
1
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Update will create a table scan which creates a ULL where a=2;
** this will hang waiting on thread 1.
update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2;
** connection thread1
connection thread1;
** Insert new values to t1 from thread 1; this created an implicit
** commit since there are no on-going transactions.
insert into t1 values (1,1);
@ -317,7 +320,7 @@ a b
3 1
4 1
1 1
** connection thread2
connection thread2;
** Collect results from thread 2 and release the lock.
DO release_lock("hello2");
** The table should look like the original+updates for thread 2,
@ -331,13 +334,13 @@ a b
1 1
** Commit changes from thread 2
commit;
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -352,7 +355,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
** Select a range for update.
@ -361,7 +364,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Update the same range which is marked for update on thread 2; this
@ -383,7 +386,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The table should look unmodified from thread 2.
select * from t1;
eta tipo c
@ -401,10 +404,10 @@ eta tipo c
** Sending a commit should release the row locks and enable
** thread 1 to complete the transaction.
commit;
** connection thread1
connection thread1;
** Commit on thread 1.
commit;
** connection thread2
connection thread2;
** The table should not have been changed.
select * from t1;
eta tipo c
@ -419,7 +422,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Even on thread 1:
select * from t1;
eta tipo c
@ -434,13 +437,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -455,7 +458,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Starting new transaction on thread 2.
begin;
** Starting SELECT .. FOR UPDATE
@ -464,7 +467,7 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Starting new transaction on thread 1
begin;
@ -489,7 +492,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
** The same thing should hold true for the transaction on
** thread 2
select * from t1;
@ -506,9 +509,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
** Even after committing:
select * from t1;
eta tipo c
@ -523,7 +526,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -537,13 +540,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 11 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** two SELECT ... FOR UPDATE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -558,7 +561,7 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
** Begin a new transaction on thread 2
begin;
select * from t1 where tipo=2 FOR UPDATE;
@ -566,14 +569,14 @@ eta tipo c
20 2 ddddddddddddddddddddddddddddddddddddddddddd
40 2 fffffffffffffffffffffffffffffffffffffffffff
60 2 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
** connection thread1
connection thread1;
** Begin a new transaction on thread 1
begin;
** Selecting a range for update by table scan will be blocked
** because of on-going transaction on thread 2.
select * from t1 where tipo=1 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
** connection thread2
connection thread2;
** Table will be unchanged and the select command will not be
** blocked:
select * from t1;
@ -591,10 +594,10 @@ eta tipo c
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Commit transacton on thread 2.
commit;
** connection thread1
connection thread1;
** Commit transaction on thread 1.
commit;
** connection thread2
connection thread2;
** Make sure table isn't blocked on thread 2:
select * from t1;
eta tipo c
@ -609,7 +612,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
** Make sure table isn't blocked on thread 1:
select * from t1;
eta tipo c
@ -624,13 +627,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -645,10 +648,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
update t1 set tipo=1 where tipo=2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -665,7 +668,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -677,9 +680,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -690,7 +693,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -701,13 +704,13 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection default
connection default;
drop table t1;
**
** one UPDATE not changing result set and DELETE
**
** connection thread1
connection thread1;
** Set up table
SET SESSION STORAGE_ENGINE = InnoDB;
create table t1(eta int(11) not null, tipo int(11), c varchar(255));
@ -722,10 +725,10 @@ insert into t1 values (60,2,"hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh");
insert into t1 values (70,1,"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
insert into t1 values (80,22,"jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj");
insert into t1 values (90,11,"kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
** connection thread2
connection thread2;
begin;
delete from t1 where tipo=2;
** connection thread1
connection thread1;
begin;
** Update on t1 will cause a table scan which will be blocked because
** the previously initiated table scan applied exclusive key locks on
@ -746,7 +749,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -758,9 +761,9 @@ eta tipo c
80 22 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
commit;
** connection thread1
connection thread1;
commit;
** connection thread2
connection thread2;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -771,7 +774,7 @@ eta tipo c
70 1 iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** connection thread1
connection thread1;
select * from t1;
eta tipo c
7 7 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -783,8 +786,11 @@ eta tipo c
80 1 jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
** Cleanup
** connection thread2
** connection default
connection thread1;
disconnect thread1;
connection thread2;
disconnect thread2;
connection default;
drop table t1;
drop user mysqltest@localhost;
SET SQL_MODE=default;

View File

@ -1,5 +1,6 @@
SET global secure_auth=0;
drop table if exists t1,t2;
connect con1,localhost,root,,mysql;
show tables;
Tables_in_mysql
column_stats
@ -32,14 +33,21 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
connect con2,localhost,root,,test;
show tables;
Tables_in_test
connect(localhost,root,z,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,root,z,test2;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect(localhost,root,z,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,root,z,;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connection default;
disconnect con1;
disconnect con2;
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
connect con3,localhost,test,gambling,mysql;
show tables;
Tables_in_mysql
column_stats
@ -72,18 +80,29 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
connect con4,localhost,test,gambling,test;
show tables;
Tables_in_test
connection default;
disconnect con3;
disconnect con4;
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,"",MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,'""';
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
connect con10,localhost,test,gambling2,;
connect con5,localhost,test,gambling2,mysql;
connection con5;
set password="";
set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
@ -120,22 +139,35 @@ time_zone_name
time_zone_transition
time_zone_transition_type
user
connect con6,localhost,test,gambling3,test;
show tables;
Tables_in_test
connection default;
disconnect con10;
disconnect con5;
disconnect con6;
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,test2;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
connect fail_con,localhost,test,zorro,;
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
delete from mysql.user where user=_binary"test";
flush privileges;
connect con7,localhost,root,,test;
connection con7;
create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key);
set @id := 1;
delete from t1 where id like @id;
connection default;
disconnect con7;
drop table t1;
# ------------------------------------------------------------------
# -- End of 4.1 tests
@ -153,6 +185,7 @@ SET GLOBAL event_scheduler = ON;
# -- Waiting for Event Scheduler to start...
# -- Disconnecting default connection...
disconnect default;
# -- Check that we allow exactly three user connections, no matter how
# -- many threads are running.
@ -202,8 +235,13 @@ SET GLOBAL event_scheduler = OFF;
# -- Waiting for Event Scheduler to stop...
# -- That's it. Closing connections...
disconnect con_1;
disconnect con_2;
disconnect con_3;
disconnect con_super_1;
# -- Restoring default connection...
connect default,localhost,root,,test;
# -- Waiting for connections to close...
@ -224,6 +262,7 @@ SET GLOBAL event_scheduler = ON;
# -- Waiting for Event Scheduler to start...
# -- Opening a new connection to check max_used_connections...
connect con_1,localhost,root;
# -- Check that max_used_connections hasn't changed.
SHOW STATUS LIKE 'max_used_connections';
@ -231,6 +270,8 @@ Variable_name Value
Max_used_connections 2
# -- Closing new connection...
disconnect con_1;
connection default;
# -- Stopping Event Scheduler...
SET GLOBAL event_scheduler = OFF;
@ -238,9 +279,13 @@ SET GLOBAL event_scheduler = OFF;
# -- End of Bug#35074.
connect extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
connection extracon;
SELECT 'Connection on extra port ok';
Connection on extra port ok
Connection on extra port ok
connect extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
connection extracon2;
SELECT 'Connection on extra port 2 ok';
Connection on extra port 2 ok
Connection on extra port 2 ok
@ -251,6 +296,9 @@ Connection on extra port 2 ok
#
GRANT ALL ON test.* TO 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost' IDENTIFIED BY 'test123';
FLUSH PRIVILEGES;
connect con1,localhost,O1234567890123456789012345678901234567890123456789012345678901234567890123456789x,test123,test;
disconnect con1;
connection default;
DROP USER 'O1234567890123456789012345678901234567890123456789012345678901234567890123456789'@'localhost';
FLUSH PRIVILEGES;
#
@ -259,22 +307,36 @@ FLUSH PRIVILEGES;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------
disconnect extracon;
disconnect extracon2;
connection default;
CREATE USER mysqltest_up1 IDENTIFIED VIA mysql_native_password using '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB';
CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db389';
connect(localhost,mysqltest_up1,foo,test,MASTER_PORT,MASTER_SOCKET);
connect pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up1'@'localhost' (using password: YES)
connect pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
connection pcon2;
select user(), current_user();
user() current_user()
mysqltest_up1@localhost mysqltest_up1@%
disconnect pcon2;
connect(localhost,mysqltest_up2,newpw,test,MASTER_PORT,MASTER_SOCKET);
connect pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up2'@'localhost' (using password: YES)
connect pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
connection pcon4;
select user(), current_user();
user() current_user()
mysqltest_up2@localhost mysqltest_up2@%
disconnect pcon4;
connect(localhost,mysqltest_nouser,newpw,test,MASTER_PORT,MASTER_SOCKET);
connect pcon5,localhost,mysqltest_nouser,newpw,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: YES)
connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET);
connect pcon5,localhost,mysqltest_nouser,,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO)
connection default;
update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1';
update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2';
select user, password, plugin, authentication_string from mysql.user
@ -283,12 +345,19 @@ user password plugin authentication_string
mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password
mysqltest_up2 09301740536db389 mysql_old_password
flush privileges;
connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
connection pcon6;
select user(), current_user();
user() current_user()
mysqltest_up1@localhost mysqltest_up1@%
disconnect pcon6;
connect pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
connection pcon7;
select user(), current_user();
user() current_user()
mysqltest_up2@localhost mysqltest_up2@%
disconnect pcon7;
connection default;
DROP USER mysqltest_up1@'%';
DROP USER mysqltest_up2@'%';
#

View File

@ -1,44 +1,70 @@
call mtr.add_suppression("Allocation failed");
SET @old_debug= @@session.debug;
set @old_thread_cache_size=@@global.thread_cache_size;
connect con1,localhost,root,,test,,;
select 1;
1
1
disconnect con1;
connection default;
set global debug_dbug='+d,simulate_failed_connection_1';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
set global debug_dbug='+d,simulate_failed_connection_2';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
connect con1,localhost,root,,test,,;
select 1;
1
1
disconnect con1;
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
disconnect con1;
connection default;
set global debug_dbug='+d,simulate_failed_connection_1';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
set global debug_dbug='+d,simulate_failed_connection_2';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
Got one of the listed errors
connection default;
set global debug_dbug=@old_debug;
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
disconnect con1;
connection default;
set @@global.thread_cache_size=2;
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
connect con2,localhost,root,,test,$MASTER_EXTRA_PORT,;
select 1;
1
1
disconnect con1;
disconnect con2;
connection default;
set global debug_dbug='+d,simulate_failed_connection_2';
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
connect con1,localhost,root,,test,$MASTER_EXTRA_PORT,;
Got one of the listed errors
connection default;
show status like "Threads_connected";
Variable_name Value
Threads_connected 1

View File

@ -1,15 +1,15 @@
DROP TABLE IF EXISTS t1;
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
connect con1,localhost,root,,;
connect con2,localhost,root,,;
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
# Switch to connection con1
connection con1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# Switch to connection con2
connection con2;
INSERT INTO t1 VALUES(1);
# Switch to connection con1
connection con1;
SELECT * FROM t1;
a
COMMIT;
@ -18,9 +18,9 @@ COMMIT;
### committed inserts should be visible to the transaction.
DELETE FROM t1;
START TRANSACTION;
# Switch to connection con2
connection con2;
INSERT INTO t1 VALUES(1);
# Switch to connection con1
connection con1;
SELECT * FROM t1;
a
1
@ -31,12 +31,14 @@ COMMIT;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
DELETE FROM t1;
COMMIT WORK AND CHAIN;
# Switch to connection con2
connection con2;
INSERT INTO t1 VALUES(1);
# Switch to connection con1
connection con1;
SELECT * FROM t1;
a
1
COMMIT;
# Switch to connection default + close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;

View File

@ -1,11 +1,20 @@
connect addconroot1, localhost, root,,;
connect addconroot2, localhost, root,,;
connect addconroot3, localhost, root,,;
connection default;
drop table if exists t1,t2,t3,t4,t5;
set debug_sync='RESET';
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 (j char(5));;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -14,10 +23,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 select 'Test' as j;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -27,10 +41,15 @@ drop table t1;
create table t3 (j char(5));
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create table t1 like t3;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -39,10 +58,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t3 to t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -51,10 +75,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -63,10 +92,15 @@ t1 CREATE TABLE `t1` (
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
alter table t3 rename to t1, add k int;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
ERROR 42S01: Table 't1' already exists
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -74,30 +108,51 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t3;
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
connection default;
set debug_sync='create_table_select_before_open SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
select * from t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
i
1
connection default;
drop table t1;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (2);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select * from t1;
i
1
@ -106,37 +161,62 @@ drop table t1;
set @a:=0;
set debug_sync='create_table_select_before_create SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select @a;
@a
0
drop table t1;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
rename table t1 to t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
select * from t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
i
1
connection default;
drop table t1;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (2);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select * from t1;
i
1
@ -145,27 +225,42 @@ drop table t1;
set @a:=0;
set debug_sync='create_table_select_before_lock SIGNAL parked WAIT_FOR go';
create table t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
select @a;
@a
0
drop table t1;
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
create table if not exists t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
create table t1 (i int);
set @a:=0;
set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go';
create table if not exists t1 select 1 as i;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
create trigger t1_bi before insert on t1 for each row set @a:=1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
Warnings:
Note 1050 Table 't1' already exists
connection addconroot1;
connection default;
select @a;
@a
0
@ -178,10 +273,15 @@ create table t1 (i int);
set debug_sync='create_table_like_after_open SIGNAL parked WAIT_FOR go';
reset master;
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t1 values (1);
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
@ -203,21 +303,39 @@ create table t1 (i int);
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
reset master;
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
insert into t2 values (1);;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t2;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
set debug_sync='create_table_like_before_binlog SIGNAL parked WAIT_FOR go';
create table t2 like t1;;
connection addconroot1;
set debug_sync='now WAIT_FOR parked';
drop table t1;;
connection addconroot2;
set debug_sync='now SIGNAL go';
connection default;
connection addconroot1;
connection default;
drop table t2;
disconnect addconroot1;
disconnect addconroot2;
disconnect addconroot3;
set debug_sync='RESET';
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info

View File

@ -567,9 +567,13 @@ select database();
database()
NULL
create user mysqltest_1;
connect user1,localhost,mysqltest_1,,*NO-ONE*;
connection user1;
select database(), user();
database() user()
NULL mysqltest_1@localhost
connection default;
disconnect user1;
drop user mysqltest_1;
use test;
create table t1 (a int, index `primary` (a));
@ -1813,6 +1817,7 @@ create table t1 (a int, b int) engine=myisam;
create table t2 (a int, b int) engine=myisam;
insert into t1 values (1,1);
lock tables t1 read;
connect user1,localhost,root,,test;
set @@lock_wait_timeout=5;
create table if not exists t1 (a int, b int);
Warnings:
@ -1831,6 +1836,8 @@ create table t1 like t2;
ERROR 42S01: Table 't1' already exists
create or replace table t1 (a int, b int) select 2,2;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect user1;
connection default;
select * from t1;
a b
1 1

View File

@ -43,6 +43,8 @@ CREATE USER u1@localhost;
REVOKE SHOW DATABASES ON *.* FROM 'u1'@'localhost';
GRANT SHOW DATABASES ON *.* TO role_1;
GRANT role_1 TO u1@localhost;
connect user_a, localhost, u1,,;
connection user_a;
SELECT CURRENT_USER;
CURRENT_USER
u1@localhost
@ -65,6 +67,8 @@ mysql
performance_schema
test
SET ROLE NONE;
connect user_b, localhost, root,,;
connection user_b;
# Clearing up
DROP ROLE role_1;
DROP ROLE IF EXISTS role_1;

View File

@ -432,11 +432,18 @@ unlock tables;
CREATE TABLE t1 (col_int_nokey INT) ENGINE=InnoDB;
CREATE OR REPLACE TEMPORARY TABLE tmp LIKE t1;
LOCK TABLE t1 WRITE;
connect con1,localhost,root,,test;
CREATE OR REPLACE TABLE t1 LIKE tmp;
connection default;
KILL QUERY con_id;
connection con1;
ERROR 70100: Query execution was interrupted
CREATE OR REPLACE TABLE t1 (a int);
connection default;
KILL QUERY con_id;
connection con1;
ERROR 70100: Query execution was interrupted
disconnect con1;
connection default;
drop table t1;
DROP TABLE t2;

View File

@ -17,9 +17,11 @@ t1 CREATE TABLE `t1` (
`b` int(11) DEFAULT NULL,
KEY `a` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
connection slave;
SHOW TABLES;
Tables_in_test
t1
connection master;
drop temporary table if exists tmp;
drop table t1;
include/rpl_end.inc

View File

@ -19,6 +19,8 @@ REVOKE ALTER ROUTINE ON db1.* FROM mysqltest_1@localhost;
GRANT DELETE ON mysql.* TO mysqltest_1@localhost;
REVOKE DELETE ON mysql.* FROM mysqltest_1@localhost;
FLUSH PRIVILEGES;
connect user_a, localhost, mysqltest_1,,;
connection user_a;
SELECT CURRENT_USER;
CURRENT_USER
mysqltest_1@localhost
@ -41,6 +43,7 @@ CREATE OR REPLACE USER u1@localhost;
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
CREATE OR REPLACE ROLE developer;
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
connection default;
SELECT CURRENT_USER;
CURRENT_USER
root@localhost

View File

@ -1,11 +1,17 @@
connect root,localhost,root,,test;
connection root;
create database mysqltest;
create user mysqltest_1@localhost;
connect user1,localhost,mysqltest_1,,test;
connection user1;
connection root;
create table mysqltest.t1 (a int, b int);
insert into mysqltest.t1 values (2,10), (1,30);
create table mysqltest.t2 (c int, d char(32));
insert into mysqltest.t2 values (1,'xxx'), (1,'zzz');
grant select on mysqltest.t1 to mysqltest_1@localhost;
grant select (c) on mysqltest.t2 to mysqltest_1@localhost;
connection user1;
with t as (select c from mysqltest.t2 where c < 2)
select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
c b
@ -18,6 +24,7 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column
with t as (select c,d from mysqltest.t2 where c < 2)
select t.c,t.d,t1.b from t,mysqltest.t1 where t.c=t1.a;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 't2'
connection root;
create view mysqltest.v1(f1,f2) as
with t as (select c from mysqltest.t2 where c < 2)
select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
@ -27,6 +34,7 @@ select t.a,b from t,mysqltest.t1 where mysqltest.t1.a = t.a;
grant select on mysqltest.v1 to mysqltest_1@localhost;
grant select (c) on mysqltest.v2 to mysqltest_1@localhost;
grant create view on mysqltest.* to mysqltest_1@localhost;
connection user1;
create view mysqltest.v3(c,d) as
with t as (select c from mysqltest.t2 where c < 2)
select t.c,t1.b from t,mysqltest.t1 where t.c=t1.a;
@ -44,11 +52,14 @@ select d from mysqltest.v2;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v2'
select * from mysqltest.v3;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v3'
connection root;
grant select on mysqltest.v3 to mysqltest_1@localhost;
connection user1;
select * from mysqltest.v3;
c d
1 30
1 30
connection root;
revoke all privileges on mysqltest.v1 from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop database mysqltest;

View File

@ -1,5 +1,7 @@
Start of 5.4 tests
CREATE TABLE t1(f1 INT);
connect con1,localhost,root,,test;
connection con1;
SET lc_messages=ru_RU;
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
@ -9,6 +11,7 @@ ERROR 42S01: \0422\0430\0431\043B\0438\0446\0430 't1' \0443\0436\0435 \0441\0443
SET NAMES utf8;
CREATE TABLE t1(f1 INT);
ERROR 42S01: Таблица 't1' уже существует
connection default;
SHOW VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages en_US
@ -22,21 +25,27 @@ SHOW GLOBAL VARIABLES LIKE 'lc_messages';
Variable_name Value
lc_messages ru_RU
SET GLOBAL lc_messages=en_US;
disconnect con1;
DROP TABLE t1;
drop table `ק`;
ERROR 42S02: Unknown table 'test.ק'
connect con1,localhost,root,,test;
connection con1;
SET lc_messages=cs_CZ;
SET NAMES UTF8;
USE nonexistant;
ERROR 42000: Neznámá databáze 'nonexistant'
disconnect con1;
connection default;
#
# Bug#12736295: Buffer overflow for variable converted_err
# with non-latin1 server error message
#
# Connection con1
connect con1,localhost,root,,test;
SET lc_messages=ru_RU;
SET NAMES latin1;
SELECT '01234567890123456789012345678901234\';
ERROR 42000: \0423 \0432\0430\0441 \043E\0448\0438\0431\043A\0430 \0432 \0437\0430\043F\0440\043E\0441\0435. \0418\0437\0443\0447\0438\0442\0435 \0434\043E\043A\0443\043C\0435\043D\0442\0430\0446\0438\044E \043F\043E \0438\0441\043F\043E\043B\044C\0437\0443\0435\043C\043E\0439 \0432\0435\0440\0441\0438\0438 MariaDB \043D\0430 \043F\0440\0435\0434\043C\0435\0442 \043A\043E\0440\0440\0435\043A\0442\043D\043E\0433\043E \0441\0438\043D\0442\0430\043A\0441\0438\0441\0430 \043E\043A\043E\043B\043E ''0123456789012345678901234
# Connection default
disconnect con1;
connection default;
End of 5.5 tests

View File

@ -61,8 +61,7 @@ SELECT * FROM v3|
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -118,8 +117,7 @@ DROP DATABASE mysqltest1|
---> Restoring mysqltest1...
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -167,8 +165,9 @@ utf8_general_ci
SELECT * FROM v3|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
@ -477,8 +476,7 @@ utf8_general_ci utf8_general_ci
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -879,8 +877,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1121,8 +1118,9 @@ koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca cb
utf8_general_ci utf8_general_ci
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -1459,8 +1457,7 @@ ALTER TABLE t1 ADD COLUMN fake INT|
ALTER TABLE t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1894,8 +1891,7 @@ ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2159,8 +2155,9 @@ ca1 ca2 ca3 cb1 cb2 cb3
koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci
DELETE FROM mysqltest2.log|
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -2348,8 +2345,7 @@ END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREAT
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2621,8 +2617,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2829,12 +2824,11 @@ Table Create Table
t2 CREATE TABLE `t2` (
`col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs
---> connection: con2
---> connection: con3
---> connection: default
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection default;
USE test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;

View File

@ -61,8 +61,7 @@ SELECT * FROM v3|
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -118,8 +117,7 @@ DROP DATABASE mysqltest1|
---> Restoring mysqltest1...
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -167,8 +165,9 @@ koi8r_general_ci
SELECT * FROM v3|
тест
тест
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
@ -477,8 +476,7 @@ utf8_general_ci utf8_general_ci
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -879,8 +877,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1121,8 +1118,9 @@ utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8
SELECT COLLATION(@a) AS ca, COLLATION(@b) cb|
ca cb
utf8_general_ci utf8_general_ci
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -1459,8 +1457,7 @@ ALTER TABLE t1 ADD COLUMN fake INT|
ALTER TABLE t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con2
connect con2,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -1894,8 +1891,7 @@ ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest1.t1 DROP COLUMN fake|
ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT|
ALTER TABLE mysqltest2.t1 DROP COLUMN fake|
---> connection: con3
connect con3,localhost,root,,;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2159,8 +2155,9 @@ ca1 ca2 ca3 cb1 cb2 cb3
utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci
DELETE FROM mysqltest2.log|
---> connection: default
connection default;
disconnect con2;
disconnect con3;
use test|
DROP DATABASE mysqltest1|
DROP DATABASE mysqltest2|
@ -2348,8 +2345,7 @@ END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREAT
ALTER DATABASE mysqltest1 COLLATE cp866_general_ci|
ALTER DATABASE mysqltest2 COLLATE cp866_general_ci|
---> connection: con2
connect con2,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2621,8 +2617,7 @@ DROP DATABASE mysqltest2|
---> Restoring mysqltest1...
---> Restoring mysqltest2...
---> connection: con3
connect con3,localhost,root,,mysqltest1;
SET @@character_set_client= cp1251|
SET @@character_set_results= cp1251|
SET @@collation_connection= cp1251_general_ci|
@ -2829,12 +2824,11 @@ Table Create Table
t2 CREATE TABLE `t2` (
`col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs
---> connection: con2
---> connection: con3
---> connection: default
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection default;
USE test;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;

View File

@ -1,31 +1,31 @@
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
connect con1,localhost,root,,;
connect con2,localhost,root,,;
drop table if exists t1,t2;
# Switch to connection con1
connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
insert into t1 values(0, 0);
set autocommit=0;
SELECT * from t1 where id = 0 FOR UPDATE;
id x
0 0
# Switch to connection con2
connection con2;
set autocommit=0;
update t1 set x=2 where id = 0;
# Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
commit;
# Switch to connection con2
connection con2;
commit;
# Switch to connection con1
connection con1;
select * from t1;
id x
0 2
commit;
drop table t1;
# Switch to connection con1
connection con1;
create table t1 (id integer, x integer) engine = InnoDB;
create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
@ -47,19 +47,19 @@ select * from t1;
id x
0 0
300 300
# Switch to connection con2
connection con2;
set autocommit=0;
update t1 set x=2 where id = 0;
# Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
# Switch to connection con2
connection con2;
commit;
# Switch to connection con1
connection con1;
select * from t1;
id x
0 2
@ -71,7 +71,7 @@ create table t2 (b integer, a integer) engine = InnoDB;
insert into t1 values(0, 0), (300, 300);
insert into t2 values(0, 0), (1, 20), (2, 30);
commit;
# Switch to connection con1
connection con1;
select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
a b
0 0
@ -87,7 +87,7 @@ select * from t1;
id x
0 0
300 300
# Switch to connection con2
connection con2;
update t2 set a=2 where b = 0;
select * from t2;
b a
@ -95,22 +95,24 @@ b a
1 20
2 30
update t1 set x=2 where id = 0;
# Switch to connection con1
connection con1;
update t1 set x=1 where id = 0;
select * from t1;
id x
0 1
300 300
commit;
# Switch to connection con2
connection con2;
commit;
# Switch to connection con1
connection con1;
select * from t1;
id x
0 2
300 300
commit;
# Switch to connection default + disconnect con1 and con2
connection default;
disconnect con1;
disconnect con2;
drop table t1, t2;
End of 4.1 tests
set storage_engine=innodb;

View File

@ -234,44 +234,48 @@ Variable_name Value
debug_sync ON - current signal: ''
CREATE USER mysqltest_1@localhost;
GRANT SUPER ON *.* TO mysqltest_1@localhost;
connection con1, mysqltest_1
connect con1,localhost,mysqltest_1,,;
SET DEBUG_SYNC= 'RESET';
connection default
disconnect con1;
connection default;
DROP USER mysqltest_1@localhost;
CREATE USER mysqltest_2@localhost;
GRANT ALL ON *.* TO mysqltest_2@localhost;
REVOKE SUPER ON *.* FROM mysqltest_2@localhost;
connection con1, mysqltest_2
connect con1,localhost,mysqltest_2,,;
SET DEBUG_SYNC= 'RESET';
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
connection default
disconnect con1;
connection default;
DROP USER mysqltest_2@localhost;
SET DEBUG_SYNC= 'RESET';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT);
connection con1
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'before_lock_tables_takes_lock
SIGNAL opened WAIT_FOR flushed';
INSERT INTO t1 VALUES(1);
connection default
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR opened';
SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
FLUSH TABLE t1;
connection con1
connection default
connection con1;
disconnect con1;
connection default;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT);
LOCK TABLE t1 READ;
connection con1
connect con1,localhost,root,,;
SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
INSERT INTO t1 VALUES (1);
connection default
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR locked';
UNLOCK TABLES;
connection con1
connection con1;
retrieve INSERT result.
connection default
disconnect con1;
connection default;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';

View File

@ -297,16 +297,21 @@ drop table if exists t1;
create table t1 (a int, b int);
insert into t1 values (1,1);
lock table t1 read;
connection: update
connect update,localhost,root,,;
connection update;
insert delayed into t1 values (2,2);;
connection: select
connection default;
connect select,localhost,root,,;
select * from t1;
a b
1 1
connection: default
connection default;
select * from t1;
a b
1 1
connection default;
disconnect update;
disconnect select;
unlock tables;
select * from t1;
a b
@ -359,70 +364,70 @@ CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
# Test 1: Using LOCK TABLE
# Connection con1
connect con1, localhost, root;
LOCK TABLE t1 WRITE;
# Connection default
connection default;
LOCK TABLE t2 WRITE;
# Sending:
INSERT DELAYED INTO t1 VALUES (1);
# Connection con1
connection con1;
# Wait until INSERT DELAYED is blocked on table 't1'.
INSERT DELAYED INTO t2 VALUES (1);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
UNLOCK TABLES;
# Connection default
connection default;
# Reaping: INSERT DELAYED INTO t1 VALUES (1)
UNLOCK TABLES;
# Test 2: Using ALTER TABLE
START TRANSACTION;
SELECT * FROM t1 WHERE a=0;
a
# Connection con1
connection con1;
# Sending:
ALTER TABLE t1 MODIFY a INT UNSIGNED;;
# Connection default
connection default;
# Wait until ALTER TABLE is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (3);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
# Connection con1
connection con1;
# Reaping: ALTER TABLE t1 COMMENT 'test'
# Test 3: Using RENAME TABLE
# Connection default
connection default;
START TRANSACTION;
INSERT INTO t2 VALUES (1);
# Connection con1
connection con1;
# Sending:
RENAME TABLE t1 to t5, t2 to t4;
# Connection default
connection default;
# Wait until RENAME TABLE is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (4);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
# Connection con1
connection con1;
# Reaping: RENAME TABLE t1 to t5, t2 to t4
# Connection default
connection default;
# Reverting the renames
RENAME TABLE t5 to t1, t4 to t2;
# Test 4: Two INSERT DELAYED on the same table
START TRANSACTION;
INSERT INTO t2 VALUES (1);
# Connection con2
connect con2, localhost, root;
LOCK TABLE t1 WRITE, t2 WRITE;
# Connection con1
connection con1;
# Wait until LOCK TABLE is blocked on table 't2'.
INSERT DELAYED INTO t1 VALUES (5);
# Connection default
connection default;
# Wait until INSERT DELAYED is blocked on table 't1'.
INSERT DELAYED INTO t1 VALUES (6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
# Connection con2
connection con2;
# Reaping: LOCK TABLE t1 WRITE, t2 WRITE
UNLOCK TABLES;
# Connection con1
connection con1;
# Reaping: INSERT DELAYED INTO t1 VALUES (5)
# Connection default
connection default;
# Test 5: LOCK TABLES + INSERT DELAYED in one connection.
# This test has triggered some asserts in metadata locking
# subsystem at some point in time..
@ -434,13 +439,17 @@ LOCK TABLE t1 WRITE;
INSERT DELAYED INTO t2 VALUES (8);
UNLOCK TABLES;
SET AUTOCOMMIT= 1;
# Connection con2
# Connection con1
# Connection default
connection con2;
disconnect con2;
connection con1;
disconnect con1;
connection default;
DROP TABLE t1, t2, t3;
#
# Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
#
connect con1,localhost,root,,;
connection default;
drop table if exists t1, t2, tm;
create table t1(a int);
create table t2(a int);
@ -448,10 +457,10 @@ create table tm(a int) engine=merge union=(t1, t2);
begin;
select * from t1;
a
# Connection 'con1'.
connection con1;
# Sending:
alter table t1 comment 'test';
# Connection 'default'.
connection default;
# Wait until ALTER TABLE blocks and starts waiting
# for connection 'default'. It should wait with a
# pending SNW lock on 't1'.
@ -462,7 +471,8 @@ insert delayed into tm values (1);
ERROR HY000: DELAYED option not supported for table 'tm'
# Unblock ALTER TABLE.
commit;
# Connection 'con1'.
connection con1;
# Reaping ALTER TABLE:
# Connection 'default'.
disconnect con1;
connection default;
drop tables tm, t1, t2;

View File

@ -4,10 +4,14 @@ CREATE TABLE t1 (a int(11), b varchar(32));
INSERT INTO t1 VALUES (7,'ggggggg'),(1,'a'),(3,'ccc'),(4,'dddd'),(1,'A'),
(2,'BB'),(4,'DDDD'),(5,'EEEEE'),(7,'GGGGGGG'),(2,'bb');
CREATE VIEW v1 AS SELECT a, UPPER(b) FROM t1;
connect root,localhost,root,,test;
connection root;
CREATE DATABASE mysqltest;
CREATE TABLE mysqltest.t1 SELECT * FROM t1;
GRANT DELETE ON mysqltest.* TO mysqltest_1@localhost;
GRANT SELECT(b) ON mysqltest.t1 TO mysqltest_1@localhost;
connect user1,localhost,mysqltest_1,,test;
connection user1;
DELETE FROM mysqltest.t1 WHERE a=2 RETURNING b;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 't1'
DELETE FROM mysqltest.t1 RETURNING b;
@ -22,6 +26,7 @@ DDDD
EEEEE
GGGGGGG
bb
connection root;
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
@ -41,15 +46,19 @@ a b
1 a
7 ggggggg
INSERT INTO mysqltest.t1 SELECT * FROM t1;
connection root;
CREATE VIEW mysqltest.v1(a) AS SELECT a FROM mysqltest.t1;
GRANT SELECT, INSERT ON mysqltest.t1 TO mysqltest_1@localhost;
connection user1;
DELETE FROM mysqltest.v1;
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
DELETE FROM mysqltest.v1 RETURNING a;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'a' in table 'v1'
connection root;
GRANT SELECT ON mysqltest.* TO mysqltest_1@localhost;
connection user1;
DELETE FROM mysqltest.v1 RETURNING a;
a
7
@ -65,7 +74,9 @@ a
SELECT * FROM mysqltest.t1;
a b
INSERT INTO mysqltest.t1 SELECT * FROM t1;
connection root;
DROP DATABASE mysqltest;
disconnect user1;
DROP USER mysqltest_1@localhost;
DROP VIEW v1;
DROP TABLE t1;

View File

@ -206,6 +206,8 @@ x
1
create user mysqltest_1;
create table t1 select 1 as a;
connect con1,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK;
connection con1;
set optimizer_switch='derived_merge=off,derived_with_keys=off';
select 2 as a from (select * from t1) b;
ERROR 3D000: No database selected
@ -385,6 +387,9 @@ ID DATA FID
select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
ID DATA FID
drop table t1, t2;
connection con1;
disconnect con1;
connection default;
drop user mysqltest_1;
# End of 4.1 tests
SELECT 0 FROM

View File

@ -1,3 +1,8 @@
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
disconnect con1;
connection con2;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
@ -7,13 +12,25 @@ n
2
3
DROP TABLE t1;
connection default;
disconnect con2;
connection default;
SELECT GET_LOCK("dangling", 0);
GET_LOCK("dangling", 0)
1
connect con1, localhost, root,,;
connection con1;
SELECT GET_LOCK('dangling', 3600);;
connection default;
disconnect con1;
connect con1, localhost, root,,;
SELECT GET_LOCK('dangling', 3600);;
connection default;
SELECT RELEASE_LOCK('dangling');
RELEASE_LOCK('dangling')
1
connection con1;
GET_LOCK('dangling', 3600)
1
connection default;
disconnect con1;

View File

@ -82,13 +82,22 @@ drop table if exists t1;
create table t1 (i int);
create database mysqltest;
lock tables t1 read;
connect addconroot1, localhost, root,,;
drop table t1;
connect addconroot2, localhost, root,,;
show open tables;
drop database mysqltest;
connection default;
select 1;
1
1
unlock tables;
connection addconroot1;
connection addconroot2;
disconnect addconroot2;
connection addconroot1;
disconnect addconroot1;
connection default;
drop table if exists t1,t2;
create table t1 (a int);
create table t2 (a int);
@ -99,14 +108,20 @@ drop table t1;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
unlock tables;
drop table t1,t2;
connect addconroot, localhost, root,,;
connection default;
create table t1 (i int);
create table t2 (i int);
lock tables t1 read;
connection addconroot;
lock tables t2 read;
drop table t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
connection default;
drop table t1,t2;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
disconnect addconroot;
connection default;
unlock tables;
drop table t1,t2;
End of 5.0 tests

View File

@ -2,6 +2,7 @@ create table t1 as select * from mysql.user;
truncate table mysql.user;
flush privileges;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u1;
Got one of the listed errors
insert mysql.user select * from t1;
drop table t1;

View File

@ -69,8 +69,12 @@ ERROR 42000: Unknown storage engine 'FooBar'
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MyISAM
connect con1,localhost,user_1,,;
connection con1;
SET SESSION enforce_storage_engine=MyISAM;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
disconnect con1;
connection default;
SET SESSION enforce_storage_engine=NULL;
SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
@ -102,6 +106,8 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
SET GLOBAL enforce_storage_engine=Memory;
SET SESSION sql_mode='';
connect con1,localhost,root,,;
connection con1;
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MEMORY
@ -119,6 +125,8 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`c1`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
DROP TABLE t1;
connection default;
disconnect con1;
set global sql_mode=default;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;

View File

@ -11,8 +11,10 @@ CREATE DATABASE db_x;
GRANT EVENT ON db_x.* TO pauline@localhost;
USE db_x;
CREATE TABLE x_table(a int);
connect priv_conn,localhost,pauline,,db_x;
CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
connection default;
SHOW DATABASES LIKE 'db_x';
Database (db_x)
db_x
@ -24,8 +26,11 @@ SHOW TABLES FROM db_x;
Tables_in_db_x
x_table
SET GLOBAL event_scheduler=off;
connection priv_conn;
DROP EVENT e_x1;
DROP EVENT e_x2;
disconnect priv_conn;
connection default;
DROP DATABASE db_x;
DROP USER pauline@localhost;
USE events_test;

View File

@ -203,10 +203,13 @@ drop database if exists mysqltest_db1;
create user mysqltest_user1@localhost;
create database mysqltest_db1;
grant event on events_test.* to mysqltest_user1@localhost;
connect conn2,localhost,mysqltest_user1,,events_test;
create event mysqltest_user1 on schedule every 10 second do select 42;
alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1'
"Let's test now rename when there is no select DB"
disconnect conn2;
connect conn2,localhost,mysqltest_user1,,*NO-ONE*;
select database();
database()
NULL
@ -216,6 +219,8 @@ select event_schema, event_name, definer, event_type, status from information_sc
event_schema event_name definer event_type status
events_test mysqltest_user1 mysqltest_user1@localhost RECURRING ENABLED
drop event events_test.mysqltest_user1;
disconnect conn2;
connection default;
drop user mysqltest_user1@localhost;
drop database mysqltest_db1;
create event e_53 on schedule at (select s1 from ttx) do drop table t;
@ -366,6 +371,7 @@ SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
event_name definer
e1 mysqltest_u1@localhost
DROP EVENT e1;
connect conn1, localhost, mysqltest_u1, , events_test;
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS;
event_name definer
@ -390,6 +396,8 @@ CREATE DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
DROP EVENT e1;
ERROR HY000: Unknown event 'e1'
disconnect conn1;
connection default;
DROP USER mysqltest_u1@localhost;
SET GLOBAL EVENT_SCHEDULER= OFF;
SET @save_time_zone= @@TIME_ZONE;
@ -586,7 +594,7 @@ Grants for evtest1@localhost
GRANT USAGE ON *.* TO 'evtest1'@'localhost' IDENTIFIED BY PASSWORD '*3170F3644E31580C25DE4A08F4C07CC9A2D40C32'
GRANT SELECT, INSERT ON `test`.* TO 'evtest1'@'localhost'
GRANT SELECT, INSERT, CREATE, EVENT ON `events_test`.* TO 'evtest1'@'localhost'
connection e1;
connect e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK;
CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND
DO BEGIN
SET AUTOCOMMIT = 0;
@ -615,6 +623,7 @@ Sleep 4 seconds
SELECT COUNT(*) > @row_cnt AS "Expect 0" FROM events_test.event_log;
Expect 0
0
disconnect e1;
DROP EVENT events_test.ev_sched_1823;
DROP TABLE events_test.event_log;
SET GLOBAL event_scheduler = OFF;
@ -640,9 +649,7 @@ GRANT EVENT ON *.* TO mysqltest_u1@localhost;
SET GLOBAL READ_ONLY = 1;
#
# Connection: u1_con (mysqltest_u1@localhost/events_test).
#
connect u1_con,localhost,mysqltest_u1,,events_test;
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
@ -653,9 +660,7 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can
DROP EVENT e1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
#
# Connection: root_con (root@localhost/events_test).
#
connect root_con,localhost,root,,events_test;
CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1;
@ -665,9 +670,7 @@ DROP EVENT e1;
SET GLOBAL READ_ONLY = 0;
#
# Connection: u1_con (mysqltest_u1@localhost/test).
#
connection u1_con;
CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO SET @a = 1;
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO SET @a = 1;
@ -682,9 +685,7 @@ event_name last_executed IS NULL definer
e1 1 mysqltest_u1@localhost
e2 1 mysqltest_u1@localhost
#
# Connection: root_con (root@localhost/events_test).
#
connection root_con;
SET GLOBAL READ_ONLY = 1;
@ -714,9 +715,9 @@ DROP EVENT e2;
SET GLOBAL READ_ONLY = 0;
#
# Connection: default
#
disconnect u1_con;
disconnect root_con;
connection default;
DROP USER mysqltest_u1@localhost;

View File

@ -12,6 +12,7 @@ CREATE USER ev_test@localhost;
GRANT ALL ON events_test.* to ev_test@localhost;
GRANT ALL ON events_test2.* to ev_test@localhost;
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
connect ev_con1,localhost,ev_test,,events_test2;
select "NEW CONNECTION";
NEW CONNECTION
NEW CONNECTION
@ -52,9 +53,12 @@ events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLE
"This should show us no events:";
SHOW EVENTS FROM test LIKE '%';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
connection default;
GRANT EVENT ON events_test2.* TO ev_test@localhost;
connection ev_con1;
USE events_test2;
CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection default;
USE events_test;
"We should see 4 events : one_event, two_event, three_event & four_event"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
@ -70,9 +74,11 @@ EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_
def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
connection default;
CREATE DATABASE events_test2;
USE events_test2;
CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42;
connection ev_con1;
"Should see 4 events - one, two, three & five"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
@ -80,7 +86,9 @@ def events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
connection default;
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
connection ev_con1;
USE test;
"Should see 3 events - one, two & three"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
@ -95,8 +103,10 @@ ALTER EVENT one_event ON SCHEDULE EVERY 10 SECOND;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test one_event ev_test@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE
connection default;
USE events_test;
ALTER EVENT one_event COMMENT "comment";
connection ev_con1;
"The definer should be root@localhost"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
@ -106,16 +116,22 @@ ALTER EVENT one_event DO SELECT 12;
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME='one_event';
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test one_event ev_test@localhost SQL SELECT 12 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE comment
connection default;
"make the definer again root@localhost"
ALTER EVENT one_event COMMENT "new comment";
connection ev_con1;
"test DROP by another user"
DROP EVENT one_event;
connection default;
"One event should not be there"
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME;
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
def events_test three_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED PRESERVE three event
def events_test two_event ev_test@localhost SQL SELECT 123 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE two event
def events_test2 five_event root@localhost SQL SELECT 42 RECURRING NULL 20 SECOND ENABLED NOT PRESERVE
connection ev_con1;
disconnect ev_con1;
connection default;
DROP USER ev_test@localhost;
DROP DATABASE events_test2;
DROP DATABASE events_test;

View File

@ -9,8 +9,11 @@ GRANT ALL ON *.* TO event_user2@localhost;
CREATE USER event_user3@localhost;
CREATE DATABASE events_conn3_db;
GRANT ALL ON *.* TO event_user3@localhost;
connect conn2,localhost,event_user2,,events_conn2_db;
"In the second connection we create some events which won't be dropped till the end"
connect conn3,localhost,event_user3,,events_conn3_db;
"In the second connection we create some events which won't be dropped till the end"
connection default;
USE events_conn1_test2;
CREATE EVENT ev_drop1 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
CREATE EVENT ev_drop2 ON SCHEDULE EVERY 10 MINUTE DISABLE DO SELECT 1;
@ -52,13 +55,21 @@ USE events_conn1_test2;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA='events_conn1_test2';
COUNT(*)
50
connection conn2;
DROP DATABASE events_conn2_db;
connection conn3;
DROP DATABASE events_conn3_db;
connection default;
DROP DATABASE events_conn1_test2;
DROP DATABASE events_conn1_test3;
SET GLOBAL event_scheduler=off;
DROP DATABASE events_conn1_test4;
SET GLOBAL event_scheduler=on;
connection conn2;
disconnect conn2;
connection conn3;
disconnect conn3;
connection default;
USE events_test;
DROP TABLE fill_it1;
DROP TABLE fill_it2;

View File

@ -6,6 +6,7 @@ create user mysqltest_user1@localhost;
grant create, insert, select, delete on mysqltest_db2.*
to mysqltest_user1@localhost;
create database mysqltest_db2;
connect conn1,localhost,mysqltest_user1,,mysqltest_db2;
set autocommit=off;
select @@autocommit;
@@autocommit
@ -41,6 +42,8 @@ a
OK: drop event: insufficient privileges
delete from t1;
commit work;
disconnect conn1;
connection default;
drop user mysqltest_user1@localhost;
drop database mysqltest_db2;
drop database events_test;

View File

@ -12,11 +12,14 @@ drop table t0;
#
# MDEV-5047 virtual THD::~THD(): Assertion `status_var.memory_used == 0' fails on disconnect
#
connect con1,localhost,root,,;
ALTER TABLE nonexisting ENABLE KEYS;
ERROR 42S02: Table 'test.nonexisting' doesn't exist
SHOW WARNINGS;
Level Code Message
Error 1146 Table 'test.nonexisting' doesn't exist
disconnect con1;
connection default;
SELECT 1;
1
1

View File

@ -9,10 +9,13 @@ Warning 1364 Field 'x509_subject' doesn't have a default value
Warning 1364 Field 'authentication_string' doesn't have a default value
flush privileges;
connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u1;
ERROR HY000: Plugin 'bar' is not loaded
connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u2;
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)
connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,u2,password;
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES)
ERROR HY000: Plugin 'bar' is not loaded
ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO)

View File

@ -1,6 +1,7 @@
update mysql.user set plugin='unix_socket';
flush privileges;
connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
connect fail,localhost,$USER;
ERROR HY000: Plugin 'unix_socket' is not loaded
ERROR HY000: Plugin 'unix_socket' is not loaded
install plugin unix_socket soname 'auth_socket.so';

View File

@ -18,17 +18,21 @@ DROP FUNCTION f1;
# Bug #11747102
# 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES
#
# connection 1
connect con1, localhost, root;
connect con2, localhost, root;
connection con1;
CREATE TABLE t1(f0 int auto_increment primary key, f1 int);
INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5);
SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed';
# Sending: (not reaped since connection is killed later)
SELECT * FROM t1 ORDER BY f1 ASC, f0;
# connection 2
connection con2;
SET DEBUG_SYNC='now WAIT_FOR filesort_started';
KILL @id;
SET DEBUG_SYNC='now SIGNAL filesort_killed';
# connection default
connection default;
disconnect con1;
disconnect con2;
SET DEBUG_SYNC= "RESET";
DROP TABLE t1;
#

View File

@ -8,26 +8,31 @@ GRANT CREATE, DROP ON *.* TO user2@localhost;
GRANT RELOAD, SELECT ON *.* TO user3@localhost;
GRANT SELECT, LOCK TABLES ON *.* TO user4@localhost;
GRANT RELOAD, LOCK TABLES ON *.* TO user5@localhost;
# Connection con1 as user1
connect con1, localhost, user1;
FLUSH TABLE db1.t1 FOR EXPORT;
UNLOCK TABLES;
# Connection default
# Connection con1 as user2
disconnect con1;
connection default;
connect con1, localhost, user2;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
# Connection default
# Connection con1 as user3
disconnect con1;
connection default;
connect con1, localhost, user3;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied for user 'user3'@'localhost' to database 'db1'
# Connection default
# Connection con1 as user4
disconnect con1;
connection default;
connect con1, localhost, user4;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
# Connection default
# Connection con1 as user5
disconnect con1;
connection default;
connect con1, localhost, user5;
FLUSH TABLE db1.t1 FOR EXPORT;
ERROR 42000: SELECT command denied to user 'user5'@'localhost' for table 't1'
# Connection default
disconnect con1;
connection default;
DROP USER user1@localhost, user2@localhost, user3@localhost,
user4@localhost, user5@localhost;
DROP TABLE db1.t1;

View File

@ -71,26 +71,26 @@ DROP VIEW v1;
#
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
# Connection con1
connect con1, localhost, root;
START TRANSACTION;
INSERT INTO t1 VALUES (1, 1);
# Connection default
connection default;
# Should be blocked
# Sending:
FLUSH TABLES t1 FOR EXPORT;
# Connection con1
connection con1;
COMMIT;
# Connection default
connection default;
# Reaping: FLUSH TABLES t1 FOR EXPORT
# Connection con1
connection con1;
# Should not be blocked
INSERT INTO t2 VALUES (1);
# Should be blocked
# Sending:
INSERT INTO t1 VALUES (2, 2);
# Connection default
connection default;
UNLOCK TABLES;
# Connection con1
connection con1;
# Reaping: INSERT INTO t1 VALUES (2, 2);
# Test 3: Read operations should not be affected.
#
@ -99,17 +99,17 @@ SELECT * FROM t1;
a b
1 1
2 2
# Connection default
connection default;
# Should not be blocked
FLUSH TABLES t1 FOR EXPORT;
# Connection con1
connection con1;
COMMIT;
# Should not be blocked
SELECT * FROM t1;
a b
1 1
2 2
# Connection default
connection default;
UNLOCK TABLES;
# Test 4: Blocked by DDL, blocks DDL.
#
@ -118,39 +118,40 @@ SELECT * FROM t1;
a b
1 1
2 2
# Connection con2
connect con2, localhost, root;
# Sending:
ALTER TABLE t1 ADD INDEX i1(b);
# Connection con1
connection con1;
# Should be blocked
FLUSH TABLE t1 FOR EXPORT;
# Connection default
connection default;
COMMIT;
# Connection con2
connection con2;
# Reaping ALTER TABLE ...
# Connection con1
connection con1;
# Reaping FLUSH TABLE t1 FOR EXPORT
UNLOCK TABLES;
# Connection default
connection default;
FLUSH TABLE t1 FOR EXPORT;
# Connection con2
connection con2;
# Should be blocked
DROP TABLE t1;
# Connection default
connection default;
UNLOCK TABLES;
# Connection con2
connection con2;
# Reaping DROP TABLE t1
# Connection default
disconnect con2;
connection default;
DROP TABLE t2;
# Test 5: Compatibilty with FLUSH TABLES WITH READ LOCK
#
CREATE TABLE t1(a INT) engine= InnoDB;
FLUSH TABLES WITH READ LOCK;
# Connection con1
connection con1;
# This should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Connection default
connection default;
UNLOCK TABLES;
DROP TABLE t1;
# Test 6: Unsupported storage engines.
@ -159,8 +160,9 @@ CREATE TABLE t1(a INT) engine= MEMORY;
FLUSH TABLE t1 FOR EXPORT;
ERROR HY000: Storage engine MEMORY of the table `test`.`t1` doesn't have this option
DROP TABLE t1;
# Connection con1
# Connection defalt
connection con1;
disconnect con1;
connection default;
# Test 7: Check privileges required.
# in flush-innodb-notembedded.test
# Test 8: FLUSH TABLE <table_list> FOR EXPORT is incompatible
@ -169,38 +171,39 @@ DROP TABLE t1;
#
CREATE TABLE t1 (a INT) engine= InnoDB;
CREATE TABLE t2 (a INT) engine= InnoDB;
# Connection con1
connect con1, localhost, root;
FLUSH TABLE t1 FOR EXPORT;
# Connection default
connection default;
# This should not block
FLUSH TABLE t2 FOR EXPORT;
UNLOCK TABLES;
# This should block
# Sending:
FLUSH TABLE t1 FOR EXPORT;
# Connection con1
connection con1;
UNLOCK TABLES;
# Connection default
connection default;
# Reaping: FLUSH TABLE t1 FOR EXPORT
UNLOCK TABLES;
# Test 9: LOCK TABLES ... READ is not affected
#
LOCK TABLE t1 READ;
# Connection con1
connection con1;
# Should not block
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Connection default
connection default;
UNLOCK TABLES;
FLUSH TABLE t1 FOR EXPORT;
# Connection con1
connection con1;
# Should not block
LOCK TABLE t1 READ;
UNLOCK TABLES;
# Connection default
connection default;
UNLOCK TABLES;
# Connection con1
# Connection default
connection con1;
disconnect con1;
connection default;
DROP TABLE t1, t2;
# Test 10: Lock is released if transaction is started after doing
# 'flush table..' in same session
@ -217,30 +220,30 @@ UNLOCK TABLES;
DROP TABLE t1;
# Test 11: Test 'flush table with fully qualified table names
# and with syntax local/NO_WRITE_TO_BINLOG
# Connection con1
# Connection default
connect con1, localhost, root;
connection default;
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
INSERT INTO t1 VALUES (100),(200);
FLUSH LOCAL TABLES test.t1 FOR EXPORT;
# Connection con1
connection con1;
# Should be blocked
# Sending:
FLUSH LOCAL TABLES t1 FOR EXPORT;
# Connection default
connection default;
UNLOCK TABLE;
# Connection con1
connection con1;
# Reaping: FLUSH LOCAL TABLES t1 FOR EXPORT
SELECT * FROM t1 ORDER BY i;
i
100
200
# Connection default
connection default;
# Should be blocked
# Sending:
FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT;
# Connection con1
connection con1;
UNLOCK TABLES;
# Connection default
connection default;
# Reaping: FLUSH NO_WRITE_TO_BINLOG TABLES test.t1 FOR EXPORT
SELECT * FROM t1 ORDER BY i;
i
@ -250,7 +253,7 @@ UNLOCK TABLE;
DROP TABLE t1;
# Test 12: Active transaction get committed if user execute
# "FLUSH TABLE ... FOR EXPORT" or "LOCK TABLE.."
# Connection default
connection default;
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
INSERT INTO t1 VALUES (100),(200);
START TRANSACTION;
@ -278,7 +281,7 @@ UNLOCK TABLES;
DROP TABLE t1;
# Test 13: Verify "FLUSH TABLE ... FOR EXPORT" and "LOCK TABLE.."
# in same session
# Connection default
connection default;
CREATE TABLE t1 ( i INT ) ENGINE = Innodb;
# Lock table
LOCK TABLES test.t1 WRITE;
@ -294,6 +297,9 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
LOCK TABLES test.t1 WRITE;
UNLOCK TABLES;
DROP TABLE t1;
connection con1;
disconnect con1;
connection default;
# Reset innodb_file_per_table
SET GLOBAL innodb_file_per_table= @old_innodb_file_per_table;
# End of 5.6 tests

View File

@ -1,27 +1,42 @@
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
drop table if exists t1,t2;
drop database if exists mysqltest;
create temporary table t1(n int not null primary key);
create table t2(n int);
insert into t2 values(3);
connection con1;
select * from t1;
n
3
connection con2;
flush tables with read lock and disable checkpoint;
drop table t2;
ERROR HY000: Can't execute the query because you have a conflicting read lock
connection con1;
drop table t2;
connection con2;
unlock tables;
connection con1;
connection con1;
create database mysqltest;
create table mysqltest.t1(n int);
insert into mysqltest.t1 values (23);
flush tables with read lock;
connection con2;
drop database mysqltest;
connection con1;
select * from mysqltest.t1;
n
23
unlock tables;
connection con2;
connection con1;
create table t1 (n int);
flush tables with read lock;
disconnect con1;
connection con2;
insert into t1 values (345);
select * from t1;
n
@ -54,10 +69,22 @@ unlock tables;
drop table t1, t2, t3;
create table t1 (c1 int);
create table t2 (c1 int);
connect con1,localhost,root,,;
connect con3,localhost,root,,;
connection con1;
lock table t1 write;
connection con2;
flush tables with read lock;
connection con3;
insert into t2 values(1);
connection con1;
unlock tables;
disconnect con1;
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection default;
drop table t1, t2;
drop table if exists t1, t2;
set session low_priority_updates=1;
@ -77,7 +104,10 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
unlock tables;
drop table t1, t2;
set session low_priority_updates=default;
connect con1,localhost,root,,;
select benchmark(200, (select sin(1))) > 1000;
disconnect con1;
connection default;
End of 5.0 tests
set @old_general_log= @@general_log;
set @old_read_only= @@read_only;
@ -189,13 +219,14 @@ insert into t3 (a) values (2);
#
# III. Concurrent tests.
#
# --> connection default
connect con1,localhost,root,,;
#
# Check that flush tables <list> with read lock
# does not affect non-locked tables.
connection default;
#
flush tables t1 with read lock;
# --> connection con1;
connection con1;
select * from t1;
a
1
@ -203,7 +234,7 @@ select * from t2;
a
1
insert into t2 (a) values (3);
# --> connection default;
connection default;
unlock tables;
#
# Check that "FLUSH TABLES <list> WITH READ LOCK" is
@ -211,13 +242,13 @@ unlock tables;
# Vice versa it is not true, since tables read-locked by
# "FLUSH TABLES <list> WITH READ LOCK" can't be flushed.
flush tables with read lock;
# --> connection con1;
connection con1;
flush table t1 with read lock;
select * from t1;
a
1
unlock tables;
# --> connection default;
connection default;
unlock tables;
#
# Check that FLUSH TABLES t1 WITH READ LOCK
@ -225,32 +256,34 @@ unlock tables;
# WITH READ LOCK.
#
flush table t1 with read lock;
# --> connection con1
connection con1;
flush table t2 with read lock;
unlock tables;
# --> connection default
connection default;
unlock tables;
#
# Check that FLUSH TABLES t1 WITH READ LOCK
# does not conflict with SET GLOBAL read_only=1.
#
set global read_only=1;
# connection con1
connection con1;
flush table t1 with read lock;
unlock tables;
# connection default
connection default;
set global read_only=0;
#
# Check that it's possible to read-lock
# tables locked with FLUSH TABLE <list> WITH READ LOCK.
#
flush tables t1, t2 with read lock;
# connection con1
connection con1;
lock table t1 read, t2 read;
unlock tables;
# connection default
connection default;
unlock tables;
# --> connection con1
connection con1;
disconnect con1;
connection default;
drop table t1, t2, t3;
#
# Bug#51710 FLUSH TABLES <view> WITH READ LOCK kills the server
@ -309,33 +342,35 @@ drop table t1;
# transactions unnecessarily.
#
drop table if exists t1;
# --> conection default
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection default;
create table t1 (a int);
begin;
select * from t1;
a
# --> connection con1
connection con1;
#
# Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
# or a long-running select -- anything that
# prevents FLUSH TABLE t1 from immediate completion would do.
#
lock table t1 read;
# --> connection con2
connection con2;
#
# FLUSH TABLE expels the table definition from the cache.
# Sending 'flush table t1'...
flush table t1;
# --> connection default
connection default;
# Let flush table sync in.
select * from t1;
# --> connection con1
connection con1;
select * from t1;
a
unlock tables;
# --> connection con2
connection con2;
# Reaping 'flush table t1'...
# --> connection default
connection default;
# Reaping 'select * from t1'...
a
commit;
@ -345,33 +380,35 @@ commit;
begin;
select * from t1;
a
# --> connection con1
connection con1;
#
# Issue a LOCK TABLE t1 READ.
#
lock table t1 read;
# --> connection con2
connection con2;
#
# FLUSH TABLES expels the table definition from the cache.
# Sending 'flush tables'...
flush tables;
# --> connection default
connection default;
# Let flush table sync in.
select * from t1;
# --> connection con1
connection con1;
select * from t1;
a
unlock tables;
# --> connection con2
connection con2;
# Reaping 'flush tables'...
# --> connection default
connection default;
# Reaping 'select * from t1'...
a
commit;
# Cleanup
# --> connection con1
# --> connection con2
# --> connection default
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection default;
drop table t1;
#
# Test for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge table
@ -428,28 +465,36 @@ drop tables tm, t1, t2;
# FLUSH TABLES WITH READ LOCK".
#
drop table if exists t1, t2;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection default;
create table t1 (i int);
create table t2 (i int);
handler t1 open;
# Switching to connection 'con1'.
connection con1;
# Sending:
flush tables with read lock;
# Switching to connection 'con2'.
connection con2;
# Wait until FTWRL starts waiting for 't1' to be closed.
# Switching to connection 'default'.
connection default;
# The below statement should not cause deadlock.
# Sending:
insert into t2 values (1);
# Switching to connection 'con2'.
connection con2;
# Wait until INSERT starts to wait for FTWRL to go away.
# Switching to connection 'con1'.
connection con1;
# FTWRL should be able to continue now.
# Reap FTWRL.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap INSERT.
handler t1 close;
# Cleanup.
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection default;
drop tables t1, t2;
#
# Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads
@ -481,12 +526,13 @@ INSERT INTO t1 VALUES (1, 1);
CREATE TRIGGER t1_au AFTER UPDATE ON t1 FOR EACH ROW SET @var = "a";
BEGIN;
UPDATE t1 SET value= value + 1 WHERE id = 1;
# Switching to connection 'con1'.
connect con1, localhost, root;
# The below FLUSH TABLES WITH READ LOCK should succeed and
# should not be blocked by the transaction in default connection.
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
# Switching to connection 'default'.
disconnect con1;
connection default;
COMMIT;
DROP TABLE t1;
#

View File

@ -1,50 +1,50 @@
# Save the initial number of concurrent sessions
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Establish connection con3 (user=root)
# Switch to connection con1
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connect con3,localhost,root,,;
connection con1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
BEGIN;
INSERT INTO t1 VALUES(1);
# Switch to connection con2
connection con2;
FLUSH TABLES WITH READ LOCK;
# Switch to connection con1
connection con1;
# Sending:
COMMIT;
# Switch to connection con2
connection con2;
# Wait until COMMIT gets blocked.
# Verify that 'con1' was blocked and data did not move.
SELECT * FROM t1;
a
UNLOCK TABLES;
# Switch to connection con1
connection con1;
# Reaping COMMIT
# Switch to connection con1
connection con1;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
1
# Switch to connection con2
connection con2;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
# Switch to connection con3
connection con3;
FLUSH TABLES WITH READ LOCK;
# Switch to connection con1
connection con1;
COMMIT;
# Switch to connection con2
connection con2;
a
1
COMMIT;
# Switch to connection con3
connection con3;
UNLOCK TABLES;
# Switch to connection con2
connection con2;
COMMIT;
# Switch to connection con1
connection con1;
BEGIN;
INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK;
# Switch to connection con2
connection con2;
FLUSH TABLES WITH READ LOCK;
UNLOCK TABLES;
BEGIN;
@ -57,7 +57,10 @@ Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
COMMIT;
# Cleanup
# Switch to connection default and close connections con1, con2, con3
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
# We commit open transactions when we disconnect: only then we can
# drop the table.
DROP TABLE t1;

View File

@ -1,30 +1,36 @@
# Save the initial number of concurrent sessions
# Establish connection con1 (user=root)
# Establish connection con2 (user=root)
# Switch to connection con1
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER;
SET AUTOCOMMIT=0;
SELECT 1;
1
1
# Switch to connection con2
connection con2;
FLUSH TABLES WITH READ LOCK;
include/show_binlog_events.inc
# Switch to connection con1
connection con1;
INSERT INTO t1 VALUES (1);
# Switch to connection con2
connection con2;
include/show_binlog_events.inc
UNLOCK TABLES;
# Switch to connection con1
connection con1;
DROP TABLE t1;
SET AUTOCOMMIT=1;
create table t1 (a int) engine=innodb;
connection con1;
flush tables with read lock;
connection con2;
begin;
insert into t1 values (1);;
connection con1;
unlock tables;
connection con2;
commit;
drop table t1;
# Switch to connection default and close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
# Wait till all disconnects are completed

View File

@ -85,6 +85,10 @@ insert into t1_temp values (1);
return 0;
end|
create event e1 on schedule every 1 minute do begin end;
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connect con3,localhost,root,,;
connection default;
#
# Test compatibility of FLUSH TABLES WITH READ LOCK
# with various statements.
@ -186,34 +190,34 @@ unlock tables;
# COMMIT is blocked by active FTWRL in another
# connection.
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
begin;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
# Do some work so ROLLBACK is not a no-op.
insert into t3_trans values (1);
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
rollback;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
begin;
# Do some work so COMMIT is not a no-op.
insert into t3_trans values (1);
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
# Send:
commit;
# Switching to connection 'con1'.
connection con1;
# Wait until COMMIT is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap COMMIT.
delete from t3_trans;
#
@ -223,18 +227,18 @@ insert into t3_trans values (1);
set debug_sync='RESET';
set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
commit;
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
# Switching to connection 'con2'.
connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap COMMIT.
# Switching to connection 'con1'.
connection con1;
# Reap FTWRL.
unlock tables;
# Switching to connection 'default'.
connection default;
delete from t3_trans;
set debug_sync= "RESET";
# We don't run similar test for BEGIN and ROLLBACK as
@ -447,30 +451,30 @@ unlock tables;
# Check that active FTWRL in another connection
# blocks EXECUTE which changes data.
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
execute stmt1 ;
# Switching to connection 'con1'.
connection con1;
# Check that EXECUTE is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap EXECUTE.
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
execute stmt1; ;
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
# Switching to connection 'con2'.
connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap EXECUTE.
# Switching to connection 'con1'.
connection con1;
# Reap FTWRL.
unlock tables;
# Switching to connection 'default'.
connection default;
set debug_sync= "RESET";
delete from t1_base;
deallocate prepare stmt1;
@ -631,20 +635,19 @@ drop trigger t1_bi;
# Check that FTWRL statements can be run while FTWRL
# is active in another connection.
#
# Switching to connection 'con1'.
flush tables with read lock;
# The second FTWRL in a row is allowed at the moment.
# It does not make much sense as it does only flush.
flush tables with read lock;
unlock tables;
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
flush tables with read lock;
unlock tables;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
#
# 14.2) FLUSH TABLES <list> WITH READ LOCK is not blocked by
# active FTWRL. But since the latter keeps tables open
@ -654,25 +657,25 @@ flush tables with read lock;
# It does not make much sense though.
flush tables t1_base, t2_base with read lock;
unlock tables;
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
flush tables t1_base, t2_base with read lock;
unlock tables;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
flush tables t1_base, t2_base with read lock;
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'con2'.
connection con2;
# Wait until FTWRL is blocked.
# Switching to connection 'default'.
connection default;
unlock tables;
# Switching to connection 'con1'.
connection con1;
# Reap FTWRL.
unlock tables;
# Switching to connection 'default'.
connection default;
#
# 14.3) FLUSH TABLES is compatible with FTWRL.
Success: Was able to run 'flush tables' under FTWRL.
@ -711,16 +714,16 @@ unlock tables;
# Check that HANDLER statements can be run while FTWRL
# is active in another connection.
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
handler t1_base open;
handler t1_base read first;
i
handler t1_base close;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
#
# 17) HELP statement is compatible with FTWRL.
#
@ -767,24 +770,24 @@ unlock tables;
# Check that KILL statements can be run while FTWRL
# is active in another connection.
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
kill query @id;
ERROR 70100: Query execution was interrupted
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
# Finally check that KILL doesn't block FTWRL
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
kill query @id;
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap KILL.
ERROR 70100: Query execution was interrupted
set debug_sync='RESET';
@ -814,14 +817,14 @@ flush tables with read lock;
lock tables t1_base read;
unlock tables;
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
lock tables t1_base read;
unlock tables;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
#
# 21.b) LOCK TABLES WRITE on a base table is disallowed
# under FTWRL and should be blocked by active FTWRL.
@ -830,14 +833,14 @@ lock tables t1_base write;
ERROR HY000: Can't execute the query because you have a conflicting read lock
unlock tables;
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
lock tables t1_base write ;
# Switching to connection 'con1'.
connection con1;
# Check that LOCK TABLES WRITE is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap LOCK TABLES WRITE
unlock tables;
#
@ -848,14 +851,14 @@ flush tables with read lock;
lock tables t1_temp write;
unlock tables;
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
lock tables t1_temp write;
unlock tables;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
#
# 22) OPTIMIZE TABLE statement.
#
@ -868,14 +871,14 @@ test.t1_base optimize Error Can't execute the query because you have a conflicti
test.t1_base optimize error Corrupt
unlock tables;
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
optimize table t1_base;
# Switching to connection 'con1'.
connection con1;
# Check that OPTIMIZE TABLE is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap OPTIMIZE TABLE
Table Op Msg_type Msg_text
test.t1_base optimize status OK
@ -919,32 +922,32 @@ commit;
# Check that these statements are not blocked by
# active FTWRL in another connection.
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
begin;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
# Do some changes to avoid SAVEPOINT and friends
# being almost no-ops.
insert into t3_trans values (1);
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
savepoint sv1;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
insert into t3_trans values (2);
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
rollback to savepoint sv1;
release savepoint sv1;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
rollback;
# Check that these statements don't block FTWRL in
# another connection.
@ -955,31 +958,31 @@ insert into t3_trans values (1);
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
savepoint sv1;
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap SAVEPOINT
insert into t3_trans values (2);
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
rollback to savepoint sv1;
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap ROLLBACK TO SAVEPOINT
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
release savepoint sv1;
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
unlock tables;
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap RELEASE SAVEPOINT
rollback;
set debug_sync= "RESET";
@ -1009,14 +1012,14 @@ test.t1_base repair Error Can't execute the query because you have a conflicting
test.t1_base repair error Corrupt
unlock tables;
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
repair table t1_base;
# Switching to connection 'con1'.
connection con1;
# Check that REPAIR TABLE is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap REPAIR TABLE
Table Op Msg_type Msg_text
test.t1_base repair status OK
@ -1155,25 +1158,25 @@ delete from t3_temp_trans;
# SET AUTOCOMMIT=1 is blocked by active FTWRL in
# another connection.
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
set autocommit= 0;
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
# Do some work so implicit commit in SET AUTOCOMMIT=1
# is not a no-op.
insert into t3_trans values (1);
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
# Send:
set autocommit= 1;
# Switching to connection 'con1'.
connection con1;
# Wait until SET AUTOCOMMIT=1 is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap SET AUTOCOMMIT=1.
delete from t3_trans;
#
@ -1183,18 +1186,18 @@ insert into t3_trans values (1);
set debug_sync='RESET';
set debug_sync='ha_commit_trans_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
set autocommit= 1;
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
# Switching to connection 'con2'.
connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap SET AUTOCOMMIT=1.
# Switching to connection 'con1'.
connection con1;
# Reap FTWRL.
unlock tables;
# Switching to connection 'default'.
connection default;
delete from t3_trans;
set debug_sync= "RESET";
#
@ -1308,36 +1311,37 @@ unlock tables;
# Check that XA non-COMMIT statements are not and COMMIT is
# blocked by active FTWRL in another connection
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
xa start 'test1';
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
insert into t3_trans values (1);
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
xa start 'test1';
insert into t3_trans values (1);
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
connection default;
xa end 'test1';
xa prepare 'test1';
# Send:
xa commit 'test1';;
# Switching to connection 'con1'.
connection con1;
# Wait until XA COMMIT is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap XA COMMIT.
delete from t3_trans;
#
@ -1349,18 +1353,18 @@ xa prepare 'test1';
set debug_sync='RESET';
set debug_sync='trans_xa_commit_after_acquire_commit_lock SIGNAL parked WAIT_FOR go';
xa commit 'test1';
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
# Switching to connection 'con2'.
connection con2;
# Wait until FTWRL is blocked.
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap XA COMMIT.
# Switching to connection 'con1'.
connection con1;
# Reap FTWRL.
unlock tables;
# Switching to connection 'default'.
connection default;
delete from t3_trans;
set debug_sync= "RESET";
#
@ -1413,14 +1417,14 @@ Table Op Msg_type Msg_text
test.t3_trans analyze status OK
unlock tables;
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
analyze table t3_trans;
# Switching to connection 'con1'.
connection con1;
# Check that ANALYZE TABLE is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap ANALYZE TABLE
Table Op Msg_type Msg_text
test.t3_trans analyze status OK
@ -1478,28 +1482,28 @@ Success: Was able to run FTWRL while 'alter table t3_temp_trans add column c1 in
begin;
insert into t3_trans values (1);
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
check table t1_base;
# Switching to connection 'con1'.
connection con1;
# Check that CHECK TABLE is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap CHECK TABLE
Table Op Msg_type Msg_text
test.t1_base check status OK
begin;
delete from t3_trans;
#
# Switching to connection 'con1'.
connection con1;
flush tables with read lock;
# Switching to connection 'default'.
connection default;
alter table t1_temp add column c1 int;
# Switching to connection 'con1'.
connection con1;
# Check that ALTER TABLE is blocked.
unlock tables;
# Switching to connection 'default'.
connection default;
# Reap ALTER TABLE
alter table t1_temp drop column c1;
#
@ -1512,10 +1516,10 @@ alter table t1_temp drop column c1;
begin;
insert into t1_base values (1);
insert into t3_trans values (1);
# Switching to connection 'con1'.
connection con1;
# The below FTWRL should not be blocked by transaction in 'default'.
flush tables with read lock;
# Switching to connection 'default'.
connection default;
# Transaction still is able to read even with FTWRL active in another
# connection.
select * from t1_base;
@ -1526,9 +1530,9 @@ j
select * from t3_trans;
i
1
# Switching to connection 'con1'.
connection con1;
unlock tables;
# Switching to connection 'default'.
connection default;
commit;
delete from t1_base;
delete from t3_trans;
@ -1541,25 +1545,25 @@ delete from t3_trans;
set debug_sync='RESET';
set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go';
insert into t1_base values (1);
# Switching to connection 'con1'.
connection con1;
set debug_sync='now WAIT_FOR parked';
flush tables with read lock;
# Switching to connection 'con2'.
connection con2;
# Wait until FTWRL is blocked.
# Try to run another INSERT and see that it is blocked.
insert into t2_base values (1);;
# Switching to connection 'con3'.
connection con3;
# Wait until new INSERT is blocked.
# Unblock INSERT in the first connection.
set debug_sync='now SIGNAL go';
# Switching to connection 'default'.
connection default;
# Reap first INSERT.
# Switching to connection 'con1'.
connection con1;
# Reap FTWRL.
unlock tables;
# Switching to connection 'con2'.
connection con2;
# Reap second INSERT.
# Switching to connection 'default'.
connection default;
set debug_sync= "RESET";
delete from t1_base;
delete from t2_base;
@ -1573,23 +1577,23 @@ delete from t2_base;
# only taken when there were such modifications.
flush tables with read lock;
# Switching to connection 'con1'.
connection con1;
# The below FTWRL should not be blocked by transaction in 'default'.
flush tables with read lock;
# Switching to connection 'default'.
connection default;
select * from t1_base;
i
select * from t3_trans;
i
commit;
# Switching to connection 'con1'.
connection con1;
select * from t1_base;
i
select * from t3_trans;
i
commit;
unlock tables;
# Switching to connection 'default'.
connection default;
unlock tables;
#
# Check how FLUSH TABLE WITH READ LOCK is handled for MERGE tables.
@ -1669,4 +1673,7 @@ drop database `#mysql50#mysqltest-2`;
drop database mysqltest1;
drop temporary tables t1_temp, t2_temp;
drop tables t1_base, t2_base, t3_trans;
disconnect con1;
disconnect con2;
disconnect con3;
set global sql_mode=default;

View File

@ -1,8 +1,11 @@
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connection con1;
DROP TABLE IF EXISTS t1;
SET DEBUG_SYNC= 'RESET';
CREATE TABLE t1 (kill_id INT) engine = InnoDB;
INSERT INTO t1 VALUES(connection_id());
# Switching to connection 'default'.
connection default;
# Start transaction.
BEGIN;
INSERT INTO t1 VALUES(connection_id());
@ -11,13 +14,13 @@ INSERT INTO t1 VALUES(connection_id());
SET DEBUG_SYNC='ha_commit_trans_after_acquire_commit_lock SIGNAL acquired WAIT_FOR go';
# Sending:
COMMIT;
# Switching to 'con1'.
connection con1;
# Wait till COMMIT acquires protection against global read
# lock and pauses.
SET DEBUG_SYNC='now WAIT_FOR acquired';
# Sending:
FLUSH TABLES WITH READ LOCK;
# Switching to 'con2'.
connection con2;
SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
((@id := kill_id) - kill_id)
0
@ -25,14 +28,15 @@ SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1;
# to active COMMIT
# Kill connection 'con1'.
KILL CONNECTION @id;
# Switching to 'con1'.
connection con1;
# Try to reap FLUSH TABLES WITH READ LOCK,
# it fail due to killed statement and connection.
Got one of the listed errors
# Switching to 'con2'.
connection con2;
# Resume COMMIT.
SET DEBUG_SYNC='now SIGNAL go';
# Switching to 'default'.
connection default;
# Reaping COMMIT.
disconnect con2;
DROP TABLE t1;
SET DEBUG_SYNC= 'RESET';

View File

@ -12,25 +12,35 @@ Table Op Msg_type Msg_text
test.t1 check status OK
unlock tables;
lock table t1 write;
connect locker,localhost,root,,test;
connection locker;
lock table t1 read;
connection default;
flush table t1;
select * from t1;
a
1
unlock tables;
connection locker;
unlock tables;
connection default;
lock table t1 write;
connection locker;
lock table t1 write;
connection default;
flush table t1;
select * from t1;
a
1
unlock tables;
connection locker;
unlock tables;
select * from t1;
a
1
connection default;
drop table t1;
disconnect locker;
create table t1(table_id char(20) primary key);
create table t2(table_id char(20) primary key);
insert into t1 values ('test.t1');

View File

@ -1,4 +1,6 @@
set global max_allowed_packet=1048576;
connect conn1,localhost,root,,;
connection conn1;
select @test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ';
@test_compress_string:='string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa '
string for test compress function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@ -70,12 +72,15 @@ Warning 1259 ZLIB: Input data corrupted
Warning 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;
set @@global.max_allowed_packet=1048576*100;
connect newconn, localhost, root,,;
select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: XXX
Warning 1292 Truncated incorrect DOUBLE value: XXX
disconnect newconn;
connection default;
set @@global.max_allowed_packet=default;
create table t1(a blob);
insert into t1 values(NULL), (compress('a'));
@ -156,6 +161,8 @@ UNCOMPRESS(CAST(0 AS BINARY(5)))
NULL
Warnings:
Warning 1259 ZLIB: Input data corrupted
disconnect conn1;
connection default;
set global max_allowed_packet=default;
#
# End of 5.5 tests

View File

@ -2220,11 +2220,15 @@ INSERT INTO `t1` (b) VALUES ('2013-07-06 23:59:59');
EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
connect con1,localhost,root,,;
connection con1;
set names utf8;
# Should be the same as above:
EXPLAIN SELECT MIN(b) FROM t1 WHERE b <= '2013-11-06 23:59:59';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
connection default;
disconnect con1;
DROP TABLE t1;
CREATE TABLE `t1` (
`a` int(11) NOT NULL AUTO_INCREMENT,

View File

@ -62,6 +62,7 @@ INSERT INTO t1 VALUES ('default', CONNECTION_ID());
SELECT GET_LOCK('bug16501',600);
GET_LOCK('bug16501',600)
1
connect con1,localhost,root,,;
INSERT INTO t1 VALUES ('con1', CONNECTION_ID());
SELECT IS_USED_LOCK('bug16501') = connection_id
FROM t1
@ -69,19 +70,23 @@ WHERE conn = 'default';
IS_USED_LOCK('bug16501') = connection_id
1
SELECT GET_LOCK('bug16501',600);
connection default;
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
IS_USED_LOCK('bug16501') = CONNECTION_ID()
1
SELECT RELEASE_LOCK('bug16501');
RELEASE_LOCK('bug16501')
1
connection con1;
GET_LOCK('bug16501',600)
1
connection default;
SELECT IS_USED_LOCK('bug16501') = connection_id
FROM t1
WHERE conn = 'con1';
IS_USED_LOCK('bug16501') = connection_id
1
connection con1;
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
IS_USED_LOCK('bug16501') = CONNECTION_ID()
1
@ -91,6 +96,8 @@ RELEASE_LOCK('bug16501')
SELECT IS_USED_LOCK('bug16501');
IS_USED_LOCK('bug16501')
NULL
disconnect con1;
connection default;
DROP TABLE t1;
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
@ -595,7 +602,8 @@ is_free_lock('test')
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
1
# -> Switching to connection 'con1'
connect con1,localhost,root,,;
connection con1;
# IS_USED_LOCK, IS_FREE_LOCK: the lock is acquired in another
# connection
select is_used_lock('test') = connection_id();
@ -612,7 +620,7 @@ get_lock('test', 0)
select release_lock('test');
release_lock('test')
0
# -> Switching to connection 'default'
connection default;
# RELEASE_LOCK returns 1 if it successfully releases a lock
select release_lock('test');
release_lock('test')
@ -625,18 +633,18 @@ NULL
select get_lock('test', 0);
get_lock('test', 0)
1
# -> Switching to connection 'con1'
connection con1;
create table t1 select connection_id() as id;
select get_lock('test', 7200);
# -> Switching to connection 'default'
connection default;
select (@id := id) - id from t1;
(@id := id) - id
0
kill query @id;
# -> Switching to connection 'con1'
connection con1;
get_lock('test', 7200)
NULL
# -> Switching to connection 'default'
connection default;
# GET_LOCK() works recursively
select get_lock('test', 0);
get_lock('test', 0)
@ -685,18 +693,18 @@ release_lock('test3')
select get_lock('test1', 0);
get_lock('test1', 0)
1
# -> Switching to connection 'con1'
connection con1;
select get_lock('test2', 0);
get_lock('test2', 0)
1
select get_lock('test1', 7200);
# -> Switching to connection 'default'
connection default;
select get_lock('test2', 7200);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select release_lock('test1');
release_lock('test1')
1
# -> Switching to connection 'con1'
connection con1;
get_lock('test1', 7200)
1
select release_lock('test2');
@ -705,7 +713,7 @@ release_lock('test2')
select release_lock('test1');
release_lock('test1')
1
# -> Switching to connection 'default'
connection default;
# LOCK/UNLOCK TABLES works fine with a user lock.
lock table t1 write;
select get_lock('test', 0);
@ -755,16 +763,16 @@ release_lock('test2')
select get_lock('test', 0);
get_lock('test', 0)
1
# -> Switching to connection 'con1'
connection con1;
lock table t1 write;
select get_lock('test', 7200);
# -> Switching to connection 'default'
connection default;
lock table t1 read;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select release_lock('test');
release_lock('test')
1
# -> Switching to connection 'con1'
connection con1;
get_lock('test', 7200)
1
select release_lock('test');
@ -772,6 +780,8 @@ release_lock('test')
1
unlock tables;
# cleanup
disconnect con1;
connection default;
drop table t1;
# check too long identifier names
select get_lock(repeat('a', 192), 0);
@ -1382,7 +1392,7 @@ DROP TABLE t2;
#
# MDEV-4018 : Microseconds in GET_LOCK()
#
# -> Switching to connection 'default'
connection default;
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
NULL
@ -1390,7 +1400,8 @@ NULL
select get_lock('test', 0);
get_lock('test', 0)
1
# -> Switching to connection 'con1'
connect con1,localhost,root,,;
connection con1;
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
0
@ -1412,7 +1423,7 @@ get_lock('test', 0.000001)
select get_lock('test', 0.0000000000000001);
get_lock('test', 0.0000000000000001)
0
# -> Switching to connection 'default'
connection default;
select is_used_lock('test') = connection_id();
is_used_lock('test') = connection_id()
1

View File

@ -1,5 +1,7 @@
drop table if exists t1,t2;
set global max_allowed_packet=1048576;
connect conn1,localhost,root,,;
connection conn1;
set names latin1;
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
@ -2911,6 +2913,7 @@ SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
SET @@global.max_allowed_packet=1024*1024*1024;
connect newconn, localhost, root,,;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1073741824
@ -2942,7 +2945,9 @@ Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dac
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
Warning 1292 Truncated incorrect INTEGER value: '511993d3c99719e38a6779073019dacd7178ddb9'
Warning 1292 Truncated incorrect DOUBLE value: '0.000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111'
connection conn1;
SET @@global.max_allowed_packet:= @tmp_max;
disconnect newconn;
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
@ -4542,6 +4547,8 @@ SET NAMES latin2;
EXECUTE stmt;
COLLATION(space(2))
latin2_general_ci
disconnect conn1;
connection default;
set global max_allowed_packet=default;
#
# End of 5.6 tests

View File

@ -1,5 +1,7 @@
drop table if exists t1;
set global max_allowed_packet=1048576;
connect conn1,localhost,root,,;
connection conn1;
set names latin1;
select hex(weight_string(0x010203));
hex(weight_string(0x010203))
@ -91,6 +93,8 @@ NULL
Warnings:
Warning 1301 Result of cast_as_binary() was larger than max_allowed_packet (1048576) - truncated
Warning 1301 Result of weight_string() was larger than max_allowed_packet (1048576) - truncated
disconnect conn1;
connection default;
set global max_allowed_packet=default;
#
# Start of 10.1 tests

View File

@ -48,15 +48,19 @@ DROP TABLE t1;
# with different sets of active defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
connect con1, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.345678;
SET debug_sync = 'before_write_delayed SIGNAL parked WAIT_FOR go';
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
connection default;
SET debug_sync = 'now WAIT_FOR parked';
connect con2, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIME_ZONE="+03:00";
SET TIMESTAMP = 1303200241.456789;
INSERT DELAYED INTO t1 ( a, b ) VALUES (4, '1977-12-19 12:34:56.789123'), (5, '1977-12-19 12:34:57.891234'), (6, '1977-12-19 12:34:58.912345');
connection default;
SET debug_sync = 'now SIGNAL go';
SELECT * FROM t1;
a b
@ -66,6 +70,8 @@ a b
4 1977-12-19 09:34:56
5 1977-12-19 09:34:57
6 1977-12-19 09:34:58
disconnect con1;
disconnect con2;
DROP TABLE t1;
#
# Test of early activation of function defaults.
@ -133,15 +139,19 @@ DROP TABLE t1;
# with different sets of active defaults.
#
CREATE TABLE t1 ( a INT, b TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
connect con1, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIMESTAMP = 1303200241.345678;
SET debug_sync = 'before_write_delayed SIGNAL parked WAIT_FOR go';
INSERT DELAYED INTO t1 ( a ) VALUES (1), (2), (3);
connection default;
SET debug_sync = 'now WAIT_FOR parked';
connect con2, localhost, root,,;
# 2011-04-19 08:04:01 UTC
SET TIME_ZONE="+03:00";
SET TIMESTAMP = 1303200241.456789;
INSERT DELAYED INTO t1 ( a, b ) VALUES (4, '1977-12-19 12:34:56.789123'), (5, '1977-12-19 12:34:57.891234'), (6, '1977-12-19 12:34:58.912345');
connection default;
SET debug_sync = 'now SIGNAL go';
SELECT * FROM t1;
a b
@ -151,6 +161,8 @@ a b
4 1977-12-19 09:34:56.789123
5 1977-12-19 09:34:57.891234
6 1977-12-19 09:34:58.912345
disconnect con1;
disconnect con2;
DROP TABLE t1;
#
# Test of early activation of function defaults.

File diff suppressed because it is too large Load Diff

View File

@ -11,15 +11,27 @@ flush privileges;
grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option;
grant create user on *.* to mysqltest_1@localhost;
create user mysqltest_2@localhost;
connect user_a,localhost,mysqltest_1,,;
connection user_a;
grant select on `my\_1`.* to mysqltest_2@localhost;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
disconnect user_a;
connection default;
grant update on mysql.* to mysqltest_1@localhost;
connect user_b,localhost,mysqltest_1,,;
connection user_b;
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
grant select on `my\_1`.* to mysqltest_3@localhost;
disconnect user_b;
connection default;
grant insert on mysql.* to mysqltest_1@localhost;
connect user_c,localhost,mysqltest_1,,;
connection user_c;
grant select on `my\_1`.* to mysqltest_3@localhost;
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass';
disconnect user_c;
connection default;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
@ -27,6 +39,8 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
grant create user on *.* to mysqltest_1@localhost;
connect user1,localhost,mysqltest_1,,;
connection user1;
select current_user();
current_user()
mysqltest_1@localhost
@ -41,6 +55,8 @@ grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
ERROR 28000: Can't find any matching row in the user table
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
disconnect user1;
connection default;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT CREATE USER ON *.* TO 'mysqltest_1'@'localhost'
@ -56,6 +72,8 @@ delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
create database mysqltest_1;
grant all privileges on `mysqltest\_1`.* to mysqltest_1@localhost with grant option;
connect user2,localhost,mysqltest_1,,;
connection user2;
select current_user();
current_user()
mysqltest_1@localhost
@ -66,6 +84,8 @@ mysqltest_1
test
grant all privileges on `mysqltest_1`.* to mysqltest_1@localhost with grant option;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest_1'
disconnect user2;
connection default;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@ -79,6 +99,8 @@ grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
flush privileges;
use mysqltest;
create table t1 (id int primary key, data varchar(255));
connect mrbad, localhost, mysqltest_1,,mysqltest;
connection mrbad;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
@ -91,16 +113,22 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table '
select * from t1;
id data
1 I can't change it!
disconnect mrbad;
connection default;
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect mrugly, localhost, mysqltest_1,,mysqltest;
connection mrugly;
grant select (a,b) on t1 to mysqltest_2@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
grant select on t1 to mysqltest_3@localhost;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
disconnect mrugly;
connection default;
drop table t1;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
@ -118,14 +146,24 @@ create user mysqltest_6@host6;
create user mysqltest_7@host7;
flush privileges;
drop user mysqltest_3@host3;
connect con8,127.0.0.1,root,,test,$MASTER_MYPORT,;
disconnect con8;
connection default;
drop user mysqltest_1@host1, mysqltest_2@host2, mysqltest_4@host4,
mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7;
connect con9,127.0.0.1,root,,test,$MASTER_MYPORT,;
disconnect con9;
connection default;
create database mysqltest_1;
grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
connect con10,localhost,mysqltest_1,,;
connection con10;
set sql_log_off = 1;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
set sql_log_bin = 0;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
disconnect con10;
connection default;
delete from mysql.user where user like 'mysqltest\_1';
delete from mysql.db where user like 'mysqltest\_1';
drop database mysqltest_1;
@ -270,14 +308,20 @@ GRANT SELECT ON "mysql".* TO '%@a'@'a'
drop user '%@a'@'a';
create user mysqltest_2@localhost;
grant create user on *.* to mysqltest_2@localhost;
connect user3,localhost,mysqltest_2,,;
connection user3;
select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 'user'
create user mysqltest_A@'%';
rename user mysqltest_A@'%' to mysqltest_B@'%';
drop user mysqltest_B@'%';
disconnect user3;
connection default;
drop user mysqltest_2@localhost;
create user mysqltest_3@localhost;
grant INSERT,DELETE,UPDATE on mysql.* to mysqltest_3@localhost;
connect user4,localhost,mysqltest_3,,;
connection user4;
show grants;
Grants for mysqltest_3@localhost
GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
@ -294,12 +338,16 @@ create user mysqltest_A@'%';
rename user mysqltest_B@'%' to mysqltest_C@'%';
drop user mysqltest_C@'%';
drop user mysqltest_A@'%';
disconnect user4;
connection default;
drop user mysqltest_3@localhost;
set @@sql_mode='';
create database mysqltest_1;
create table mysqltest_1.t1 (i int);
insert into mysqltest_1.t1 values (1),(2),(3);
GRANT ALL ON mysqltest_1.t1 TO mysqltest_1@'127.0.0.0/255.0.0.0';
connect n1,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,$MASTER_MYSOCK;
connection n1;
show grants for current_user();
Grants for mysqltest_1@127.0.0.0/255.0.0.0
GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.0/255.0.0.0'
@ -309,15 +357,21 @@ i
1
2
3
disconnect n1;
connection default;
REVOKE ALL ON mysqltest_1.t1 FROM mysqltest_1@'127.0.0.0/255.0.0.0';
delete from mysql.user where user like 'mysqltest\_1';
flush privileges;
drop table mysqltest_1.t1;
grant all on mysqltest_1.* to mysqltest_1@'127.0.0.1';
connect b12302,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,;
connection b12302;
select current_user();
current_user()
mysqltest_1@127.0.0.1
set password = password('changed');
disconnect b12302;
connection default;
select host, length(password) from mysql.user where user like 'mysqltest\_1';
host length(password)
127.0.0.1 41
@ -325,10 +379,14 @@ revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1';
delete from mysql.user where user like 'mysqltest\_1';
flush privileges;
grant all on mysqltest_1.* to mysqltest_1@'127.0.0.0/255.0.0.0';
connect b12302_2,127.0.0.1,mysqltest_1,,mysqltest_1,$MASTER_MYPORT,;
connection b12302_2;
select current_user();
current_user()
mysqltest_1@127.0.0.0/255.0.0.0
set password = password('changed');
disconnect b12302_2;
connection default;
select host, length(password) from mysql.user where user like 'mysqltest\_1';
host length(password)
127.0.0.0/255.0.0.0 41
@ -336,17 +394,38 @@ revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0';
delete from mysql.user where user like 'mysqltest\_1';
flush privileges;
drop database mysqltest_1;
connect n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK;
connection n5;
set password = password("changed");
ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings
disconnect n5;
connection default;
connect con2root,localhost,root,,;
connect con3root,localhost,root,,;
connection default;
lock table mysql.user write;
connection con2root;
flush privileges;
connection con3root;
grant all on *.* to 'mysqltest_1'@'localhost';
connection default;
unlock tables;
connection con2root;
connection con3root;
connection default;
lock table mysql.user write;
connection con2root;
set password for 'mysqltest_1'@'localhost' = password('');
connection con3root;
revoke all on *.* from 'mysqltest_1'@'localhost';
connection default;
unlock tables;
connection con2root;
connection con3root;
connection default;
drop user 'mysqltest_1'@'localhost';
disconnect con2root;
disconnect con3root;
create database TESTDB;
create table t2(a int);
create temporary table t1 as select * from mysql.user;
@ -361,8 +440,11 @@ Warning 1364 Field 'authentication_string' doesn't have a default value
INSERT INTO mysql.db (host, db, user, select_priv) VALUES
('%','TESTDB','mysqltest_1','Y');
FLUSH PRIVILEGES;
connect con1,localhost,mysqltest_1,password,TESTDB;
create database TEStdb;
Got one of the listed errors
connection default;
disconnect con1;
delete from mysql.user;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
insert into mysql.user select * from t1;
@ -373,6 +455,8 @@ SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creato
SET GLOBAL log_bin_trust_function_creators = 1;
GRANT ALL PRIVILEGES ON test.* TO `a@`@localhost;
GRANT EXECUTE ON * TO `a@`@localhost;
connect bug13310,localhost,'a@',,test;
connection bug13310;
CREATE TABLE t2 (s1 INT);
INSERT INTO t2 VALUES (1);
DROP FUNCTION IF EXISTS f2;
@ -383,6 +467,8 @@ f2()
1
DROP FUNCTION f2;
DROP TABLE t2;
disconnect bug13310;
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
DROP USER `a@`@localhost;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
@ -394,35 +480,48 @@ create database mysqltest_2;
grant all on mysqltest_1.* to mysqltest_u1@localhost;
use mysqltest_2;
create table t1 (i int);
connect user1,localhost,mysqltest_u1,,mysqltest_1;
connection user1;
show create table mysqltest_2.t1;
ERROR 42000: SHOW command denied to user 'mysqltest_u1'@'localhost' for table 't1'
create table t1 like mysqltest_2.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
connection default;
grant select on mysqltest_2.t1 to mysqltest_u1@localhost;
connection user1;
show create table mysqltest_2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t1 like mysqltest_2.t1;
connection default;
disconnect user1;
use test;
drop database mysqltest_1;
drop database mysqltest_2;
drop user mysqltest_u1@localhost;
grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option;
grant usage on *.* to mysqltest_2@localhost;
connect con18600_1,localhost,mysqltest_1,,;
create database mysqltest_1;
use mysqltest_1;
create table t1 (f1 int);
grant create on `mysqltest\_1`.* to mysqltest_2@localhost;
grant select on mysqltest_1.t1 to mysqltest_2@localhost;
connect con3,localhost,mysqltest_2,,;
connection con3;
create database mysqltest_3;
ERROR 42000: Access denied for user 'mysqltest_2'@'localhost' to database 'mysqltest_3'
use mysqltest_1;
create table t2(f1 int);
select * from t1;
f1
connection default;
drop database mysqltest_1;
connection default;
disconnect con3;
disconnect con18600_1;
revoke all privileges, grant option from mysqltest_1@localhost;
revoke all privileges, grant option from mysqltest_2@localhost;
drop user mysqltest_1@localhost;
@ -435,6 +534,8 @@ CREATE TABLE t2 (b INT, c INT);
INSERT INTO t2 VALUES (1,100),(2,200);
GRANT SELECT ON t1 TO mysqltest1@localhost;
GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
connect conn1,localhost,mysqltest1,,;
connection conn1;
USE db1;
SELECT c FROM t2;
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
@ -442,6 +543,8 @@ SELECT * FROM t2;
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for table 't2'
SELECT * FROM t1 JOIN t2 USING (b);
ERROR 42000: SELECT command denied to user 'mysqltest1'@'localhost' for column 'c' in table 't2'
connection default;
disconnect conn1;
USE test;
DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
@ -530,8 +633,7 @@ CREATE TABLE mysqltest_db2.t2_1(a INT);
# SQL-statement against temporary tables (loosely follow order in
# sql_command enum).
###########################################################################
# -- connect con1, mysqltest_u1@localhost, mysqltest_db1
connect con1,localhost,mysqltest_u1,,mysqltest_db1;
#
# Variants of CREATE TABLE.
#
@ -770,8 +872,7 @@ DROP TEMPORARY TABLE t1;
# - Check that even outside of SUID context we can access temporary
# table once it is created.
###########################################################################
# -- connect con2, mysqltest_u2@localhost, mysqltest_db1
connect con2,localhost,mysqltest_u2,,mysqltest_db1;
CREATE TEMPORARY TABLE t2(a INT);
ERROR 42000: Access denied for user 'mysqltest_u2'@'localhost' to database 'mysqltest_db1'
CALL p1();
@ -796,8 +897,7 @@ DROP TEMPORARY TABLE t4;
# - Check that once table is created it can be accessed from within any
# context, even by user without any privileges on tables.
###########################################################################
# -- connect con3, mysqltest_u4@localhost, mysqltest_db1
connect con3,localhost,mysqltest_u4,,mysqltest_db1;
CALL p1();
INSERT INTO t4 VALUES (4);
UPDATE t4 SET x = 10 WHERE x = 1;
@ -812,8 +912,7 @@ DROP TEMPORARY TABLE t4;
# - SELECT_ACL, UPDATE_ACL and DELETE_ACL are required to include
# a temporary table into the underlying-table-list.
###########################################################################
# -- connect con4, mysqltest_u5@localhost, mysqltest_db1
connect con4,localhost,mysqltest_u5,,mysqltest_db1;
CREATE TEMPORARY TABLE t7(a INT);
CREATE TEMPORARY TABLE t8(a INT);
CREATE TEMPORARY TABLE t9(a INT);
@ -832,13 +931,12 @@ DROP TEMPORARY TABLE t9;
###########################################################################
# That's all. Cleanup.
###########################################################################
# -- connection: default
# -- disconnect con1
connection default;
# All remaining temporary tables are automatically dropped.
# -- disconnect con2
# -- disconnect con3
# -- disconnect con4
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
SET GLOBAL keycache1.key_buffer_size = 0;
DROP DATABASE mysqltest_db1;
DROP DATABASE mysqltest_db2;

Some files were not shown because too many files have changed in this diff Show More