diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-25 20:51:22 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2016-03-31 10:11:16 +0400 |
commit | 282497dd6d1049b4fb963641504c2733752845a7 (patch) | |
tree | 7288d17c29fbbe9ac47ec51f6988fb954f59a361 /mysql-test/suite/binlog/r | |
parent | 5052e2479e873461bebfcedbc674bbaf57d3c968 (diff) | |
download | mariadb-git-282497dd6d1049b4fb963641504c2733752845a7.tar.gz |
MDEV-6720 - enable connection log in mysqltest by default
Diffstat (limited to 'mysql-test/suite/binlog/r')
20 files changed, 266 insertions, 27 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_bug23533.result b/mysql-test/suite/binlog/r/binlog_bug23533.result index d5cd93284a2..cc9799506c3 100644 --- a/mysql-test/suite/binlog/r/binlog_bug23533.result +++ b/mysql-test/suite/binlog/r/binlog_bug23533.result @@ -5,6 +5,8 @@ COUNT(*) 1000 SET GLOBAL binlog_cache_size=4096; SET GLOBAL max_binlog_cache_size=4096; +disconnect default; +connect default,localhost,root,,test; START TRANSACTION; CREATE TABLE t2 SELECT * FROM t1; ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again @@ -13,3 +15,5 @@ SHOW TABLES LIKE 't%'; Tables_in_test (t%) t1 DROP TABLE t1; +disconnect default; +connect default,localhost,root,,test; diff --git a/mysql-test/suite/binlog/r/binlog_checkpoint.result b/mysql-test/suite/binlog/r/binlog_checkpoint.result index f76fc6da189..a636952a1cd 100644 --- a/mysql-test/suite/binlog/r/binlog_checkpoint.result +++ b/mysql-test/suite/binlog/r/binlog_checkpoint.result @@ -6,8 +6,10 @@ RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam; *** Test that RESET MASTER waits for pending commit checkpoints to complete. +connect con1,localhost,root,,; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; INSERT INTO t2 VALUES (1, REPEAT("x", 4100)); INSERT INTO t2 VALUES (2, REPEAT("x", 4100)); @@ -24,11 +26,14 @@ master-bin.000004 # Gtid_list # # [#-#-#] master-bin.000004 # Binlog_checkpoint # # master-bin.000001 SET DEBUG_SYNC= "execute_command_after_close_tables SIGNAL reset_master_done"; RESET MASTER; +connect con2,localhost,root,,; This will timeout, as RESET MASTER is blocked SET DEBUG_SYNC= "now WAIT_FOR reset_master_done TIMEOUT 1"; Warnings: Warning 1639 debug sync point wait timed out SET DEBUG_SYNC= "now SIGNAL con1_go"; +connection con1; +connection default; show binary logs; Log_name File_size master-bin.000001 # @@ -39,11 +44,15 @@ master-bin.000001 # Gtid_list # # [] master-bin.000001 # Binlog_checkpoint # # master-bin.000001 *** Test that binlog N is active, and commit checkpoint for (N-1) is *** done while there is still a pending commit checkpoint for (N-2). +connection con1; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_continue"; INSERT INTO t1 VALUES (20, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; +connection con2; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR con2_continue"; INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; show binary logs; Log_name File_size @@ -79,6 +88,8 @@ SET DEBUG_SYNC= "RESET"; SET @old_dbug= @@global.DEBUG_DBUG; SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; SET DEBUG_SYNC= "now SIGNAL con2_continue"; +connection con2; +connection default; con1 is still pending, no new binlog checkpoint should have been logged. SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; SET GLOBAL debug_dbug= @old_dbug; @@ -89,6 +100,8 @@ master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION master-bin.000003 # Gtid_list # # [#-#-#] master-bin.000003 # Binlog_checkpoint # # master-bin.000001 SET DEBUG_SYNC= "now SIGNAL con1_continue"; +connection con1; +connection default; No commit checkpoints are pending, a new binlog checkpoint should have been logged. include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -97,6 +110,7 @@ master-bin.000003 # Gtid_list # # [#-#-#] master-bin.000003 # Binlog_checkpoint # # master-bin.000001 master-bin.000003 # Binlog_checkpoint # # master-bin.000003 *** MDEV-4322: Broken XID counting during binlog rotation *** +connection default; SET @old_dbug= @@global.DEBUG_DBUG; SET GLOBAL debug_dbug="+d,inject_binlog_background_thread_before_mark_xid_done"; FLUSH LOGS; @@ -114,8 +128,10 @@ master-bin.000005 # master-bin.000006 # SET debug_sync = 'reset'; *** MDEV-7402: 'reset master' hangs, waits for signalled COND_xid_list *** +connect con3,localhost,root,,; SET debug_sync="reset_logs_after_set_reset_master_pending SIGNAL reset_master_ready WAIT_FOR reset_master_cont"; RESET MASTER; +connection default; SET @old_dbug= @@global.DEBUG_DBUG; SET GLOBAL debug_dbug="+d,inject_binlog_background_thread_before_mark_xid_done"; SET debug_sync="now WAIT_FOR reset_master_ready"; @@ -123,6 +139,8 @@ RESET MASTER; SET debug_sync="now WAIT_FOR injected_binlog_background_thread"; SET GLOBAL debug_dbug=@old_dbug; SET debug_sync="now SIGNAL reset_master_cont"; +connection con3; +connection default; SET debug_sync = 'reset'; DROP TABLE t1, t2; SET GLOBAL max_binlog_size= @old_max_binlog_size; diff --git a/mysql-test/suite/binlog/r/binlog_commit_wait.result b/mysql-test/suite/binlog/r/binlog_commit_wait.result index 07019c12905..89e905b0313 100644 --- a/mysql-test/suite/binlog/r/binlog_commit_wait.result +++ b/mysql-test/suite/binlog/r/binlog_commit_wait.result @@ -4,6 +4,10 @@ SET @old_count= @@GLOBAL.binlog_commit_wait_count; SET GLOBAL binlog_commit_wait_count= 3; SET @old_usec= @@GLOBAL.binlog_commit_wait_usec; SET GLOBAL binlog_commit_wait_usec= 20000000; +connect con1,localhost,root,,test; +connect con2,localhost,root,,test; +connect con3,localhost,root,,test; +connection default; SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status @@ -12,11 +16,16 @@ SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema WHERE variable_name = 'binlog_group_commit_trigger_timeout'; SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; +connection default; SET @a= current_timestamp(); +connection con1; BEGIN; INSERT INTO t1 VALUES (1,0); COMMIT; +connection con2; INSERT INTO t1 VALUES (1,1); +connection con1; +connection default; SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a); SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")); IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")) @@ -37,11 +46,19 @@ SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema. WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; variable_value - @group_commit_trigger_lock_wait 1 +connection con2; ERROR 23000: Duplicate entry '1' for key 'PRIMARY' +connection default; SET @a= current_timestamp(); +connection con1; INSERT INTO t1 VALUES (2,0); +connection con2; INSERT INTO t1 VALUES (3,0); +connection con3; INSERT INTO t1 VALUES (4,0); +connection con1; +connection con2; +connection default; SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a); SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")); IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")) @@ -62,16 +79,23 @@ SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema. WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; variable_value - @group_commit_trigger_lock_wait 1 +connection default; SET @a= current_timestamp(); +connection con1; INSERT INTO t1 VALUES (6,0); +connection con2; BEGIN; UPDATE t1 SET b=b+1 WHERE a=1; +connection con3; UPDATE t1 SET b=b+10 WHERE a=1; +connection con2; SELECT SLEEP(0.25); SLEEP(0.25) 0 UPDATE t1 SET b=b+1 WHERE a=3; COMMIT; +connection con1; +connection default; SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a); SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")); IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")) @@ -92,9 +116,14 @@ SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema. WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; variable_value - @group_commit_trigger_lock_wait 2 +connection default; SET @a= current_timestamp(); +connection con1; INSERT INTO t1 VALUES (7,0); +connection con2; INSERT INTO t1 VALUES (8,0); +connection con3; +connection default; SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a); SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")); IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")) @@ -115,9 +144,12 @@ SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema. WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; variable_value - @group_commit_trigger_lock_wait 2 +connection default; SET @a= current_timestamp(); SET GLOBAL binlog_commit_wait_usec= 5*1000*1000; +connection con1; INSERT INTO t1 VALUES (9,0); +connection default; SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a); SELECT IF(@b < 4, CONCAT("Error: too little time elapsed: ", @b, " seconds < 4"), IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))); @@ -140,6 +172,7 @@ SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema. WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; variable_value - @group_commit_trigger_lock_wait 2 +connection default; SELECT * FROM t1 ORDER BY a; a b 1 11 @@ -150,6 +183,7 @@ a b 7 0 8 0 9 0 +connection default; DROP TABLE t1; SET GLOBAL binlog_commit_wait_count= @old_count; SET GLOBAL binlog_commit_wait_usec= @old_usec; diff --git a/mysql-test/suite/binlog/r/binlog_grant.result b/mysql-test/suite/binlog/r/binlog_grant.result index 618e00af72a..201e7b9e722 100644 --- a/mysql-test/suite/binlog/r/binlog_grant.result +++ b/mysql-test/suite/binlog/r/binlog_grant.result @@ -1,29 +1,43 @@ +connection default; reset master; set @saved_binlog_format = @@global.binlog_format; create user mysqltest_1@localhost; show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +connect plain,localhost,mysqltest_1,,test; +connect root,localhost,root,,test; **** Variable SQL_LOG_BIN **** +connection root; [root] set session sql_log_bin = 1; +connection plain; [plain] set session sql_log_bin = 1; ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation **** Variable BINLOG_FORMAT **** +connection root; [root] set global binlog_format = row; set session binlog_format = row; +connection plain; [plain] set global binlog_format = row; ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation set session binlog_format = row; ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation **** Clean up **** +disconnect plain; +disconnect root; +connection default; set global binlog_format = @saved_binlog_format; drop user mysqltest_1@localhost; CREATE USER 'mysqltest_1'@'localhost'; GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost'; +connect rpl,localhost,mysqltest_1,,; +connection rpl; SHOW MASTER LOGS; SHOW BINARY LOGS; +disconnect rpl; +connection default; DROP USER 'mysqltest_1'@'localhost'; diff --git a/mysql-test/suite/binlog/r/binlog_killed.result b/mysql-test/suite/binlog/r/binlog_killed.result index 9f2d0dc2cd5..cda4e8ad6f4 100644 --- a/mysql-test/suite/binlog/r/binlog_killed.result +++ b/mysql-test/suite/binlog/r/binlog_killed.result @@ -1,13 +1,19 @@ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +connect con1, localhost, root,,; +connect con2, localhost, root,,; create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM; create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB; +connection con1; select get_lock("a", 20); get_lock("a", 20) 1 +connection con2; reset master; insert into t2 values (null, null), (null, get_lock("a", 10)); +connection con1; kill query ID; +connection con2; select (@a:=load_file("MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) is not null; @@ -15,43 +21,56 @@ set @result= 2 - 1 - 1; select @result /* must be zero either way */; @result 0 +connection con1; select RELEASE_LOCK("a"); RELEASE_LOCK("a") 1 delete from t1; delete from t2; insert into t1 values (1,1),(2,2); +connection con1; begin; update t1 set b=11 where a=2; +connection con2; begin; update t1 set b=b+10; +connection con1; kill query ID; rollback; +connection con2; rollback; select * from t1 order by a /* must be the same as before (1,1),(2,2) */; a b 1 1 2 2 +connection con1; begin; delete from t1 where a=2; +connection con2; begin; delete from t1 where a=2; +connection con1; kill query ID; rollback; +connection con2; rollback; select * from t1 order by a /* must be the same as before (1,1),(2,2) */; a b 1 1 2 2 +connection con1; drop table if exists t4; create table t4 (a int, b int) engine=innodb; insert into t4 values (3, 3); begin; insert into t1 values (3, 3); +connection con2; begin; insert into t1 select * from t4 for update; +connection con1; kill query ID; rollback; +connection con2; rollback; select * from t1 /* must be the same as before (1,1),(2,2) */; a b @@ -73,15 +92,19 @@ end| delete from t4; insert into t4 values (1,1), (1,1); reset master; +connection con1; select get_lock("a", 20); get_lock("a", 20) 1 +connection con2; set @b= 0; update t4 set b=b + bug27563(b); +connection con1; select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock'; count(*) 1 kill query ID; +connection con2; ERROR 70100: Query execution was interrupted select * from t4 order by b /* must be (1,1), (1,2) */; a b @@ -107,21 +130,26 @@ is not null select 0 /* must return 0 to mean the killed update is in */; 0 0 +connection con1; select RELEASE_LOCK("a"); RELEASE_LOCK("a") 1 delete from t4; insert into t4 values (1,1), (2,2); reset master; +connection con1; select get_lock("a", 20); get_lock("a", 20) 1 +connection con2; set @b= 0; delete from t4 where b=bug27563(1) or b=bug27563(2); +connection con1; select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock'; count(*) 1 kill query ID; +connection con2; ERROR 70100: Query execution was interrupted select count(*) from t4 /* must be 1 */; count(*) @@ -145,10 +173,14 @@ is not null select 0 /* must return 0 to mean the killed delete is in */; 0 0 +connection con1; select RELEASE_LOCK("a"); RELEASE_LOCK("a") 1 drop table t4; drop function bug27563; +connection default; +disconnect con1; +disconnect con2; drop table t1,t2,t3; end of the tests diff --git a/mysql-test/suite/binlog/r/binlog_mdev342.result b/mysql-test/suite/binlog/r/binlog_mdev342.result index e940fd2a764..9dd806a3c8c 100644 --- a/mysql-test/suite/binlog/r/binlog_mdev342.result +++ b/mysql-test/suite/binlog/r/binlog_mdev342.result @@ -2,15 +2,21 @@ SET GLOBAL max_binlog_size= 4096; SET GLOBAL innodb_flush_log_at_trx_commit= 1; RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; +connect con1,localhost,root,,; SET DEBUG_SYNC= "binlog_open_before_update_index SIGNAL con1_ready WAIT_FOR con1_cont"; SET SESSION debug_dbug="+d,crash_create_critical_before_update_index"; INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; +connect con2,localhost,root,,; SET DEBUG_SYNC= "ha_commit_trans_after_prepare SIGNAL con2_ready"; INSERT INTO t1 VALUES (2, NULL); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; SET DEBUG_SYNC= "now SIGNAL con1_cont"; +connection con1; Got one of the listed errors +connection default; SELECT a FROM t1 ORDER BY a; a 1 @@ -30,4 +36,5 @@ master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ master-bin.000001 # Rotate # # master-bin.000002;pos=POS +connection default; DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 181f254cd5d..710c95546fd 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -758,6 +758,8 @@ INSERT INTO test.t1 VALUES (1), (2); CREATE TABLE test.t2 SELECT * FROM test.t1; USE test; DROP TABLES t1, t2; +connect fresh,localhost,root,,test; +connection fresh; RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY); BINLOG ' @@ -851,3 +853,4 @@ SHOW SESSION VARIABLES LIKE "unique_checks"; Variable_name Value unique_checks OFF DROP TABLE t1; +disconnect fresh; diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result index d7cb9bb97ad..056e658b1fc 100644 --- a/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_row_drop_tbl.result @@ -1,11 +1,20 @@ DROP TABLE IF EXISTS t1; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; RESET MASTER; CREATE TABLE t1 (a INT); SET AUTOCOMMIT=OFF; BEGIN; INSERT INTO t1 VALUES(1); +connection con2; DROP TABLE t1;; +connection con1; COMMIT; +connection con2; +connection default; +disconnect con1; +disconnect con2; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result index dce2cc1408c..d82a9654261 100644 --- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result @@ -1,4 +1,7 @@ DROP DATABASE IF EXISTS `drop-temp+table-test`; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; RESET MASTER; CREATE DATABASE `drop-temp+table-test`; USE `drop-temp+table-test`; @@ -20,6 +23,8 @@ SELECT GET_LOCK("a",10); GET_LOCK("a",10) 1 USE test; +disconnect con1; +connection con2; SELECT GET_LOCK("a",10); GET_LOCK("a",10) 1 @@ -42,12 +47,15 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORAR DROP DATABASE `drop-temp+table-test`; RESET MASTER; CREATE TABLE t1 ( i text ); +connect con1,localhost,root,,; CREATE TEMPORARY TABLE ttmp1 ( i text ); SET @@session.binlog_format=ROW; INSERT INTO t1 VALUES ('1'); SELECT @@session.binlog_format; @@session.binlog_format ROW +disconnect con1; +connection default; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index f8f4fa5ec31..ca5faa9f5a3 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -1,5 +1,8 @@ call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); drop table if exists t1, t2; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; reset master; @@ -100,6 +103,8 @@ get_lock("a",10) begin; insert into t1 values(8); insert into t2 select * from t1; +disconnect con1; +connection con2; select get_lock("a",10); get_lock("a",10) 1 @@ -221,6 +226,8 @@ master-bin.000001 # Query # # SAVEPOINT `my_savepoint` master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Xid # # COMMIT /* XID */ +connect con3,localhost,root,,; +connection con3; delete from t1; delete from t2; alter table t2 engine=MyISAM; @@ -229,12 +236,15 @@ begin; select * from t1 for update; a 1 +connection con2; select (@before:=unix_timestamp())*0; (@before:=unix_timestamp())*0 0 begin; select * from t1 for update; +connection con3; insert into t2 values (20); +connection con2; ERROR HY000: Lock wait timeout exceeded; try restarting transaction select (@after:=unix_timestamp())*0; (@after:=unix_timestamp())*0 @@ -242,9 +252,12 @@ select (@after:=unix_timestamp())*0; select (@after-@before) >= 2; (@after-@before) >= 2 1 +connection con3; commit; +connection con2; drop table t1,t2; commit; +connection con2; begin; create temporary table ti (a int) engine=innodb; rollback; @@ -263,6 +276,8 @@ insert into t0 select GET_LOCK("lock1",0); set autocommit=0; create table t2 (n int) engine=innodb; insert into t2 values (3); +disconnect con2; +connection con3; select get_lock("lock1",60); get_lock("lock1",60) 1 @@ -439,6 +454,8 @@ master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +connect con4,localhost,root,,; +connection con3; reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; @@ -448,6 +465,8 @@ get_lock("a",10) begin; insert into t1 values(8); insert into t2 select * from t1; +disconnect con3; +connection con4; select get_lock("a",10); get_lock("a",10) 1 diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 3a6af15e88a..812fd4386ab 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -573,6 +573,8 @@ INSERT INTO test.t1 VALUES (1), (2); CREATE TABLE test.t2 SELECT * FROM test.t1; USE test; DROP TABLES t1, t2; +connect fresh,localhost,root,,test; +connection fresh; RESET MASTER; CREATE TABLE t1 (a INT PRIMARY KEY); BINLOG ' @@ -665,3 +667,4 @@ SHOW SESSION VARIABLES LIKE "unique_checks"; Variable_name Value unique_checks OFF DROP TABLE t1; +disconnect fresh; diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result index d9f9dc99731..d958bb2602f 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result @@ -1,11 +1,20 @@ DROP TABLE IF EXISTS t1; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; RESET MASTER; CREATE TABLE t1 (a INT); SET AUTOCOMMIT=OFF; BEGIN; INSERT INTO t1 VALUES(1); +connection con2; DROP TABLE t1;; +connection con1; COMMIT; +connection con2; +connection default; +disconnect con1; +disconnect con2; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result index 127df219b02..3b144755aa3 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result @@ -1,4 +1,7 @@ DROP DATABASE IF EXISTS `drop-temp+table-test`; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; RESET MASTER; CREATE DATABASE `drop-temp+table-test`; USE `drop-temp+table-test`; @@ -20,6 +23,8 @@ SELECT GET_LOCK("a",10); GET_LOCK("a",10) 1 USE test; +disconnect con1; +connection con2; SELECT GET_LOCK("a",10); GET_LOCK("a",10) 1 @@ -64,12 +69,15 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORAR DROP DATABASE `drop-temp+table-test`; RESET MASTER; CREATE TABLE t1 ( i text ); +connect con1,localhost,root,,; CREATE TEMPORARY TABLE ttmp1 ( i text ); SET @@session.binlog_format=ROW; INSERT INTO t1 VALUES ('1'); SELECT @@session.binlog_format; @@session.binlog_format ROW +disconnect con1; +connection default; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result index 0ac4716f383..e250c04fa4b 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result @@ -1,6 +1,9 @@ CALL mtr.add_suppression("Statement may not be safe to log in statement format."); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); drop table if exists t1, t2; +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection con1; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; reset master; @@ -96,6 +99,8 @@ insert into t1 values(8); insert into t2 select * from t1; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +disconnect con1; +connection con2; select get_lock("a",10); get_lock("a",10) 1 @@ -205,6 +210,8 @@ master-bin.000001 # Query # # use `test`; insert into t1 values(16) master-bin.000001 # Query # # SAVEPOINT `my_savepoint` master-bin.000001 # Query # # use `test`; insert into t1 values(18) master-bin.000001 # Xid # # COMMIT /* XID */ +connect con3,localhost,root,,; +connection con3; delete from t1; delete from t2; alter table t2 engine=MyISAM; @@ -213,12 +220,15 @@ begin; select * from t1 for update; a 1 +connection con2; select (@before:=unix_timestamp())*0; (@before:=unix_timestamp())*0 0 begin; select * from t1 for update; +connection con3; insert into t2 values (20); +connection con2; ERROR HY000: Lock wait timeout exceeded; try restarting transaction select (@after:=unix_timestamp())*0; (@after:=unix_timestamp())*0 @@ -226,9 +236,12 @@ select (@after:=unix_timestamp())*0; select (@after-@before) >= 2; (@after-@before) >= 2 1 +connection con3; commit; +connection con2; drop table t1,t2; commit; +connection con2; begin; create temporary table ti (a int) engine=innodb; rollback; @@ -249,6 +262,8 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc set autocommit=0; create table t2 (n int) engine=innodb; insert into t2 values (3); +disconnect con2; +connection con3; select get_lock("lock1",60); get_lock("lock1",60) 1 @@ -434,6 +449,8 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE `t2` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */ +connect con4,localhost,root,,; +connection con3; reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; @@ -445,6 +462,8 @@ insert into t1 values(8); insert into t2 select * from t1; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement accesses nontransactional table as well as transactional or temporary table, and writes to any of them. +disconnect con3; +connection con4; select get_lock("a",10); get_lock("a",10) 1 diff --git a/mysql-test/suite/binlog/r/binlog_stm_row.result b/mysql-test/suite/binlog/r/binlog_stm_row.result index 7fc1d1f447c..68df53a3c6e 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_row.result +++ b/mysql-test/suite/binlog/r/binlog_stm_row.result @@ -12,50 +12,54 @@ select @@SESSION.BINLOG_FORMAT; STATEMENT INSERT INTO t1 VALUES(1); INSERT INTO t2 VALUES(2); +connect con1,localhost,root,,; +connect con2,localhost,root,,; # # Ensure that INSERT INTO .. SELECT FROM under SBR takes a read # lock that will prevent the source table from being modified. # -# con1 +connection con1; SELECT GET_LOCK('Bug#34306', 120); GET_LOCK('Bug#34306', 120) 1 -# con2 +connection con2; PREPARE stmt FROM "INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)"; EXECUTE stmt;; -# default +connection default; INSERT INTO t2 VALUES (3);; -# con1 +connection con1; SELECT RELEASE_LOCK('Bug#34306'); RELEASE_LOCK('Bug#34306') 1 -# con2 +connection con2; Warnings: Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. SELECT RELEASE_LOCK('Bug#34306'); RELEASE_LOCK('Bug#34306') 1 -# default +connection default; # # Ensure that INSERT INTO .. SELECT FROM prepared under SBR does # not prevent the source table from being modified if under RBR. # -# con2 +connection con2; SET SESSION BINLOG_FORMAT = ROW; -# con1 +connection con1; SELECT GET_LOCK('Bug#34306', 120); GET_LOCK('Bug#34306', 120) 1 -# con2 +connection con2; EXECUTE stmt;; -# default -# con1 +connection default; +connection con1; INSERT INTO t2 VALUES (4); SELECT RELEASE_LOCK('Bug#34306'); RELEASE_LOCK('Bug#34306') 1 -# con2 -# default +connection con2; +disconnect con1; +disconnect con2; +connection default; # Show binlog events include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/binlog/r/binlog_tmp_table.result b/mysql-test/suite/binlog/r/binlog_tmp_table.result index 91702aa7335..bfc26aaf961 100644 --- a/mysql-test/suite/binlog/r/binlog_tmp_table.result +++ b/mysql-test/suite/binlog/r/binlog_tmp_table.result @@ -1,19 +1,34 @@ RESET MASTER; +connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; +connect master1,127.0.0.1,root,,test,$MASTER_MYPORT,; create table foo (a int); flush logs; +connection master; create temporary table tmp1_foo like foo; +connection master1; create temporary table tmp2_foo (a int); +connection master; insert into tmp1_foo values (1), (2), (3), (4); +connection master1; replace into tmp2_foo values (1), (2), (3), (4); +connection master; update tmp1_foo set a=2*a-1; +connection master1; update tmp2_foo set a=2*a; +connection master; delete from tmp1_foo where a < 5; +connection master1; delete from tmp2_foo where a < 5; +connection master; insert into foo select * from tmp1_foo; +connection master1; insert into foo select * from tmp2_foo; +connection master; truncate table tmp1_foo; +connection master1; truncate table tmp2_foo; flush logs; +connection default; select * from foo; a 5 @@ -30,13 +45,23 @@ a 8 drop table foo; RESET MASTER; +connect con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connect con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; +connection con1; create database b51226; use b51226; create temporary table t1(i int); +connection con2; use b51226; create temporary table t1(i int); +connection con1; create temporary table t1(i int); ERROR 42S01: Table 't1' already exists +disconnect con1; +connection default; +connection con2; insert into t1 values(1); +disconnect con2; +connection default; DROP DATABASE b51226; FLUSH LOGS; diff --git a/mysql-test/suite/binlog/r/binlog_truncate_kill.result b/mysql-test/suite/binlog/r/binlog_truncate_kill.result index 9161f3dc10d..780b84ecfc6 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_kill.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_kill.result @@ -14,8 +14,6 @@ connection default; ERROR 70100: Query execution was interrupted connection con1; include/show_binlog_events.inc -connection con1; -connection con1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, a INT, b INT) ENGINE=INNODB @@ -23,8 +21,6 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Intvar # # INSERT_ID=1 master-bin.000001 # Query # # use `test`; INSERT INTO t1(a, b) VALUES(1,2),(2,4),(3,6),(4,8),(5,10) master-bin.000001 # Xid # # COMMIT /* XID */ -connection con1; -connection con1; disconnect con1; connection default; SELECT * FROM t1; diff --git a/mysql-test/suite/binlog/r/binlog_truncate_myisam.result b/mysql-test/suite/binlog/r/binlog_truncate_myisam.result index 90cc335ee0a..56944e6ee0c 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_myisam.result @@ -20,18 +20,17 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a INT) ENGINE=MyISAM; CREATE TABLE t2 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1),(2); -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -39,7 +38,7 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default +connection default; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# @@ -52,6 +51,7 @@ master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; SET BINLOG_FORMAT=STATEMENT; RESET MASTER; @@ -74,18 +74,17 @@ DROP TABLE t1,t2; CREATE TABLE t1 (a INT) ENGINE=MyISAM; CREATE TABLE t2 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (1),(2); -# Connection: default BEGIN; INSERT INTO t2 SELECT * FROM t1; -# Connection: truncate +connect truncate,localhost,root,,; TRUNCATE TABLE t1; -# Connection: default +connection default; INSERT INTO t2 SELECT * FROM t1; SELECT COUNT(*) FROM t2; COUNT(*) 4 COMMIT; -# Connection: truncate +connection truncate; # Reaping TRUNCATE TABLE SELECT COUNT(*) FROM t1; COUNT(*) @@ -93,7 +92,7 @@ COUNT(*) SELECT COUNT(*) FROM t2; COUNT(*) 4 -# Connection: default +connection default; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# @@ -104,5 +103,6 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t2 SELECT * FROM t1 master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +disconnect truncate; DROP TABLE t1,t2; SET BINLOG_FORMAT=@old_binlog_format; diff --git a/mysql-test/suite/binlog/r/binlog_xa_recover.result b/mysql-test/suite/binlog/r/binlog_xa_recover.result index e9e5b23176d..2c0e677bf1c 100644 --- a/mysql-test/suite/binlog/r/binlog_xa_recover.result +++ b/mysql-test/suite/binlog/r/binlog_xa_recover.result @@ -5,21 +5,29 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; INSERT INTO t1 VALUES (100, REPEAT("x", 4100)); INSERT INTO t1 VALUES (101, REPEAT("x", 4100)); INSERT INTO t1 VALUES (102, REPEAT("x", 4100)); +connect con1,localhost,root,,; SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont"; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever"; INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con1_wait"; +connect con2,localhost,root,,; SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont"; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever"; INSERT INTO t1 VALUES (2, NULL); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con2_wait"; +connect con3,localhost,root,,; SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont"; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever"; INSERT INTO t1 VALUES (3, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con3_wait"; +connect con4,localhost,root,,; SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont"; SET SESSION debug_dbug="+d,crash_commit_after_log"; INSERT INTO t1 VALUES (4, NULL); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con4_wait"; SET DEBUG_SYNC= "now SIGNAL con1_cont"; SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; @@ -83,7 +91,9 @@ master-bin.000004 # master-bin.000005 # master-bin.000006 # SET DEBUG_SYNC= "now SIGNAL con4_cont"; +connection con4; Got one of the listed errors +connection default; SELECT a FROM t1 ORDER BY a; a 1 @@ -97,14 +107,20 @@ Test that with multiple binlog checkpoints, recovery starts from the last one. SET GLOBAL max_binlog_size= 4096; SET GLOBAL innodb_flush_log_at_trx_commit= 1; RESET MASTER; +connect con10,localhost,root,,; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont"; INSERT INTO t1 VALUES (10, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con10_ready"; +connect con11,localhost,root,,; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont"; INSERT INTO t1 VALUES (11, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con11_ready"; +connect con12,localhost,root,,; SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont"; INSERT INTO t1 VALUES (12, REPEAT("x", 4100)); +connection default; SET DEBUG_SYNC= "now WAIT_FOR con12_ready"; INSERT INTO t1 VALUES (13, NULL); show binary logs; @@ -123,12 +139,18 @@ master-bin.000004 # Table_map # # table_id: # (test.t1) master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000004 # Xid # # COMMIT /* XID */ SET DEBUG_SYNC= "now SIGNAL con10_cont"; +connection con10; +connection default; SET @old_dbug= @@global.DEBUG_DBUG; SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; SET DEBUG_SYNC= "now SIGNAL con12_cont"; +connection con12; +connection default; SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; SET GLOBAL debug_dbug= @old_dbug; SET DEBUG_SYNC= "now SIGNAL con11_cont"; +connection con11; +connection default; Checking that master-bin.000004 is the last binlog checkpoint include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -145,6 +167,7 @@ Now crash the server SET SESSION debug_dbug="+d,crash_commit_after_log"; INSERT INTO t1 VALUES (14, NULL); Got one of the listed errors +connection default; SELECT a FROM t1 ORDER BY a; a 1 @@ -206,4 +229,5 @@ master-bin.000004 # Table_map # # table_id: # (test.t1) master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000004 # Xid # # COMMIT /* XID */ master-bin.000004 # Rotate # # master-bin.000005;pos=POS +connection default; DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result b/mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result index f09216cb539..59a1f598c2b 100644 --- a/mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result +++ b/mysql-test/suite/binlog/r/temptable_uservar_disconnect-7938.result @@ -1,7 +1,10 @@ +connect con1,localhost,root,,; create table t1 (i int); create trigger tr after insert on t1 for each row set @b=@a; create temporary table tmp like t1; insert into t1 values (1); +disconnect con1; +connection default; select * from t1; i 1 |