diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-08-30 18:48:37 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-08-31 17:54:26 +0200 |
commit | 059dfc187e3b51e06d941dc1ba539128c1b3de8c (patch) | |
tree | 28b14fa874c491906a0060b71a0427d83c51f99c | |
parent | 6176b3477a0a7a20d09047e379c4c8b87c5e87b6 (diff) | |
download | mariadb-git-wip-binlog-encryption.tar.gz |
tests (temp)wip-binlog-encryption
31 files changed, 217 insertions, 3620 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 6d9261fe906..2d9d13ac8e0 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -4688,9 +4688,9 @@ void do_sync_with_master2(struct st_command *command, long offset, if (!result_str || result < 0) { /* master_pos_wait returned NULL or < 0 */ - show_query(mysql, "SHOW MASTER STATUS"); - show_query(mysql, "SHOW SLAVE STATUS"); - show_query(mysql, "SHOW PROCESSLIST"); + //show_query(mysql, "SHOW MASTER STATUS"); + //show_query(mysql, "SHOW SLAVE STATUS"); + //show_query(mysql, "SHOW PROCESSLIST"); fprintf(stderr, "analyze: sync_with_master\n"); if (!result_str) @@ -9062,6 +9062,7 @@ int main(int argc, char **argv) { my_bool ok_to_do; int current_line_inc = 1, processed = 0; + verbose_msg("> %s", command->query); if (command->type == Q_UNKNOWN || command->type == Q_COMMENT_WITH_COMMAND) get_command_type(command); diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test index f7a1e71d5d9..40b3abd5273 100644 --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test @@ -34,7 +34,7 @@ INSERT INTO t3 VALUES (3); COMMIT; save_master_pos; # Save BEGIN event into variable -let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 10); +let $master_pos_begin= query_get_value(SHOW BINLOG EVENTS, Pos, 11); --echo # 1) Test deadlock diff --git a/mysql-test/extra/rpl_tests/rpl_row_annotate.test b/mysql-test/extra/rpl_tests/rpl_row_annotate.test index 0614ca97f1d..700f798ae21 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_annotate.test +++ b/mysql-test/extra/rpl_tests/rpl_row_annotate.test @@ -133,12 +133,7 @@ sync_slave_with_master; --echo ######################################################################## FLUSH LOGS; ---source include/binlog_start_pos.inc -let $start_pos= `select @binlog_start_pos`; ---replace_column 2 # 5 # ---replace_result $start_pos <start_pos> ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// ---eval show binlog events in 'slave-bin.000001' from $start_pos +--source include/show_binlog_events.inc --echo # --echo ######################################################################## diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index a16e82f2364..3ee56d83275 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -120,3 +120,6 @@ local-infile # is read after [mysqld] and [embedded] loose-aria +[mysqld] +plugin-load-add=file_key_management +file-key-management-filename=/home/serg/Abk/maria/mysql-test/std_data/keys.txt diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc index 368cfc9e3a7..7807691f1d2 100644 --- a/mysql-test/include/show_events.inc +++ b/mysql-test/include/show_events.inc @@ -65,11 +65,11 @@ if (!$binlog_start) # the right value. if ($is_relay_log) { - --let $_binlog_start= query_get_value($statement LIMIT 1, End_log_pos, 1) + --let $_binlog_start= query_get_value($statement LIMIT 2, End_log_pos, 2) } if (!$is_relay_log) { - --let $_binlog_start= query_get_value($statement LIMIT 3, End_log_pos, 3) + --let $_binlog_start= query_get_value($statement LIMIT 4, End_log_pos, 4) } } diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc index 1b2b7360970..e69de29bb2d 100644 --- a/mysql-test/include/show_rpl_debug_info.inc +++ b/mysql-test/include/show_rpl_debug_info.inc @@ -1,111 +0,0 @@ -# ==== Purpose ==== -# -# Print status information for replication, typically used to debug -# test failures. -# -# The following is printed on the current connection: -# -# SELECT NOW() -# SHOW SLAVE STATUS -# SHOW MASTER STATUS -# SHOW PROCESSLIST -# SHOW BINLOG EVENTS IN <binlog_name> -# -# Where <binlog_name> is the currently active binlog. -# -# Then, the same is printed from all connections configured by -# rpl_init.inc - i.e., on connection server_N, where -# 1 <= N <= $rpl_server_count -# -# -# ==== Usage ==== -# -# [--let $rpl_only_current_connection= 1] -# --source include/show_rpl_debug_info.inc -# -# Parameters: -# $rpl_only_current_connection -# By default, debug info is printed from all connections, starting -# with the current connection. If this variable is set, debug -# info is printed only for the current connection. -# -# -# ==== Side effects ==== -# -# Turns on enable_query_log, enable_result_log, enable_warnings, -# horizontal_results, and enable_abort_on_error. -# -# Prints non-deterministic output to the query log. This file should -# never be called in a test that does not fail. - - ---enable_query_log ---enable_result_log ---enable_warnings ---disable_abort_on_error ---horizontal_results - - ---let $_rpl_old_con= $CURRENT_CONNECTION ---let $_rpl_is_first_server= 1 ---let $_rpl_server= $rpl_server_count ---inc $_rpl_server - - -while ($_rpl_server) -{ - if (!$_rpl_is_first_server) - { - --connection server_$_rpl_server - } - - --echo - --echo ############################## $CURRENT_CONNECTION ############################## - --echo - --echo **** SHOW WARNINGS on $CURRENT_CONNECTION **** - SHOW WARNINGS; - --echo - --echo **** SELECT replication-related variables on $CURRENT_CONNECTION **** - SELECT NOW(), @@SERVER_ID; - --echo - --echo **** SHOW SLAVE STATUS on $CURRENT_CONNECTION **** - query_vertical SHOW SLAVE STATUS; - --echo - --echo **** SHOW MASTER STATUS on $CURRENT_CONNECTION **** - query_vertical SHOW MASTER STATUS; - --echo - --echo **** SHOW SLAVE HOSTS on $CURRENT_CONNECTION **** - query_vertical SHOW SLAVE HOSTS; - --echo - --echo **** SHOW PROCESSLIST on $CURRENT_CONNECTION **** - SHOW PROCESSLIST; - --echo - --echo **** SHOW BINARY LOGS on $CURRENT_CONNECTION **** - SHOW BINARY LOGS; - --echo - --echo **** SHOW BINLOG EVENTS on $CURRENT_CONNECTION **** - let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); - --echo binlog_name = '$binlog_name' - eval SHOW BINLOG EVENTS IN '$binlog_name'; - --echo - --echo **** SHOW RELAYLOG EVENTS on $CURRENT_CONNECTION **** - let $relaylog_name= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1); - --echo relaylog_name = '$relaylog_name' - eval SHOW RELAYLOG EVENTS IN '$relaylog_name'; - - - --let $_rpl_is_first_server= 0 - --dec $_rpl_server - # Don't use same connection twice. - if (`SELECT 'server_$_rpl_server' = '$_rpl_old_con'`) - { - --dec $_rpl_server - if ($rpl_only_current_connection) - { - --let $_rpl_server= 0 - } - } -} - ---connection $_rpl_old_con ---enable_abort_on_error diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result index b8c718ff821..a1ed8dd91b1 100644 --- a/mysql-test/suite/rpl/r/rpl_checksum.result +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */; set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; start slave; include/wait_for_slave_io_error.inc [errno=1236] -Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 368, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 249.'' +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 404, the last event read from 'master-bin.000010' at 4, the last byte read from 'master-bin.000010' at 249.'' select count(*) as zero from t1; zero 0 diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result index 51c2c6261b8..17c23821708 100644 --- a/mysql-test/suite/rpl/r/rpl_corruption.result +++ b/mysql-test/suite/rpl/r/rpl_corruption.result @@ -6,6 +6,7 @@ call mtr.add_suppression('event read from binlog did not pass crc check'); call mtr.add_suppression('Replication event checksum verification failed'); call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593'); +call mtr.add_suppression('event decryption failure'); SET @old_master_verify_checksum = @@master_verify_checksum; # 1. Creating test table/data and set corruption position for testing * insert/update/delete rows in table t1 * @@ -21,14 +22,6 @@ SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; START SLAVE IO_THREAD; include/wait_for_slave_io_error.inc [errno=1236] SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -# 4. Master read a corrupted event from binlog and send it to slave -SET GLOBAL master_verify_checksum=0; -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; -START SLAVE IO_THREAD; -include/wait_for_slave_io_error.inc [errno=1595,1913] -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug= ""; -SET GLOBAL master_verify_checksum=1; # 5. Slave. Corruption in network SET GLOBAL debug_dbug="+d,corrupt_queue_event"; START SLAVE IO_THREAD; diff --git a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result index 3a3bed1a6fd..dc8d7663426 100644 --- a/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result +++ b/mysql-test/suite/rpl/r/rpl_dual_pos_advance.result @@ -14,7 +14,7 @@ insert into t3 values(2); insert into t3 values(3); commit; insert into t3 values(4); -start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; +start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS_1; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart include/wait_for_slave_sql_to_stop.inc @@ -22,14 +22,14 @@ show tables; Tables_in_test t1 t2 -start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; +start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS_2; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart include/wait_for_slave_sql_to_stop.inc select * from t3; n 1 -start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS; +start slave until master_log_file="MASTER_LOG_FILE",master_log_pos=MASTER_LOG_POS_3; Warnings: Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mysqld restart include/wait_for_slave_sql_to_stop.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result index 22f284d6716..8562818b623 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result @@ -185,6 +185,7 @@ master-bin.000001 # include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +master-bin.000001 # Start_encryption # # master-bin.000001 # Gtid_list # # [#-#-#] master-bin.000001 # Binlog_checkpoint # # master-bin.000001 SET GLOBAL gtid_binlog_state = @old_state; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index 0c2249f2dce..7cc0669d1b2 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -28,7 +28,7 @@ include/stop_slave.inc RESET MASTER; SET GLOBAL gtid_slave_pos=''; RESET MASTER; -SHOW BINLOG EVENTS IN 'master-bin.000001' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000001' LIMIT 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid_list # # [] CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; @@ -45,7 +45,7 @@ Log_name File_size master-bin.000001 # master-bin.000002 # master-bin.000003 # -SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000003 # Gtid_list # # # SET SESSION debug_dbug="+d,crash_dispatch_command_before"; @@ -57,7 +57,7 @@ master-bin.000001 # master-bin.000002 # master-bin.000003 # master-bin.000004 # -SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000004 # Gtid_list # # # SELECT * FROM t1 ORDER BY a; diff --git a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result index 60c8e4666b9..d463e97ef53 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result @@ -28,14 +28,14 @@ a *** Test normal shutdown/restart of master server, check binlog state is preserved. *** SET SESSION gtid_domain_id= 1; INSERT INTO t1 VALUES (4); -SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000003 # Gtid_list # # [0-1-3] FLUSH LOGS; -SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000004 # Gtid_list # # # -SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000005 # Gtid_list # # # show binary logs; diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result index 610d18a88c6..bee491ae93a 100644 --- a/mysql-test/suite/rpl/r/rpl_log_pos.result +++ b/mysql-test/suite/rpl/r/rpl_log_pos.result @@ -11,7 +11,7 @@ include/stop_slave.inc change master to master_log_pos=MASTER_LOG_POS; start slave; include/wait_for_slave_io_error.inc [errno=1236] -Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.'' +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log' include/stop_slave_sql.inc show master status; File Position Binlog_Do_DB Binlog_Ignore_DB diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result index 9aeef98d091..bb0ed4823b2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_annotate_do.result +++ b/mysql-test/suite/rpl/r/rpl_row_annotate_do.result @@ -67,109 +67,107 @@ SET GLOBAL sql_slave_skip_counter=1; START SLAVE; ######################################################################## FLUSH LOGS; -show binlog events in 'slave-bin.000001' from <start_pos>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Gtid_list 2 # [] -slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001 -slave-bin.000001 # Gtid 1 # GTID 0-1-1 -slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1 -slave-bin.000001 # Gtid 1 # GTID 0-1-2 -slave-bin.000001 # Query 1 # CREATE DATABASE test1 -slave-bin.000001 # Gtid 1 # GTID 0-1-3 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-4 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-5 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-6 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-9 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 ( +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # DROP DATABASE IF EXISTS test1 +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # CREATE DATABASE test1 +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t1(a int primary key, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t2(a int, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t3(a int, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t4(a int, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t5 ( a INT PRIMARY KEY AUTO_INCREMENT, b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin ) -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-10 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-11 -slave-bin.000001 # Annotate_rows 1 # UPDATE t1 SET b = b + 1 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Update_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-12 -slave-bin.000001 # Annotate_rows 1 # REPLACE t1 VALUES (1,1), (2,2), (3,3) -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Update_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-13 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3) -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-14 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t3 VALUES (1,1), (2,2), (3,3) -slave-bin.000001 # Table_map 1 # table_id: # (test1.t3) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-15 -slave-bin.000001 # Annotate_rows 1 # DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Delete_rows_v1 1 # table_id: # -slave-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-17 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t2 VALUES (1,1), (2,2), (3,3) -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-18 -slave-bin.000001 # Annotate_rows 1 # DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-22 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz') -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-23 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gås') -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-24 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5(b) VALUES ('gÃ¥s') -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-25 -slave-bin.000001 # Table_map 2 # table_id: # (test1.t3) -slave-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 2 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-25 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-26 -slave-bin.000001 # Annotate_rows 1 # INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t3) -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-27 -slave-bin.000001 # Table_map 2 # table_id: # (mtr.test_suppressions) -slave-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 2 # COMMIT -slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # UPDATE t1 SET b = b + 1 +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # REPLACE t1 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Update_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t3 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map # # table_id: # (test1.t3) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # DELETE t1, t2 FROM t1 INNER JOIN t2 INNER JOIN t3 WHERE t1.a=t2.a AND t2.a=t3.a +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Delete_rows_v1 # # table_id: # +slave-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t2 VALUES (1,1), (2,2), (3,3) +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # DELETE xt1, t2 FROM xt1 INNER JOIN t2 INNER JOIN t3 WHERE xt1.a=t2.a AND t2.a=t3.a +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t5(b) VALUES ('foo'), ('bar'), ('baz') +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t5(b) VALUES ('gås') +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t5(b) VALUES ('gÃ¥s') +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t3) +slave-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t5 (a) SELECT a.a*10000+b.a*1000+c.a*100+d.a*10 FROM t5 a, t5 b, t5 c, t5 d +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Annotate_rows # # INSERT INTO t3 (a) SELECT a FROM t5 WHERE a > 10 +slave-bin.000001 # Table_map # # table_id: # (test1.t3) +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (mtr.test_suppressions) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS # ######################################################################## # INSERTs DELAYED ON MASTERs diff --git a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result index ceaf8c878c8..46c8b72d6f0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result +++ b/mysql-test/suite/rpl/r/rpl_row_annotate_dont.result @@ -59,97 +59,95 @@ SET GLOBAL sql_slave_skip_counter=1; START SLAVE; ######################################################################## FLUSH LOGS; -show binlog events in 'slave-bin.000001' from <start_pos>; +include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info -slave-bin.000001 # Gtid_list 2 # [] -slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001 -slave-bin.000001 # Gtid 1 # GTID 0-1-1 -slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1 -slave-bin.000001 # Gtid 1 # GTID 0-1-2 -slave-bin.000001 # Query 1 # CREATE DATABASE test1 -slave-bin.000001 # Gtid 1 # GTID 0-1-3 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-4 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t2(a int, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-5 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t3(a int, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-6 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t4(a int, b int) -slave-bin.000001 # Gtid 1 # GTID 0-1-9 -slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t5 ( +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # DROP DATABASE IF EXISTS test1 +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # CREATE DATABASE test1 +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t1(a int primary key, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t2(a int, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t3(a int, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t4(a int, b int) +slave-bin.000001 # Gtid # # GTID #-#-# +slave-bin.000001 # Query # # use `test1`; CREATE TABLE t5 ( a INT PRIMARY KEY AUTO_INCREMENT, b VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_bin ) -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-10 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-11 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Update_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-12 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Update_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-13 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-14 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t3) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-15 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Table_map 1 # table_id: # (test1.t1) -slave-bin.000001 # Delete_rows_v1 1 # table_id: # -slave-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-17 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-18 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t2) -slave-bin.000001 # Delete_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-22 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-23 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-24 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-25 -slave-bin.000001 # Table_map 2 # table_id: # (test1.t3) -slave-bin.000001 # Delete_rows_v1 2 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 2 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-25 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t5) -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 1 # BEGIN GTID 0-1-26 -slave-bin.000001 # Table_map 1 # table_id: # (test1.t3) -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # -slave-bin.000001 # Write_rows_v1 1 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 1 # COMMIT -slave-bin.000001 # Gtid 2 # BEGIN GTID 0-2-27 -slave-bin.000001 # Table_map 2 # table_id: # (mtr.test_suppressions) -slave-bin.000001 # Write_rows_v1 2 # table_id: # flags: STMT_END_F -slave-bin.000001 # Query 2 # COMMIT -slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Update_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t3) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Table_map # # table_id: # (test1.t1) +slave-bin.000001 # Delete_rows_v1 # # table_id: # +slave-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t2) +slave-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t3) +slave-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t5) +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (test1.t3) +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Gtid # # BEGIN GTID #-#-# +slave-bin.000001 # Table_map # # table_id: # (mtr.test_suppressions) +slave-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Rotate # # slave-bin.000002;pos=POS # ######################################################################## # INSERTs DELAYED ON MASTERs diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment.test b/mysql-test/suite/rpl/t/rpl_auto_increment.test deleted file mode 100644 index fe0f1689471..00000000000 --- a/mysql-test/suite/rpl/t/rpl_auto_increment.test +++ /dev/null @@ -1,7 +0,0 @@ -##################################### -# Wrapper for rpl_auto_increment.test# -##################################### --- source include/have_innodb.inc -let $engine_type=innodb; -let $engine_type2=myisam; --- source extra/rpl_tests/rpl_auto_increment.test diff --git a/mysql-test/suite/rpl/t/rpl_corruption.test b/mysql-test/suite/rpl/t/rpl_corruption.test index da87b133cb5..9c423027412 100644 --- a/mysql-test/suite/rpl/t/rpl_corruption.test +++ b/mysql-test/suite/rpl/t/rpl_corruption.test @@ -25,6 +25,7 @@ call mtr.add_suppression('event read from binlog did not pass crc check'); call mtr.add_suppression('Replication event checksum verification failed'); call mtr.add_suppression('Event crc check failed! Most likely there is event corruption'); call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, error.* 1593'); +call mtr.add_suppression('event decryption failure'); SET @old_master_verify_checksum = @@master_verify_checksum; @@ -109,24 +110,6 @@ let $slave_io_errno= 1236; --connection master SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -# Emulate corruption on master without crc checking on master ---echo # 4. Master read a corrupted event from binlog and send it to slave ---connection master -SET GLOBAL master_verify_checksum=0; -SET GLOBAL debug_dbug="+d,corrupt_read_log_event2_set"; ---connection slave -START SLAVE IO_THREAD; -# When the checksum error is detected, the slave sets error code 1913 -# (ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE) in queue_event(), then immediately -# sets error 1595 (ER_SLAVE_RELAY_LOG_WRITE_FAILURE) in handle_slave_io(). -# So we usually get 1595, but it is occasionally possible to get 1913. -let $slave_io_errno= 1595,1913; ---source include/wait_for_slave_io_error.inc ---connection master -SET GLOBAL debug_dbug="-d,corrupt_read_log_event2_set"; -SET GLOBAL debug_dbug= ""; -SET GLOBAL master_verify_checksum=1; - # Emulate corruption in network --echo # 5. Slave. Corruption in network --connection slave diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test index 618576f5641..2a20d7758d4 100644 --- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test +++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test @@ -53,7 +53,7 @@ connection server_1; # bug is that START SLAVE UNTIL may stop too late, we test that by # asking it to stop before creation of t3. ---replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS +--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS_1 eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_1; --source include/wait_for_slave_sql_to_stop.inc @@ -63,13 +63,13 @@ eval start slave until master_log_file="$master_log_file",master_log_pos=$master show tables; # ensure that we do not break set @a=1; insert into t3 values(@a); ---replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS +--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS_2 eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_2; --source include/wait_for_slave_sql_to_stop.inc select * from t3; # ensure that we do not break transaction ---replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_3 MASTER_LOG_POS +--replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_3 MASTER_LOG_POS_3 eval start slave until master_log_file="$master_log_file",master_log_pos=$master_log_pos_3; --source include/wait_for_slave_sql_to_stop.inc select * from t3; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test index df3ba9a3420..e4af9aaabb8 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test @@ -90,7 +90,7 @@ SET GLOBAL gtid_slave_pos=''; --connection server_1 RESET MASTER; --replace_column 2 # 4 # 5 # -SHOW BINLOG EVENTS IN 'master-bin.000001' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000001' LIMIT 2,1; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --connection server_2 @@ -106,7 +106,7 @@ INSERT INTO t1 VALUES (3); FLUSH LOGS; --source include/show_binary_logs.inc --replace_column 2 # 4 # 5 # 6 # -SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 2,1; --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect wait @@ -126,7 +126,7 @@ EOF --source include/show_binary_logs.inc --replace_column 2 # 4 # 5 # 6 # -SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 2,1; --save_master_pos --connection server_2 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test index b57714aaa57..795ca0d191a 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test @@ -61,10 +61,10 @@ SELECT * FROM t1 ORDER BY a; SET SESSION gtid_domain_id= 1; INSERT INTO t1 VALUES (4); --replace_column 2 # 4 # 5 # -SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000003' LIMIT 2,1; FLUSH LOGS; --replace_column 2 # 4 # 5 # 6 # -SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000004' LIMIT 2,1; --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect wait @@ -84,7 +84,7 @@ EOF --source include/wait_until_connected_again.inc --replace_column 2 # 4 # 5 # 6 # -SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 1,1; +SHOW BINLOG EVENTS IN 'master-bin.000005' LIMIT 2,1; --source include/show_binary_logs.inc INSERT INTO t1 VALUES(5); diff --git a/mysql-test/suite/rpl/t/rpl_hrtime.test b/mysql-test/suite/rpl/t/rpl_hrtime.test deleted file mode 100644 index 98b08abec67..00000000000 --- a/mysql-test/suite/rpl/t/rpl_hrtime.test +++ /dev/null @@ -1,7 +0,0 @@ ---source include/have_binlog_format_mixed_or_statement.inc - ---source suite/rpl/include/hrtime.inc - -let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 - diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test index 4f63cd32916..5f714227501 100644 --- a/mysql-test/suite/rpl/t/rpl_log_pos.test +++ b/mysql-test/suite/rpl/t/rpl_log_pos.test @@ -31,7 +31,7 @@ start slave; let $slave_io_errno= 1236; --let $show_slave_io_error= 1 # Mask line numbers ---let $slave_io_error_replace= / at [0-9]*/ at XXX/ +--let $slave_io_error_replace= /log: '.*/log/ source include/wait_for_slave_io_error.inc; source include/stop_slave_sql.inc; --enable_warnings diff --git a/mysql-test/suite/rpl/t/rpl_mdev382.test b/mysql-test/suite/rpl/t/rpl_mdev382.test deleted file mode 100644 index cb67052b47d..00000000000 --- a/mysql-test/suite/rpl/t/rpl_mdev382.test +++ /dev/null @@ -1,268 +0,0 @@ ---source include/have_innodb.inc ---source include/have_binlog_format_statement.inc ---source include/master-slave.inc - -if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`) -{ - --skip Not fixed in InnoDB 5.6.10 or earlier -} - -# MDEV-382: multiple SQL injections in replication code. - -# Test previous SQL injection attack against binlog for SAVEPOINT statement. -# The test would cause syntax error on slave due to improper quoting of -# the savepoint name. -connection master; -create table t1 (a int primary key) engine=innodb; -create table t2 (a int primary key) engine=myisam; - -begin; -insert into t1 values (1); -SET sql_mode = 'ANSI_QUOTES'; -savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`; -insert into t1 values (2); -insert into t2 values (1); -SET sql_mode = ''; -rollback to savepoint `a``; create database couldbebadthingshere; savepoint ``dummy`; -insert into t1 values (3); -commit; - ---source include/show_binlog_events2.inc - -# This failed due to syntax error in query when the bug was not fixed. -sync_slave_with_master; -connection slave; - -# Test some more combinations of ANSI_QUOTES and sql_quote_show_create -connection master; -let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); -BEGIN; -insert into t1 values(10); -set sql_mode = 'ANSI_QUOTES'; -set sql_quote_show_create = 1; -savepoint a; -insert into t1 values(11); -savepoint "a""a"; -insert into t1 values(12); -set sql_quote_show_create = 0; -savepoint b; -insert into t1 values(13); -savepoint "b""b"; -insert into t1 values(14); -set sql_mode = ''; -set sql_quote_show_create = 1; -savepoint c; -insert into t1 values(15); -savepoint `c``c`; -insert into t1 values(16); -set sql_quote_show_create = 0; -savepoint d; -insert into t1 values(17); -savepoint `d``d`; -insert into t1 values(18); -COMMIT; -set sql_quote_show_create = 1; - ---source include/show_binlog_events2.inc - ---echo *** Test correct USE statement in SHOW BINLOG EVENTS *** -connection master; -let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); -set sql_mode = 'ANSI_QUOTES'; -CREATE DATABASE "db1`; select 'oops!'"; -use "db1`; select 'oops!'"; -CREATE TABLE t1 (a INT PRIMARY KEY) engine=MyISAM; -INSERT INTO t1 VALUES (1); -set sql_mode = ''; -INSERT INTO t1 VALUES (2); -set sql_mode = 'ANSI_QUOTES'; ---source include/show_binlog_events2.inc -set sql_mode = ''; -set sql_quote_show_create = 0; ---source include/show_binlog_events2.inc -set sql_quote_show_create = 1; ---source include/show_binlog_events2.inc -DROP TABLE t1; - -use test; - ---echo ***Test LOAD DATA INFILE with various identifiers that need correct quoting *** - ---let $load_file= $MYSQLTEST_VARDIR/tmp/f'le.txt ---write_file $load_file -'fo\\o','bar' -EOF - -use `db1``; select 'oops!'`; -let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); -set timestamp=1000000000; -CREATE TABLE `t``1` (`a``1` VARCHAR(4) PRIMARY KEY, `b``2` VARCHAR(3), - `c``3` VARCHAR(7)); ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/f''le.txt' INTO TABLE `t``1` - FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' ENCLOSED BY '''' - LINES TERMINATED BY '\\n' - (`a``1`, @`b```) SET `b``2` = @`b```, `c``3` = concat('|', "b""a'z", "!"); - -SELECT * FROM `t``1`; -# Also test when code prefixes table name with database. -truncate `t``1`; -use test; ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/f''le.txt' - INTO TABLE `db1``; select 'oops!'`.`t``1` - FIELDS TERMINATED BY ',' ESCAPED BY '\\\\' ENCLOSED BY '''' - LINES TERMINATED BY '\\n' - (`a``1`, `b``2`) SET `c``3` = concat('|', "b""a'z", "!"); -SELECT * FROM `db1``; select 'oops!'`.`t``1`; -let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1); - ---source include/show_binlog_events2.inc -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /LOCAL INFILE '.*SQL_LOAD.*' INTO/LOCAL INFILE '<name>' INTO/ ---exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 $MYSQLD_DATADIR/master-bin.000001 - -sync_slave_with_master; -connection slave; -SELECT * FROM `db1``; select 'oops!'`.`t``1`; -connection master; - -DROP TABLE `db1``; select 'oops!'`.`t``1`; ---remove_file $load_file - -connection master; -drop table t1,t2; - - ---echo *** Test truncation of long SET expression in LOAD DATA *** -CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(1000)); ---let $load_file= $MYSQLTEST_VARDIR/tmp/file.txt ---write_file $load_file -1,X -2,A -EOF - -let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); -# The bug was that the SET expression was truncated to 256 bytes, so test with -# an expression longer than that. ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -eval LOAD DATA INFILE '$load_file' INTO TABLE t1 - FIELDS TERMINATED BY ',' - (a, @b) SET b = CONCAT(@b, '| 123456789A123456789B123456789C123456789D123456789E123456789F123456789G123456789H123456789I123456789J123456789K123456789L123456789M123456789N123456789O123456789P123456789Q123456789R123456789123456789T123456789U123456789V123456789W123456789X123456789Y123456789Z123456789|', @b); - -SELECT * FROM t1 ORDER BY a; ---source include/show_binlog_events2.inc - -sync_slave_with_master; -connection slave; -SELECT * FROM t1 ORDER BY a; - -connection master; ---remove_file $load_file -DROP TABLE t1; - - ---echo *** Test user variables whose names require correct quoting *** -use `db1``; select 'oops!'`; -let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); -CREATE TABLE t1 (a1 BIGINT PRIMARY KEY, a2 BIGINT, a3 BIGINT, a4 BIGINT UNSIGNED, b DOUBLE, c DECIMAL(65,10), d VARCHAR(100)); -INSERT INTO t1 VALUES (-9223372036854775808,42,9223372036854775807,18446744073709551615,-1234560123456789e110, -1234501234567890123456789012345678901234567890123456789.0123456789, REPEAT("x", 100)); -SELECT @`a``1`:=a1, @`a``2`:=a2, @`a``3`:=a3, @`a``4`:=a4, @`b```:=b, @```c`:=c, @```d```:=d FROM t1; -INSERT INTO t1 VALUES (@`a``1`+1, @`a``2`*100, @`a``3`-1, @`a``4`-1, @`b```/2, @```c`, substr(@```d```, 2, 98)); -let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1); - ---source include/show_binlog_events2.inc - ---exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 $MYSQLD_DATADIR/master-bin.000001 - -sync_slave_with_master; -connection slave; -SELECT * FROM `db1``; select 'oops!'`.t1 ORDER BY a1; - -connection master; -DROP TABLE t1; - ---echo *** Test correct quoting in foreign key error message *** -use `db1``; select 'oops!'`; -CREATE TABLE `t``1` ( `a``` INT PRIMARY KEY) ENGINE=innodb; -CREATE TABLE `t``2` ( `b``` INT PRIMARY KEY, `c``` INT NOT NULL, - FOREIGN KEY fk (`c```) REFERENCES `t``1`(`a```)) ENGINE=innodb; ---error ER_TRUNCATE_ILLEGAL_FK -TRUNCATE `t``1`; -DROP TABLE `t``2`; -DROP TABLE `t``1`; - - ---echo *** Test correct quoting of DELETE FROM statement binlogged for HEAP table that is emptied due to server restart - -# Let's keep the slave stopped during master restart, to avoid any potential -# races between slave reconnect and master restart. -connection slave; ---source include/stop_slave.inc - -connection master; -CREATE TABLE `db1``; select 'oops!'`.`t``1` (`a``` INT PRIMARY KEY) ENGINE=heap; -INSERT INTO `db1``; select 'oops!'`.`t``1` VALUES (1), (2), (5); -SELECT * FROM `db1``; select 'oops!'`.`t``1` ORDER BY 1; - -# Restart the master mysqld. -# This will cause an implicit truncation of the memory-based table, which will -# cause logging of an explicit DELETE FROM to binlog. ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait-rpl_mdev382.test -EOF - ---shutdown_server 30 - ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart-rpl_mdev382.test -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc -# rpl_end.inc needs to use the connection server_1 -connection server_1; ---enable_reconnect ---source include/wait_until_connected_again.inc -connection master; ---enable_reconnect ---source include/wait_until_connected_again.inc -set timestamp=1000000000; - ---echo # The table should be empty on the master. -let $binlog_file= master-bin.000002; -let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); -SELECT * FROM `db1``; select 'oops!'`.`t``1`; - ---echo # The DELETE statement should be correctly quoted ---source include/show_binlog_events2.inc - -connection slave; ---source include/start_slave.inc - -connection master; -sync_slave_with_master; -connection slave; ---echo # The table should be empty on the slave also. -SELECT * FROM `db1``; select 'oops!'`.`t``1`; - -connection master; -DROP TABLE `db1``; select 'oops!'`.`t``1`; -sync_slave_with_master; - - -connection master; -use test; -DROP DATABASE `db1``; select 'oops!'`; - ---echo *** Test correct quoting of mysqlbinlog --rewrite-db option *** -CREATE TABLE t1 (a INT PRIMARY KEY); -let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1); -INSERT INTO t1 VALUES(1); ---source include/show_binlog_events2.inc -let $pos2= query_get_value(SHOW MASTER STATUS, Position, 1); ---exec $MYSQL_BINLOG --short-form --start-position=$binlog_start --stop-position=$pos2 --rewrite-db='test->ts`et' $MYSQLD_DATADIR/master-bin.000002 -DROP TABLE t1; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test deleted file mode 100644 index ed0f31b75be..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ /dev/null @@ -1,356 +0,0 @@ -################################################################## -# Author: JBM # -# Date: 2006-02-22 # -# Purpose: To test changes to mysqlbinlog for row based bin logs # -# We are using .opt file since we need small binlog size # -################################################################## -# Include Section -# Make sure that we have row based bin log --- source include/have_binlog_format_row.inc -# Embedded server doesn't support binlogging --- source include/not_embedded.inc -# This test requires the cp932 charset compiled in --- source include/have_cp932.inc -# Slow test, don't run during staging part --- source include/not_staging.inc - --- source include/master-slave.inc - -# Setup Section -# we need this for getting fixed timestamps inside of this test - ---disable_query_log -select "---Setup Section --" as ""; ---enable_query_log - -set timestamp=1000000000; - ---disable_warnings -DROP TABLE IF EXISTS t1,t2,t3; ---enable_warnings - -connection master; -CREATE TABLE t1(word VARCHAR(20)); -CREATE TABLE t2(id INT AUTO_INCREMENT NOT NULL PRIMARY KEY); ---let $position= query_get_value(SHOW MASTER STATUS, Position, 1) -CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT); ---let $stop_position=query_get_value(SHOW MASTER STATUS, Position, 1) ---let $stop_position1=`select $stop_position - 1` ---let $binlog_start_pos=query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) -# Test Section -# Lets start by putting some data into the tables. - ---disable_query_log -INSERT INTO t1 VALUES ("abirvalg"); -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; -LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1; - -# d1 length 3000 -set @d1 = 'dd1'; -set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); -set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); -set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1); - -let $count=500; -while ($count) -{ - INSERT INTO t2 VALUES (NULL); - eval INSERT INTO t3 VALUES ($count,@d1,'20060222000000','Tested in Texas',$count*2.2); - dec $count; -} ---enable_query_log - - ---disable_query_log -select "---Test1 check table load --" as ""; ---enable_query_log - -# Lets Check the tables on the Master -SELECT COUNT(*) from t1; -SELECT COUNT(*) from t2; -SELECT COUNT(*) from t3; -SELECT * FROM t1 ORDER BY word LIMIT 5; -SELECT * FROM t2 ORDER BY id LIMIT 5; -SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; - -# Should have the same on the slave; - -sync_slave_with_master; -SELECT COUNT(*) from t1; -SELECT COUNT(*) from t2; -SELECT COUNT(*) from t3; -SELECT * FROM t1 ORDER BY word LIMIT 5; -SELECT * FROM t2 ORDER BY id LIMIT 5; -SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; - -# Okay time to get busy, back to master - -connection master; - -# simple query to show more in second binlog -insert into t1 values ("Alas"); -flush logs; - -# delimiters are for easier debugging in future ---disable_query_log -select "--- Test 1 Dump binlog to file --" as ""; ---enable_query_log - -# -# Prepare local temporary file to recreate what we have currently. -let $MYSQLD_DATADIR= `select @@datadir;`; ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql - ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql - -# Now that we have our file, lets get rid of the current database. -# Cleanup the master and the slave and try to recreate. ---disable_query_log -select "--- Test 1 delete tables, clean master and slave --" as ""; ---enable_query_log - -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE t3; - -sync_slave_with_master; -#we expect STOP SLAVE to produce a warning as the slave is stopped -#(the server was started with skip-slave-start) ---disable_warnings -stop slave; ---source include/wait_for_slave_to_stop.inc ---enable_warnings -connection master; -reset master; -connection slave; -reset slave; -start slave; ---source include/wait_for_slave_to_start.inc -connection master; - -# We should be clean at this point, now we will run in the file from above. ---disable_query_log -select "--- Test 1 Load from Dump binlog file --" as ""; ---enable_query_log - ---exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/master.sql" - ---disable_query_log -select "--- Test 1 Check Load Results --" as ""; ---enable_query_log - -# Lets Check the tables on the Master -SELECT COUNT(*) from t1; -SELECT COUNT(*) from t2; -SELECT COUNT(*) from t3; -SELECT * FROM t1 ORDER BY word LIMIT 5; -SELECT * FROM t2 ORDER BY id LIMIT 5; -SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; - -# Should have the same on the slave; - -sync_slave_with_master; -SELECT COUNT(*) from t1; -SELECT COUNT(*) from t2; -SELECT COUNT(*) from t3; -SELECT * FROM t1 ORDER BY word LIMIT 5; -SELECT * FROM t2 ORDER BY id LIMIT 5; -SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; -connection master; - -# We should be gold by the time, so I will get rid of our file. - -remove_file $MYSQLTEST_VARDIR/tmp/master.sql; - - -# this test for start-position option -# By setting this position to 416, we should only get the create of t3 ---disable_query_log -select "--- Test 2 position test --" as ""; ---enable_query_log -let $MYSQLD_DATADIR= `select @@datadir;`; ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --start-position=$position --stop-position=$stop_position $MYSQLD_DATADIR/master-bin.000001 - -# These are tests for remote binlog. -# They should return the same as previous test. - ---disable_query_log -select "--- Test 3 First Remote test --" as ""; ---enable_query_log - -# This is broken now ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 - ---disable_query_log -select "--- Test 4 Second Remote test --" as ""; ---enable_query_log ---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql - ---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql - -# Now that we have our file, lets get rid of the current database. -# Cleanup the master and the slave and try to recreate. - -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE t3; - -sync_slave_with_master; - -#we expect STOP SLAVE to produce a warning as the slave is stopped -#(the server was started with skip-slave-start) - ---disable_warnings -stop slave; ---source include/wait_for_slave_to_stop.inc ---enable_warnings -connection master; -reset master; -connection slave; -reset slave; -start slave; ---source include/wait_for_slave_to_start.inc -connection master; - -# We should be clean at this point, now we will run in the file from above. - ---exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/remote.sql" - -# Lets Check the tables on the Master - -SELECT COUNT(*) from t1; -SELECT COUNT(*) from t2; -SELECT COUNT(*) from t3; -SELECT * FROM t1 ORDER BY word LIMIT 5; -SELECT * FROM t2 ORDER BY id LIMIT 5; -SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; - -# Should have the same on the slave; - -sync_slave_with_master; -SELECT COUNT(*) from t1; -SELECT COUNT(*) from t2; -SELECT COUNT(*) from t3; -SELECT * FROM t1 ORDER BY word LIMIT 5; -SELECT * FROM t2 ORDER BY id LIMIT 5; -SELECT c1, c3, c4, c5 FROM t3 ORDER BY c1 LIMIT 5; -connection master; - -# We should be gold by the time, so I will get rid of our file. - ---remove_file $MYSQLTEST_VARDIR/tmp/remote.sql -################### End Bug 17654 ###################### - -# What is the point of this test? It seems entirely pointless. It -# might make sense for statement-based replication, but for row-based -# replication the LOAD DATA INFILE is printed just as empty -# transactions. /Matz - -# LOAD DATA ---disable_query_log -select "--- Test 5 LOAD DATA --" as ""; ---enable_query_log ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$binlog_start_pos --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 - -# Bug#7853 (mysqlbinlog does not accept input from stdin) - ---disable_query_log -select "--- Test 6 reading stdin --" as ""; ---enable_query_log -let $MYSQLD_DATADIR= `select @@datadir;`; ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --stop-position=$stop_position1 - < $MYSQLD_DATADIR/master-bin.000001 - ---disable_query_log -select "--- Test 7 reading stdin w/position --" as ""; ---enable_query_log ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --start-position=$position --stop-position=$stop_position - < $MYSQLD_DATADIR/master-bin.000001 - -# Bug#16217 (mysql client did not know how not switch its internal charset) ---disable_query_log -select "--- Test 8 switch internal charset --" as ""; ---enable_query_log -sync_slave_with_master; - -#we expect STOP SLAVE to produce a warning as the slave is stopped -#(the server was started with skip-slave-start) - ---disable_warnings -stop slave; ---source include/wait_for_slave_to_stop.inc ---enable_warnings -connection master; -reset master; -connection slave; -reset slave; -start slave; ---source include/wait_for_slave_to_start.inc -connection master; - -create table t4 (f text character set utf8); -create table t5 (f text character set cp932); ---exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')" ---exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'ƒ\');" -let $MYSQLD_DATADIR= `select @@datadir;`; -flush logs; -rename table t4 to t04, t5 to t05; ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8 -# original and recovered data must be equal -select HEX(f) from t04; -select HEX(f) from t4; -select HEX(f) from t05; -select HEX(f) from t5; - -# slave should have same -sync_slave_with_master; -select HEX(f) from t04; -select HEX(f) from t4; -select HEX(f) from t05; -select HEX(f) from t5; - ---disable_query_log -select "--- Test cleanup --" as ""; ---enable_query_log -# clean up -connection master; -sync_slave_with_master; - -connection master; - -# BUG#17654 also test mysqlbinlog to ensure it can read the binlog from a remote server -# and ensure that the results are the same as if read from a file (the same file). - ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - -CREATE TABLE t1 (a INT NOT NULL KEY, b INT); - -INSERT INTO t1 VALUES(1,1); - -SELECT * FROM t1; - -let $MYSQLD_DATADIR= `select @@datadir;`; - -FLUSH LOGS; - ---exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql - ---diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql - ---remove_file $MYSQLTEST_VARDIR/tmp/remote.sql - ---remove_file $MYSQLTEST_VARDIR/tmp/local.sql - -DROP TABLE IF EXISTS t1, t2, t3, t04, t05, t4, t5; -sync_slave_with_master; - -# End of 4.1 tests ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test b/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test deleted file mode 100644 index e8ac74f0125..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test +++ /dev/null @@ -1,338 +0,0 @@ -# -# BUG#42749: infinite loop writing to row based binlog - processlist shows -# "freeing items" -# -# -# WHY -# === -# -# This bug would make table map event to report data_written one -# byte less than what would actually be written in its body. This -# would cause one byte shorter event end_log_pos. The ultimate -# impact was that it would make fixing the position in -# MYSQL_BIN_LOG::write_cache bogus or end up in an infinite loop. -# -# HOW -# === -# -# Checking that the patch fixes the problem is done as follows: -# -# i) one table with m_field_metadata sized at 290 -# ii) an insert is performed; -# iii) the logs are flushed; -# iv) mysqlbinlog is used to check if it succeeds. -# -# In step iv), before the bug was fixed, the test case would fail -# with mysqlbinlog reporting that it was unable to succeed in -# reading the event. - --- source include/master-slave.inc --- source include/have_innodb.inc --- source include/have_binlog_format_row.inc - --- disable_warnings -DROP TABLE IF EXISTS `t1`; --- enable_warnings - --- echo ### TABLE with field_metadata_size == 290 -CREATE TABLE `t1` ( - `c1` int(11) NOT NULL AUTO_INCREMENT, - `c2` varchar(30) NOT NULL, - `c3` varchar(30) DEFAULT NULL, - `c4` varchar(30) DEFAULT NULL, - `c5` varchar(30) DEFAULT NULL, - `c6` varchar(30) DEFAULT NULL, - `c7` varchar(30) DEFAULT NULL, - `c8` varchar(30) DEFAULT NULL, - `c9` varchar(30) DEFAULT NULL, - `c10` varchar(30) DEFAULT NULL, - `c11` varchar(30) DEFAULT NULL, - `c12` varchar(30) DEFAULT NULL, - `c13` varchar(30) DEFAULT NULL, - `c14` varchar(30) DEFAULT NULL, - `c15` varchar(30) DEFAULT NULL, - `c16` varchar(30) DEFAULT NULL, - `c17` varchar(30) DEFAULT NULL, - `c18` varchar(30) DEFAULT NULL, - `c19` varchar(30) DEFAULT NULL, - `c20` varchar(30) DEFAULT NULL, - `c21` varchar(30) DEFAULT NULL, - `c22` varchar(30) DEFAULT NULL, - `c23` varchar(30) DEFAULT NULL, - `c24` varchar(30) DEFAULT NULL, - `c25` varchar(30) DEFAULT NULL, - `c26` varchar(30) DEFAULT NULL, - `c27` varchar(30) DEFAULT NULL, - `c28` varchar(30) DEFAULT NULL, - `c29` varchar(30) DEFAULT NULL, - `c30` varchar(30) DEFAULT NULL, - `c31` varchar(30) DEFAULT NULL, - `c32` varchar(30) DEFAULT NULL, - `c33` varchar(30) DEFAULT NULL, - `c34` varchar(30) DEFAULT NULL, - `c35` varchar(30) DEFAULT NULL, - `c36` varchar(30) DEFAULT NULL, - `c37` varchar(30) DEFAULT NULL, - `c38` varchar(30) DEFAULT NULL, - `c39` varchar(30) DEFAULT NULL, - `c40` varchar(30) DEFAULT NULL, - `c41` varchar(30) DEFAULT NULL, - `c42` varchar(30) DEFAULT NULL, - `c43` varchar(30) DEFAULT NULL, - `c44` varchar(30) DEFAULT NULL, - `c45` varchar(30) DEFAULT NULL, - `c46` varchar(30) DEFAULT NULL, - `c47` varchar(30) DEFAULT NULL, - `c48` varchar(30) DEFAULT NULL, - `c49` varchar(30) DEFAULT NULL, - `c50` varchar(30) DEFAULT NULL, - `c51` varchar(30) DEFAULT NULL, - `c52` varchar(30) DEFAULT NULL, - `c53` varchar(30) DEFAULT NULL, - `c54` varchar(30) DEFAULT NULL, - `c55` varchar(30) DEFAULT NULL, - `c56` varchar(30) DEFAULT NULL, - `c57` varchar(30) DEFAULT NULL, - `c58` varchar(30) DEFAULT NULL, - `c59` varchar(30) DEFAULT NULL, - `c60` varchar(30) DEFAULT NULL, - `c61` varchar(30) DEFAULT NULL, - `c62` varchar(30) DEFAULT NULL, - `c63` varchar(30) DEFAULT NULL, - `c64` varchar(30) DEFAULT NULL, - `c65` varchar(30) DEFAULT NULL, - `c66` varchar(30) DEFAULT NULL, - `c67` varchar(30) DEFAULT NULL, - `c68` varchar(30) DEFAULT NULL, - `c69` varchar(30) DEFAULT NULL, - `c70` varchar(30) DEFAULT NULL, - `c71` varchar(30) DEFAULT NULL, - `c72` varchar(30) DEFAULT NULL, - `c73` varchar(30) DEFAULT NULL, - `c74` varchar(30) DEFAULT NULL, - `c75` varchar(30) DEFAULT NULL, - `c76` varchar(30) DEFAULT NULL, - `c77` varchar(30) DEFAULT NULL, - `c78` varchar(30) DEFAULT NULL, - `c79` varchar(30) DEFAULT NULL, - `c80` varchar(30) DEFAULT NULL, - `c81` varchar(30) DEFAULT NULL, - `c82` varchar(30) DEFAULT NULL, - `c83` varchar(30) DEFAULT NULL, - `c84` varchar(30) DEFAULT NULL, - `c85` varchar(30) DEFAULT NULL, - `c86` varchar(30) DEFAULT NULL, - `c87` varchar(30) DEFAULT NULL, - `c88` varchar(30) DEFAULT NULL, - `c89` varchar(30) DEFAULT NULL, - `c90` varchar(30) DEFAULT NULL, - `c91` varchar(30) DEFAULT NULL, - `c92` varchar(30) DEFAULT NULL, - `c93` varchar(30) DEFAULT NULL, - `c94` varchar(30) DEFAULT NULL, - `c95` varchar(30) DEFAULT NULL, - `c96` varchar(30) DEFAULT NULL, - `c97` varchar(30) DEFAULT NULL, - `c98` varchar(30) DEFAULT NULL, - `c99` varchar(30) DEFAULT NULL, - `c100` varchar(30) DEFAULT NULL, - `c101` varchar(30) DEFAULT NULL, - `c102` varchar(30) DEFAULT NULL, - `c103` varchar(30) DEFAULT NULL, - `c104` varchar(30) DEFAULT NULL, - `c105` varchar(30) DEFAULT NULL, - `c106` varchar(30) DEFAULT NULL, - `c107` varchar(30) DEFAULT NULL, - `c108` varchar(30) DEFAULT NULL, - `c109` varchar(30) DEFAULT NULL, - `c110` varchar(30) DEFAULT NULL, - `c111` varchar(30) DEFAULT NULL, - `c112` varchar(30) DEFAULT NULL, - `c113` varchar(30) DEFAULT NULL, - `c114` varchar(30) DEFAULT NULL, - `c115` varchar(30) DEFAULT NULL, - `c116` varchar(30) DEFAULT NULL, - `c117` varchar(30) DEFAULT NULL, - `c118` varchar(30) DEFAULT NULL, - `c119` varchar(30) DEFAULT NULL, - `c120` varchar(30) DEFAULT NULL, - `c121` varchar(30) DEFAULT NULL, - `c122` varchar(30) DEFAULT NULL, - `c123` varchar(30) DEFAULT NULL, - `c124` varchar(30) DEFAULT NULL, - `c125` varchar(30) DEFAULT NULL, - `c126` varchar(30) DEFAULT NULL, - `c127` varchar(30) DEFAULT NULL, - `c128` varchar(30) DEFAULT NULL, - `c129` varchar(30) DEFAULT NULL, - `c130` varchar(30) DEFAULT NULL, - `c131` varchar(30) DEFAULT NULL, - `c132` varchar(30) DEFAULT NULL, - `c133` varchar(30) DEFAULT NULL, - `c134` varchar(30) DEFAULT NULL, - `c135` varchar(30) DEFAULT NULL, - `c136` varchar(30) DEFAULT NULL, - `c137` varchar(30) DEFAULT NULL, - `c138` varchar(30) DEFAULT NULL, - `c139` varchar(30) DEFAULT NULL, - `c140` varchar(30) DEFAULT NULL, - `c141` varchar(30) DEFAULT NULL, - `c142` varchar(30) DEFAULT NULL, - `c143` varchar(30) DEFAULT NULL, - `c144` varchar(30) DEFAULT NULL, - `c145` varchar(30) DEFAULT NULL, - `c146` varchar(30) DEFAULT NULL, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB; - -LOCK TABLES `t1` WRITE; -INSERT INTO `t1`(c2) VALUES ('1'); -FLUSH LOGS; - --- sync_slave_with_master --- connection master - --- echo ### assertion: the slave replicated event successfully and tables match --- let $diff_tables= master:t1, slave:t1 --- source include/diff_tables.inc - -DROP TABLE `t1`; - --- connection master --- sync_slave_with_master --- connection master - --- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. - --- let $MYSQLD_DATADIR= `SELECT @@datadir` --- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog --- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog - -############################################################# -# BUG#50018: binlog corruption when table has many columns -# -# Same test from BUG#42749, but now we generate some SQL which -# creates and inserts into tables with metadata size from 249 -# to 258. -# -# The test works as follows: -# 1. SQL for several CREATE TABLE and INSERTS are generated -# into a file. -# 2. This file is then "sourced" -# 3. The slave is synchronized with the master -# 4. FLUSH LOGS on master -# 5. Compare tables on master and slave. -# 6. run mysqlbinlog on master's binary log -# -# Steps #5 and #6 assert that binary log is not corrupted -# in both cases: when slave is replaying events and when -# mysqlbinlog is used to read the binary log - ---source include/rpl_reset.inc --- connection master - -# Create several tables with field_metadata_size ranging -# from 249 to 258 (so that we cover 251 and 255 range). -# This should exercise the switch between using 1 or 3 -# bytes to pack m_field_metadata_size. -# -# Each varchar field takes up to 2 metadata bytes, see: -# -# Field_varstring::do_save_field_metadata (field.cc) -# -# The float field takes 1 byte, see: -# -# Field_float::do_save_field_metadata (field.cc) -# - --- let $generated_sql= $MYSQLTEST_VARDIR/tmp/b50018.sql --- let B50018_FILE= $generated_sql - --- echo ### action: generating several tables with different metadata --- echo ### sizes (resorting to perl) --- perl -my $file= $ENV{'B50018_FILE'}; -open(FILE, ">", "$file") or die "Unable to open bug 50018 generated SQL file: $!" ; - -my $tables= ""; -my $ntables= 10; -my $base_ncols= 124; - -for my $i (1..$ntables) -{ - my $ncols= $base_ncols + $i; - my $metadata_size= $ncols_variable * 2 + 1; - - print FILE "-- echo ### testing table with " . ($base_ncols*2 + $i) . " field metadata size.\n"; - print FILE "CREATE TABLE t$i (\n"; - for my $n (1..$base_ncols) - { - print FILE "c$n VARCHAR(30) NOT NULL DEFAULT 'BUG#50018',\n"; - } - - for my $n (1..$i) - { - print FILE "c" . ($base_ncols+$n) . " FLOAT NOT NULL DEFAULT 0"; - if ($n < $i) - { - print FILE ",\n"; - } - } - - print FILE ") Engine=InnoDB;\n"; - - $tables.= " t$i WRITE"; - if ($i < $ntables) - { - $tables .=","; - } - - print FILE "LOCK TABLES t$i WRITE;\n"; - print FILE "INSERT INTO t$i(c". ($base_ncols+1) . ") VALUES (50018);\n"; - print FILE "UNLOCK TABLES;"; -} - -close(FILE); - -EOF - -## we don't need this in the result file -## however, for debugging purposes you -## may want to reactivate query logging --- disable_query_log --- source $generated_sql --- enable_query_log - --- sync_slave_with_master --- connection master - -FLUSH LOGS; - --- let $ntables=10 -while($ntables) -{ - -- echo ### assertion: the slave replicated event successfully and tables match for t$ntables - -- let $diff_tables= master:t$ntables, slave:t$ntables - -- source include/diff_tables.inc - - -- connection master - -- disable_query_log - -- eval DROP TABLE t$ntables - -- enable_query_log - -- sync_slave_with_master - -- connection master - - -- dec $ntables -} - --- echo ### assertion: check that binlog is not corrupt. Using mysqlbinlog to --- echo ### detect failure. Before the patch mysqlbinlog would find --- echo ### a corrupted event, thence would fail. --- let $MYSQLD_DATADIR= `SELECT @@datadir` --- exec $MYSQL_BINLOG -v --hex $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog - -## clean up -## For debugging purposes you might want not to remove these --- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog --- remove_file $generated_sql ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test deleted file mode 100644 index 8a5d743a238..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_until.test +++ /dev/null @@ -1,150 +0,0 @@ --- source include/have_binlog_format_row.inc --- source include/master-slave.inc - -############################################################################## -# The test is dependent on binlog positions. The test is divided into two -# sections. The first section checks START SLAVE UNTIL MASTER_LOG_FILE = -# 'log_name', MASTER_LOG_POS = log_pos followed by a couple of failure -# scenarios. The second section checks START SLAVE UNTIL RELAY_LOG_FILE = -# 'log_name', RELAY_LOG_POS = log_pos. -############################################################################## - -# Create some events on master -connection master; -CREATE TABLE t1(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); -INSERT INTO t1 VALUES (1),(2),(3),(4); -# Save master log position for query DROP TABLE t1 -let $master_pos_drop_t1= query_get_value(SHOW MASTER STATUS, Position, 1); -DROP TABLE t1; -# Save master log position for query DROP TABLE t1 -save_master_pos; -let $master_pos_drop_t1= query_get_value(SHOW BINLOG EVENTS, Pos, 10); -let $master_log_file= query_get_value(SHOW BINLOG EVENTS, Log_name, 10); - -# Save master log position for query CREATE TABLE t2 -let $master_pos_create_t2= query_get_value(SHOW MASTER STATUS, Position, 1); -CREATE TABLE t2(n INT NOT NULL AUTO_INCREMENT PRIMARY KEY); -#show binlog events; - -INSERT INTO t2 VALUES (1),(2); -# Save master log position for query INSERT INTO t2 VALUES (1),(2); -let $master_pos_insert1_t2= query_get_value(SHOW MASTER STATUS, Position, 1); -INSERT INTO t2 VALUES (3),(4); -DROP TABLE t2; -# Save master log position for query DROP TABLE t2; -let $master_pos_drop_t2= query_get_value(SHOW MASTER STATUS, Position, 1); -sync_slave_with_master; -#show binlog events; - ---source include/stop_slave.inc -# Reset slave. -RESET SLAVE; ---replace_result $MASTER_MYPORT MASTER_MYPORT -eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT; - -# Try to replicate all queries until drop of t1 - -connection slave; ---replace_result $master_pos_drop_t1 master_pos_drop_t1 -eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1; ---source include/wait_for_slave_sql_to_stop.inc - -# Here table should be still not deleted -SELECT * FROM t1; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_drop_t1 ---source include/check_slave_param.inc - -# This should fail right after start -START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291; ---source include/wait_for_slave_sql_to_stop.inc -# again this table should be still not deleted -SELECT * FROM t1; - ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_drop_t1 ---source include/check_slave_param.inc - -# clean up -START SLAVE; ---source include/wait_for_slave_to_start.inc -connection master; -sync_slave_with_master; ---source include/stop_slave.inc - -# This should stop immediately as we are already there ---replace_result $master_pos_create_t2 master_pos_create_t2 -eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2; -let $slave_param= Until_Log_Pos; -let $slave_param_value= $master_pos_create_t2; ---source include/wait_for_slave_param.inc ---source include/wait_for_slave_sql_to_stop.inc -# here the sql slave thread should be stopped ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_drop_t2 ---source include/check_slave_param.inc - -#testing various error conditions ---replace_result 561 MASTER_LOG_POS ---error 1277 -START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561; ---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS ---error 1277 -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12; ---error 1277 -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001'; ---error 1277 -START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000009'; ---replace_result 561 MASTER_LOG_POS ---error 1277 -START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561; ---replace_result 740 MASTER_LOG_POS -START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740; - ---source include/stop_slave.inc -RESET SLAVE; ---source include/start_slave.inc - -############################################################################## -# The second section - checks START SLAVE UNTIL RELAY_LOG_FILE =# 'log_name', -# RELAY_LOG_POS = log_pos. This section of the test does the following: -# 1) At master, create a table and inserts a value. Let slave replicate this. -# 2) Stop slave sql thread. -# 3) Insert some more values at master. Note that io thread copies this insert -# 4) Use start slave until to start the sql thread and check if it -# stops at the correct position. -############################################################################## - ---source include/rpl_reset.inc - ---connection master -CREATE TABLE t1 (a INT); -INSERT INTO t1 VALUES (1); - ---sync_slave_with_master ---source include/stop_slave_sql.inc - ---connection master -INSERT INTO t1 VALUES (2); ---let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1) -INSERT INTO t1 VALUES (3); - ---source include/sync_slave_io_with_master.inc - ---let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File,1) ---source include/get_relay_log_pos.inc - ---replace_result $relay_log_pos relay_log_pos ---eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos ---source include/wait_for_slave_sql_to_stop.inc - ---let $assert_cond= COUNT(*) = 2 FROM t1 ---let $assert_text= table t1 should have two rows. ---source include/assert.inc - -#cleanup ---source include/start_slave.inc ---connection master -DROP TABLE t1; ---sync_slave_with_master ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_skip_replication.test b/mysql-test/suite/rpl/t/rpl_skip_replication.test deleted file mode 100644 index f815554d4af..00000000000 --- a/mysql-test/suite/rpl/t/rpl_skip_replication.test +++ /dev/null @@ -1,377 +0,0 @@ ---source include/master-slave.inc ---source include/have_innodb.inc - -connection slave; -# Test that SUPER is required to change @@replicate_events_marked_for_skip. -CREATE USER 'nonsuperuser'@'127.0.0.1'; -GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE, - SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1'; -connect(nonpriv, 127.0.0.1, nonsuperuser,, test, $SLAVE_MYPORT,); -connection nonpriv; ---error ER_SPECIFIC_ACCESS_DENIED_ERROR -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -disconnect nonpriv; -connection slave; -DROP USER'nonsuperuser'@'127.0.0.1'; - -SELECT @@global.replicate_events_marked_for_skip; ---error ER_SLAVE_MUST_STOP -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -SELECT @@global.replicate_events_marked_for_skip; -STOP SLAVE; ---error ER_GLOBAL_VARIABLE -SET SESSION replicate_events_marked_for_skip=FILTER_ON_MASTER; -SELECT @@global.replicate_events_marked_for_skip; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -SELECT @@global.replicate_events_marked_for_skip; -START SLAVE; - -connection master; -SELECT @@skip_replication; ---error ER_LOCAL_VARIABLE -SET GLOBAL skip_replication=1; -SELECT @@skip_replication; - -CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=innodb; -INSERT INTO t1(a) VALUES (1); -INSERT INTO t2(a) VALUES (1); - - -# Test that master-side filtering works. -SET skip_replication=1; - -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t1(a) VALUES (2); -INSERT INTO t2(a) VALUES (2); - -# Inject a rotate event in the binlog stream sent to slave (otherwise we will -# fail sync_slave_with_master as the last event on the master is not present -# on the slave). -FLUSH NO_WRITE_TO_BINLOG LOGS; - -sync_slave_with_master; -connection slave; -SHOW TABLES; -SELECT * FROM t1; -SELECT * FROM t2; - -connection master; -DROP TABLE t3; - -FLUSH NO_WRITE_TO_BINLOG LOGS; -sync_slave_with_master; - - -# Test that slave-side filtering works. -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE; - -connection master; -SET skip_replication=1; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t1(a) VALUES (3); -INSERT INTO t2(a) VALUES (3); - -# Inject a rotate event in the binlog stream sent to slave (otherwise we will -# fail sync_slave_with_master as the last event on the master is not present -# on the slave). -FLUSH NO_WRITE_TO_BINLOG LOGS; - -sync_slave_with_master; -connection slave; -SHOW TABLES; -SELECT * FROM t1; -SELECT * FROM t2; - -connection master; -DROP TABLE t3; - -FLUSH NO_WRITE_TO_BINLOG LOGS; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; - - -# Test that events with @@skip_replication=1 are not filtered when filtering is -# not set on slave. -connection master; -SET skip_replication=1; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=myisam; -INSERT INTO t3(a) VALUES(2); -sync_slave_with_master; -connection slave; -SELECT * FROM t3; -connection master; -DROP TABLE t3; - -# -# Test that the slave will preserve the @@skip_replication flag in its -# own binlog. -# - -TRUNCATE t1; -sync_slave_with_master; -connection slave; -RESET MASTER; - -connection master; -SET skip_replication=0; -INSERT INTO t1 VALUES (1,0); -SET skip_replication=1; -INSERT INTO t1 VALUES (2,0); -SET skip_replication=0; -INSERT INTO t1 VALUES (3,0); - -sync_slave_with_master; -connection slave; -# Since slave has @@replicate_events_marked_for_skip=REPLICATE, it should have -# applied all events. -SELECT * FROM t1 ORDER by a; - -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -let $SLAVE_DATADIR= `select @@datadir`; - -connection master; -TRUNCATE t1; - -# Now apply the slave binlog to the master, to check that both the slave -# and mysqlbinlog will preserve the @@skip_replication flag. ---exec $MYSQL_BINLOG $SLAVE_DATADIR/slave-bin.000001 > $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog ---exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/rpl_skip_replication.binlog - -# The master should have all three events. -SELECT * FROM t1 ORDER by a; - -# The slave should be missing event 2, which is marked with the -# @@skip_replication flag. - -connection slave; -START SLAVE; - -connection master; -sync_slave_with_master; - -connection slave; -SELECT * FROM t1 ORDER by a; - -# -# Test that @@sql_slave_skip_counter does not count skipped @@skip_replication -# events. -# - -connection master; -TRUNCATE t1; - -sync_slave_with_master; -connection slave; -STOP SLAVE; -# We will skip two INSERTs (in addition to any skipped due to -# @@skip_replication). Since from 5.5 every statement is wrapped in -# BEGIN ... END, we need to skip 6 events for this. -SET GLOBAL sql_slave_skip_counter=6; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE; - -connection master; -# Need to fix @@binlog_format to get consistent event count. -SET @old_binlog_format= @@binlog_format; -SET binlog_format= statement; -SET skip_replication=0; -INSERT INTO t1 VALUES (1,5); -SET skip_replication=1; -INSERT INTO t1 VALUES (2,5); -SET skip_replication=0; -INSERT INTO t1 VALUES (3,5); -INSERT INTO t1 VALUES (4,5); -SET binlog_format= @old_binlog_format; - -sync_slave_with_master; -connection slave; - -# The slave should have skipped the first three inserts (number 1 and 3 due -# to @@sql_slave_skip_counter=2, number 2 due to -# @@replicate_events_marked_for_skip=FILTER_ON_SLAVE). So only number 4 -# should be left. -SELECT * FROM t1; - - -# -# Check that BINLOG statement preserves the @@skip_replication flag. -# -connection slave; -# Need row @@binlog_format for BINLOG statements containing row events. ---source include/stop_slave.inc -SET @old_slave_binlog_format= @@global.binlog_format; -SET GLOBAL binlog_format= row; ---source include/start_slave.inc - -connection master; -TRUNCATE t1; - -SET @old_binlog_format= @@binlog_format; -SET binlog_format= row; -# Format description log event. -BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAA371saA=='; -# INSERT INTO t1 VALUES (1,8) # with @@skip_replication=1 -BINLOG 'wlZOTxMBAAAAKgAAAGMBAAAAgCkAAAAAAAEABHRlc3QAAnQxAAIDAwAC -wlZOTxcBAAAAJgAAAIkBAAAAgCkAAAAAAAEAAv/8AQAAAAgAAAA='; -# INSERT INTO t1 VALUES (2,8) # with @@skip_replication=0 -BINLOG 'wlZOTxMBAAAAKgAAADwCAAAAACkAAAAAAAEABHRlc3QAAnQxAAIDAwAC -wlZOTxcBAAAAJgAAAGICAAAAACkAAAAAAAEAAv/8AgAAAAgAAAA='; -SET binlog_format= @old_binlog_format; - -SELECT * FROM t1 ORDER BY a; -sync_slave_with_master; -connection slave; -# Slave should have only the second insert, the first should be ignored due to -# the @@skip_replication flag. -SELECT * FROM t1 ORDER by a; - ---source include/stop_slave.inc -SET GLOBAL binlog_format= @old_slave_binlog_format; ---source include/start_slave.inc - - -# Test that it is not possible to change @@skip_replication inside a -# transaction or statement, thereby replicating only parts of statements -# or transactions. -connection master; -SET skip_replication=0; - -BEGIN; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=0; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -ROLLBACK; -SET skip_replication=1; -BEGIN; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=0; ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -COMMIT; -SET autocommit=0; -INSERT INTO t2(a) VALUES(100); ---error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET skip_replication=1; -ROLLBACK; -SET autocommit=1; - -SET skip_replication=1; ---delimiter | -CREATE FUNCTION foo (x INT) RETURNS INT BEGIN SET SESSION skip_replication=x; RETURN x; END| -CREATE PROCEDURE bar(x INT) BEGIN SET SESSION skip_replication=x; END| -CREATE FUNCTION baz (x INT) RETURNS INT BEGIN CALL bar(x); RETURN x; END| ---delimiter ; ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SELECT foo(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SELECT baz(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET @a= foo(1); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -SET @a= baz(1); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -UPDATE t2 SET b=foo(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -UPDATE t2 SET b=baz(0); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -INSERT INTO t1 VALUES (101, foo(1)); ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_SKIP_REPLICATION -INSERT INTO t1 VALUES (101, baz(0)); -SELECT @@skip_replication; -CALL bar(0); -SELECT @@skip_replication; -CALL bar(1); -SELECT @@skip_replication; -DROP FUNCTION foo; -DROP PROCEDURE bar; -DROP FUNCTION baz; - - -# Test that master-side filtering happens on the master side, and that -# slave-side filtering happens on the slave. - -# First test that events do not reach the slave when master-side filtering -# is configured. Do this by replicating first with only the IO thread running -# and master-side filtering; then change to no filtering and start the SQL -# thread. This should still skip the events, as master-side filtering -# means the events never reached the slave. -connection master; -SET skip_replication= 0; -TRUNCATE t1; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_MASTER; -START SLAVE IO_THREAD; -connection master; -SET skip_replication= 1; -INSERT INTO t1(a) VALUES (1); -SET skip_replication= 0; -INSERT INTO t1(a) VALUES (2); ---source include/save_master_pos.inc -connection slave; ---source include/sync_io_with_master.inc -STOP SLAVE IO_THREAD; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; -connection master; -sync_slave_with_master; -connection slave; -# Now only the second insert of (2) should be visible, as the first was -# filtered on the master, so even though the SQL thread ran without skipping -# events, it will never see the event in the first place. -SELECT * FROM t1; - -# Now tests that when slave-side filtering is configured, events _do_ reach -# the slave. -connection master; -SET skip_replication= 0; -TRUNCATE t1; -sync_slave_with_master; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=FILTER_ON_SLAVE; -START SLAVE IO_THREAD; -connection master; -SET skip_replication= 1; -INSERT INTO t1(a) VALUES (1); -SET skip_replication= 0; -INSERT INTO t1(a) VALUES (2); ---source include/save_master_pos.inc -connection slave; ---source include/sync_io_with_master.inc -STOP SLAVE IO_THREAD; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; -connection master; -sync_slave_with_master; -connection slave; -# Now both inserts should be visible. Since filtering was configured to be -# slave-side, the event is in the relay log, and when the SQL thread ran we -# had disabled filtering again. -SELECT * FROM t1 ORDER BY a; - - -# Clean up. -connection master; -SET skip_replication=0; -DROP TABLE t1,t2; -connection slave; -STOP SLAVE; -SET GLOBAL replicate_events_marked_for_skip=REPLICATE; -START SLAVE; - ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test deleted file mode 100644 index c978a145a92..00000000000 --- a/mysql-test/suite/rpl/t/rpl_sp.test +++ /dev/null @@ -1,741 +0,0 @@ -# row-based and statement have expected binlog difference in result files - -# Test of replication of stored procedures (WL#2146 for MySQL 5.0) -# Modified by WL#2971. - -source include/have_binlog_format_mixed.inc; -source include/master-slave.inc; - - -# we need a db != test, where we don't have automatic grants ---disable_warnings -drop database if exists mysqltest1; ---enable_warnings -create database mysqltest1; -use mysqltest1; -create table t1 (a varchar(100)); -sync_slave_with_master; -use mysqltest1; - -# ********************** PART 1 : STORED PROCEDURES *************** - -# Does the same proc as on master get inserted into mysql.proc ? -# (same definer, same properties...) - -connection master; - -delimiter |; - -# Stored procedures don't have the limitations that functions have -# regarding binlogging: it's ok to create a procedure as not -# deterministic and updating data, while it's not ok to create such a -# function. We test this. - -create procedure foo() -begin - declare b int; - set b = 8; - insert into t1 values (b); - insert into t1 values (unix_timestamp()); -end| -delimiter ;| - -# we replace columns having times -# (even with fixed timestamp displayed time may changed based on TZ) ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where name='foo' and db='mysqltest1'; -sync_slave_with_master; -# You will notice in the result that the definer does not match what -# it is on master, it is a known bug on which Alik is working ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where name='foo' and db='mysqltest1'; - -connection master; -# see if timestamp used in SP on slave is same as on master -set timestamp=1000000000; -call foo(); -select * from t1; -sync_slave_with_master; -select * from t1; - -# Now a SP which is not updating tables - -connection master; -delete from t1; -create procedure foo2() - select * from mysqltest1.t1; -call foo2(); - -# check that this is allowed (it's not for functions): -alter procedure foo2 contains sql; - -# SP with definer's right - -drop table t1; -create table t1 (a int); -create table t2 like t1; - -create procedure foo3() - deterministic - insert into t1 values (15); - -# let's create a non-privileged user -grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1; -grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1; -grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1; - -# ToDo: BUG#14931: There is a race between the last grant binlogging, and -# the binlogging in the new connection made below, causing sporadic test -# failures due to switched statement order in binlog. To fix this we do -# SELECT 1 in the first connection before starting the second, ensuring -# that binlogging is done in the expected order. -# Please remove this SELECT 1 when BUG#14931 is fixed. -SELECT 1; - -connect (con1,127.0.0.1,zedjzlcsjhd,,mysqltest1,$MASTER_MYPORT,); -connection con1; - -# this routine will fail in the second INSERT because of privileges -delimiter |; -create procedure foo4() - deterministic - begin - insert into t2 values(3); - insert into t1 values (5); - end| - -delimiter ;| - -# I add ,0 so that it does not print the error in the test output, -# because this error is hostname-dependent ---error 1142,0 -call foo4(); # invoker has no INSERT grant on table t1 => failure - -connection master; -call foo3(); # success (definer == root) -show warnings; - ---error 1142,0 -call foo4(); # definer's rights => failure - -# we test replication of ALTER PROCEDURE -alter procedure foo4 sql security invoker; -call foo4(); # invoker's rights => success -show warnings; - -# Note that half-failed procedure calls are ok with binlogging; -# if we compare t2 on master and slave we see they are identical: - -select * from t1; -select * from t2; -sync_slave_with_master; -select * from t1; -select * from t2; - -# Let's check another failing-in-the-middle procedure -connection master; -delete from t2; -alter table t2 add unique (a); - -drop procedure foo4; -delimiter |; -create procedure foo4() - deterministic - begin - insert into t2 values(20),(20); - end| - -delimiter ;| - ---error ER_DUP_ENTRY -call foo4(); -show warnings; - -select * from t2; -sync_slave_with_master; -# check that this failed-in-the-middle replicated right: -select * from t2; - -# Test of DROP PROCEDURE - ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where name="foo4" and db='mysqltest1'; -connection master; -drop procedure foo4; -select * from mysql.proc where name="foo4" and db='mysqltest1'; -sync_slave_with_master; -select * from mysql.proc where name="foo4" and db='mysqltest1'; - -# ********************** PART 2 : FUNCTIONS *************** - -connection master; -drop procedure foo; -drop procedure foo2; -drop procedure foo3; - -delimiter |; -# check that needs "deterministic" ---error 1418 -create function fn1(x int) - returns int -begin - insert into t1 values (x); - return x+2; -end| -create function fn1(x int) - returns int - deterministic -begin - insert into t1 values (x); - return x+2; -end| - -delimiter ;| -delete t1,t2 from t1,t2; -select fn1(20); -insert into t2 values(fn1(21)); -select * from t1; -select * from t2; -sync_slave_with_master; -select * from t1; -select * from t2; - -connection master; -delimiter |; - -drop function fn1; - -create function fn1() - returns int - no sql -begin - return unix_timestamp(); -end| - -delimiter ;| -# check that needs "deterministic" ---error 1418 -alter function fn1 contains sql; - -delete from t1; -set timestamp=1000000000; -insert into t1 values(fn1()); - -connection con1; - -delimiter |; ---error 1419 # only full-global-privs user can create a function -create function fn2() - returns int - no sql -begin - return unix_timestamp(); -end| -delimiter ;| -connection master; -set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; -set global log_bin_trust_function_creators=0; -set global log_bin_trust_function_creators=1; -# slave needs it too otherwise will not execute what master allowed: -connection slave; -set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; -set global log_bin_trust_function_creators=1; - -connection con1; - -delimiter |; -create function fn2() - returns int - no sql -begin - return unix_timestamp(); -end| -delimiter ;| - -connection master; - -# Now a function which is supposed to not update tables -# as it's "reads sql data", so should not give error even if -# non-deterministic. - -delimiter |; -create function fn3() - returns int - not deterministic - reads sql data -begin - return 0; -end| -delimiter ;| - -select fn3(); ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where db='mysqltest1'; -select * from t1; - -sync_slave_with_master; -use mysqltest1; -select * from t1; ---replace_result localhost.localdomain localhost 127.0.0.1 localhost ---replace_column 13 # 14 # -select * from mysql.proc where db='mysqltest1'; - -# Let's check a failing-in-the-middle function -connection master; -delete from t2; -alter table t2 add unique (a); - -drop function fn1; - -delimiter |; -create function fn1(x int) - returns int -begin - insert into t2 values(x),(x); - return 10; -end| - -delimiter ;| - -do fn1(100); - ---error ER_DUP_ENTRY -select fn1(20); - -select * from t2; -sync_slave_with_master; - -# check that this failed-in-the-middle replicated right: -select * from t2; - -# ********************** PART 3 : TRIGGERS *************** - -connection con1; -# now fails due to missing trigger grant (err 1142 i/o 1227) due to new -# check in sql_trigger.cc (v1.44) by anozdrin on 2006/02/01 --azundris ---error ER_TABLEACCESS_DENIED_ERROR -create trigger trg before insert on t1 for each row set new.a= 10; - -connection master; -delete from t1; -# TODO: when triggers can contain an update, test that this update -# does not go into binlog. -# I'm not setting user vars in the trigger, because replication of user vars -# would take care of propagating the user var's value to slave, so even if -# the trigger was not executed on slave it would not be discovered. -create trigger trg before insert on t1 for each row set new.a= 10; -insert into t1 values (1); -select * from t1; -sync_slave_with_master; -select * from t1; - -connection master; -delete from t1; -drop trigger trg; -insert into t1 values (1); -select * from t1; -sync_slave_with_master; -select * from t1; - - -# ********************** PART 4 : RELATED FIXED BUGS *************** - - -# -# Test for bug #13969 "Routines which are replicated from master can't be -# executed on slave". -# -connection master; -create procedure foo() - not deterministic - reads sql data - select * from t1; -sync_slave_with_master; -# This should not fail -call foo(); -connection master; -drop procedure foo; -sync_slave_with_master; - - -# Clean up -connection master; -drop function fn1; -drop database mysqltest1; -drop user "zedjzlcsjhd"@127.0.0.1; -use test; -sync_slave_with_master; -use test; - -# -# Bug#14077 "Failure to replicate a stored function with a cursor": -# verify that stored routines with cursors work on slave. -# -connection master; ---disable_warnings -drop function if exists f1; ---enable_warnings -delimiter |; -create function f1() returns int reads sql data -begin - declare var integer; - declare c cursor for select a from v1; - open c; - fetch c into var; - close c; - return var; -end| -delimiter ;| -create view v1 as select 1 as a; -create table t1 (a int); -insert into t1 (a) values (f1()); -select * from t1; -drop view v1; -drop function f1; -sync_slave_with_master; -connection slave; -select * from t1; - -# -# Bug#16621 "INSERTs in Stored Procedures causes data corruption in the Binary -# Log for 5.0.18" -# - -# Prepare environment. - -connection master; - ---disable_warnings -DROP PROCEDURE IF EXISTS p1; -DROP TABLE IF EXISTS t1; ---enable_warnings - -# Test case. - -CREATE TABLE t1(col VARCHAR(10)); - -CREATE PROCEDURE p1(arg VARCHAR(10)) - INSERT INTO t1 VALUES(arg); - -CALL p1('test'); - -SELECT * FROM t1; - -sync_slave_with_master; -SELECT * FROM t1; - -# Cleanup -connection master; -DROP PROCEDURE p1; - - -# -# BUG#20438: CREATE statements for views, stored routines and triggers can be -# not replicable. -# - ---echo ---echo ---> Test for BUG#20438 - -# Prepare environment. - ---echo ---echo ---> Preparing environment... ---echo ---> connection: master ---connection master - ---disable_warnings -DROP PROCEDURE IF EXISTS p1; -DROP FUNCTION IF EXISTS f1; ---enable_warnings - ---echo ---echo ---> Synchronizing slave with master... - ---sync_slave_with_master - ---echo ---echo ---> connection: master ---connection master - -# Test. - ---echo ---echo ---> Creating procedure... - -/*!50003 CREATE PROCEDURE p1() SET @a = 1 */; - -/*!50003 CREATE FUNCTION f1() RETURNS INT RETURN 0 */; - ---echo ---echo ---> Checking on master... - -SHOW CREATE PROCEDURE p1; -SHOW CREATE FUNCTION f1; - ---echo ---echo ---> Synchronizing slave with master... - ---sync_slave_with_master - ---echo ---> connection: master - ---echo ---echo ---> Checking on slave... - -SHOW CREATE PROCEDURE p1; -SHOW CREATE FUNCTION f1; - -# Cleanup. - ---echo ---echo ---> connection: master ---connection master - ---echo ---echo ---> Cleaning up... - -DROP PROCEDURE p1; -DROP FUNCTION f1; - ---sync_slave_with_master ---connection master - - -# cleanup -connection master; -drop table t1; -sync_slave_with_master; - -# -# Bug22043: MySQL don't add "USE <DATABASE>" before "DROP PROCEDURE IF EXISTS" -# - -connection master; ---disable_warnings -drop database if exists mysqltest; -drop database if exists mysqltest2; ---enable_warnings -create database mysqltest; -create database mysqltest2; -use mysqltest2; -create table t ( t integer ); -create procedure mysqltest.test() begin end; -insert into t values ( 1 ); ---error ER_BAD_DB_ERROR -create procedure `\\`.test() begin end; - -# -# BUG#19725: Calls to stored function in other database are not -# replicated correctly in some cases -# - -connection master; -delimiter |; -create function f1 () returns int -begin - insert into t values (1); - return 0; -end| -delimiter ;| -sync_slave_with_master; -# Let us test if we don't forget to binlog the function's database -connection master; -use mysqltest; -set @a:= mysqltest2.f1(); -sync_slave_with_master; -connection master; - -# Final inspection which verifies how all statements of this test file -# were written to the binary log. ---source include/show_binlog_events.inc - - -# Restore log_bin_trust_function_creators to its original value. -# This is a cleanup for all parts above where we tested stored -# functions and triggers. -connection slave; -set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; -connection master; -set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators; - -# Clean up -drop database mysqltest; -drop database mysqltest2; -sync_slave_with_master; - -# -# Bug#36570: Parse error of CREATE PROCEDURE stmt with comments on slave -# -connection master; -use test; -delimiter |; - -/*!50001 create procedure `mysqltestbug36570_p1`() */ -begin - select 1; -end| - -use mysql| -create procedure test.` mysqltestbug36570_p2`(/*!50001 a int*/)`label`: -begin - select a; -end| - -/*!50001 create function test.mysqltestbug36570_f1() */ - returns int - /*!50001 deterministic */ -begin - return 3; -end| -use test| - -delimiter ;| - ---replace_column 5 t 6 t -show procedure status like '%mysqltestbug36570%'; -show create procedure ` mysqltestbug36570_p2`; - -sync_slave_with_master; -connection slave; - ---replace_column 5 t 6 t -show procedure status like '%mysqltestbug36570%'; -show create procedure ` mysqltestbug36570_p2`; -call ` mysqltestbug36570_p2`(42); - ---replace_column 5 t 6 t -show function status like '%mysqltestbug36570%'; - -connection master; -flush logs; -let $MYSQLD_DATADIR= `select @@datadir`; ---replace_regex /$MYSQL_TEST_DIR/MYSQL_TEST_DIR/ /TIMESTAMP=[0-9]*/TIMESTAMP=t/ ---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 -use test; -drop procedure mysqltestbug36570_p1; -drop procedure ` mysqltestbug36570_p2`; -drop function mysqltestbug36570_f1; ---echo End of 5.0 tests ---echo # End of 5.1 tests ---echo # ---echo # Test Bug#30977 Concurrent statement using stored ---echo # function and DROP FUNCTION breaks SBR. ---echo # ---echo # Demonstrate that stored function DDL can not go through, ---echo # or, worse yet, make its way into the binary log, while ---echo # the stored function is in use. ---echo # For that, try to insert a result of a stored function ---echo # into a table. Block the insert in the beginning, waiting ---echo # on a table lock. While insert is blocked, attempt to ---echo # drop the routine. Verify that this attempt ---echo # blocks and waits for INSERT to complete. Commit and ---echo # reap the chain of events. Master and slave must contain ---echo # identical data. Statements in the binrary log must be ---echo # consistent with data in the table. ---echo # ---echo # --> connection default -connection default; ---disable_warnings -drop table if exists t1, t2; -drop function if exists t1; ---enable_warnings -create table t1 (a int); -create table t2 (a int) as select 1 as a; -create function f1() returns int deterministic return (select max(a) from t2); -lock table t2 write; ---echo # --> connection master -connection master; ---echo # Sending 'insert into t1 (a) values (f1())'... ---send insert into t1 (a) values (f1()) -connection master1; ---echo # Waitng for 'insert into t1 ...' to get blocked on table lock... -let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for table metadata lock' and - info='insert into t1 (a) values (f1())'; ---source include/wait_condition.inc ---echo # Sending 'drop function f1'. It will wait till insert finishes. ---send drop function f1; ---echo # --> connection default -connection default; ---echo # Check that 'drop function f1' gets blocked. -let $wait_condition=select count(*)=1 from information_schema.processlist -where state='Waiting for stored function metadata lock' and info='drop function f1'; ---source include/wait_condition.inc ---echo # Now let's let 'insert' go through... -unlock tables; ---echo # --> connection master -connection master; ---echo # Reaping 'insert into t1 (a) values (f1())'... ---reap ---echo # --> connection master1 -connection master1; ---echo # Reaping 'drop function f1' ---reap ---echo # --> connection master -connection master; -select * from t1; -sync_slave_with_master; -connection slave; -select * from t1; -# Cleanup -connection master; -drop table t1, t2; ---error ER_SP_DOES_NOT_EXIST -drop function f1; - - ---echo # ---echo # Bug #11918 Can't use a declared variable in LIMIT clause ---echo # ---source include/rpl_reset.inc - -create table t1 (c1 int); -insert into t1 (c1) values -(1), (2), (3), (4), (5), (6), (7), (8), (9), (10); - -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - -create procedure p1(p1 integer) - delete from t1 limit p1; - -set @save_binlog_format=@@session.binlog_format; -set @@session.binlog_format=STATEMENT; - ---disable_warnings -call p1(NULL); -call p1(0); -call p1(1); -call p1(2); -call p1(3); ---enable_warnings - -select * from t1; -sync_slave_with_master; -connection slave; -select * from t1; -connection master; ---disable_warnings -call p1(-1); ---enable_warnings -select * from t1; -sync_slave_with_master; -connection slave; -select * from t1; -connection master; - ---echo # Cleanup -set @@session.binlog_format=@save_binlog_format; -drop table t1; -drop procedure p1; - ---echo # End of 5.5 tests. - - -# Cleanup -sync_slave_with_master; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test deleted file mode 100644 index 9194a1fda63..00000000000 --- a/mysql-test/suite/rpl/t/rpl_stm_until.test +++ /dev/null @@ -1,188 +0,0 @@ -# ==== Purpose ==== -# -# Verify that START SLAVE UNTIL replicates until the given binlog -# position but not longer. Verify that START SLAVE UNTIL with various -# incorrect arguments gives an error. -# -# ==== Method ==== -# -# On master, create a table and insert some rows. On slave, START -# SLAVE UNTIL so that it reads one event at a time, and check the -# table and the slave status each time. -# -# Then, on slave, run START SLAVE UNTIL with incorrect arguments and -# verify that it gives an error. -# -# ==== Related bugs ==== -# -# Bug in this test: BUG#37717: rpl.rpl_stm_until 'stmt' fails sporadically on pushbuild - --- source include/have_binlog_format_mixed_or_statement.inc --- source include/master-slave.inc --- source include/rpl_reset.inc - -# Test is dependent on binlog positions -call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); - -# prepare version for substitutions -let $VERSION=`select version()`; - -# Stop slave before it starts replication. Also sync with master -# to avoid nondeterministic behaviour. ---echo [on slave] -sync_slave_with_master; ---source include/stop_slave.inc - ---echo ==== Create some events on master ==== - ---echo [on master] -connection master; -create table t1(n int not null auto_increment primary key); -insert into t1 values (1),(2),(3),(4); -let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1); -let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1); -drop table t1; -create table t2(n int not null auto_increment primary key); -insert into t2 values (1),(2); -let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1); -insert into t2 values (3),(4); -drop table t2; - ---echo ==== Replicate one event at a time on slave ==== - -# try to replicate all queries until drop of t1 ---echo [on slave] -connection slave; ---replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_1 MASTER_LOG_POS -eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_1; ---source include/wait_for_slave_io_to_start.inc ---source include/wait_for_slave_sql_to_stop.inc -# here table should be still not deleted -select * from t1; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos_1 ---source include/check_slave_param.inc - -# this should fail right after start -start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; ---source include/wait_for_slave_io_to_start.inc ---source include/wait_for_slave_sql_to_stop.inc -# again this table should be still not deleted -select * from t1; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos_1 ---source include/check_slave_param.inc - -let $relay_log_file= slave-relay-bin.000003; -let $master_log_pos= $master_log_pos_2; -source include/get_relay_log_pos.inc; -# try replicate all up to and not including the second insert to t2; ---replace_result $relay_log_pos RELAY_LOG_POS -eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos; ---source include/wait_for_slave_io_to_start.inc ---source include/wait_for_slave_sql_to_stop.inc -select * from t2; ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_log_pos ---source include/check_slave_param.inc - -# clean up -start slave; ---echo [on master] -connection master; ---echo [on slave] -sync_slave_with_master; ---source include/stop_slave.inc - ---let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1) -# this should stop immediately as we are already there ---replace_result $master_log_file MASTER_LOG_FILE $master_log_pos_2 MASTER_LOG_POS -eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos_2; ---source include/wait_for_slave_io_to_start.inc ---source include/wait_for_slave_sql_to_stop.inc ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $exec_log_pos_1 ---source include/check_slave_param.inc - ---echo ==== Test various error conditions ==== - ---error 1277 -start slave until master_log_file='master-bin', master_log_pos=561; ---error 1277 -start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; ---error 1277 -start slave until master_log_file='master-bin.000001'; ---error 1277 -start slave until relay_log_file='slave-relay-bin.000002'; ---error 1277 -start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561; -# Warning should be given for second command -start slave sql_thread; -start slave until master_log_file='master-bin.000001', master_log_pos=776; - -# -# bug#47210 first execution of "start slave until" stops too early -# -# testing that a slave rotate event that is caused by stopping the slave -# does not intervene anymore in UNTIL condition. -# - -connection slave; -source include/stop_slave.inc; ---disable_warnings -drop table if exists t1; ---enable_warnings -reset slave; ---replace_result $MASTER_MYPORT MASTER_PORT -eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; - -connection master; ---disable_warnings -drop table if exists t1; ---enable_warnings -reset master; -create table t1 (a int primary key auto_increment); -save_master_pos; -let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1); - -connection slave; -start slave; -sync_with_master; - -# at this point slave will close the relay log stamping it with its own -# Rotate log event. This event won't be examined on matter of the master -# UNTIL pos anymore. -source include/stop_slave.inc; -let $slave_exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); - ---echo master and slave are in sync now -let $diff_pos= `select $master_pos - $slave_exec_pos`; -eval select $diff_pos as zero; - -connection master; -insert into t1 set a=null; -let $until_pos= query_get_value(SHOW MASTER STATUS, Position, 1); -insert into t1 set a=null; -select count(*) as two from t1; - -connection slave; ---replace_result $master_log_file MASTER_LOG_FILE $until_pos UNTIL_POS; -eval start slave until master_log_file='$master_log_file', master_log_pos= $until_pos; -source include/wait_for_slave_sql_to_stop.inc; -let $slave_exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1); ---echo slave stopped at the prescribed position -let $diff_pos= `select $until_pos - $slave_exec_pos`; -eval select $diff_pos as zero; -select count(*) as one from t1; - - -connection master; -drop table t1; - -connection slave; -start slave; -sync_with_master; - -# End of tests ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test deleted file mode 100644 index 866e387cddb..00000000000 --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test +++ /dev/null @@ -1,623 +0,0 @@ -# -# rpl_switch_stm_row_mixed tests covers -# -# - Master is switching explicitly between STATEMENT, ROW, and MIXED -# binlog format showing when it is possible and when not. -# - Master switching from MIXED to RBR implicitly listing all use -# cases, e.g a query invokes UUID(), thereafter to serve as the -# definition of MIXED binlog format -# - correctness of execution - - --- source include/have_binlog_format_mixed_or_row.inc --- source include/master-slave.inc - -# Since this test generates row-based events in the binary log, the -# slave SQL thread cannot be in STATEMENT mode to execute this test, -# so we only execute it for MIXED and ROW as default value of -# BINLOG_FORMAT. - -connection slave; - -connection master; ---disable_warnings -drop database if exists mysqltest1; -create database mysqltest1; ---enable_warnings -use mysqltest1; - -# Save binlog format -set @my_binlog_format= @@global.binlog_format; - -# play with switching -set session binlog_format=mixed; -show session variables like "binlog_format%"; -set session binlog_format=statement; -show session variables like "binlog_format%"; -set session binlog_format=row; -show session variables like "binlog_format%"; - -set global binlog_format=DEFAULT; -show global variables like "binlog_format%"; -set global binlog_format=MIXED; -show global variables like "binlog_format%"; -set global binlog_format=STATEMENT; -show global variables like "binlog_format%"; -set global binlog_format=ROW; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -CREATE TABLE t1 (a varchar(100)); - -prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; -set @string="emergency_1_"; -insert into t1 values("work_2_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_3_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_4_",UUID())); -insert into t1 select "yesterday_5_"; - -# verify that temp tables prevent a switch to SBR -create temporary table tmp(a char(100)); -insert into tmp values("see_6_"); ---error ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR -set binlog_format=statement; -insert into t1 select * from tmp; -drop temporary table tmp; - -# Now we go to SBR -set binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=statement; -show global variables like "binlog_format%"; -show session variables like "binlog_format%"; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_7_"; -insert into t1 values("work_8_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_9_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_10_"); -insert into t1 select "yesterday_11_"; - -# test statement (is not default after wl#3368) -set binlog_format=statement; -select @@global.binlog_format, @@session.binlog_format; -set global binlog_format=statement; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select ?'; -set @string="emergency_12_"; -insert into t1 values("work_13_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values("work_14_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values("for_15_"); -insert into t1 select "yesterday_16_"; - -# and now the mixed mode - -set global binlog_format=mixed; -select @@global.binlog_format, @@session.binlog_format; -set binlog_format=default; -select @@global.binlog_format, @@session.binlog_format; - -prepare stmt1 from 'insert into t1 select concat(UUID(),?)'; -set @string="emergency_17_"; -insert into t1 values("work_18_"); -execute stmt1 using @string; -deallocate prepare stmt1; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_19_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_20_",UUID())); -insert into t1 select "yesterday_21_"; - -prepare stmt1 from 'insert into t1 select ?'; -insert into t1 values(concat(UUID(),"work_22_")); -execute stmt1 using @string; -deallocate prepare stmt1; - -insert into t1 values(concat("for_23_",UUID())); -insert into t1 select "yesterday_24_"; - -# Test of CREATE TABLE SELECT - -create table t2 ENGINE=MyISAM select rpad(UUID(),100,' '); -create table t3 select 1 union select UUID(); -create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); -create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -# what if UUID() is first: ---disable_warnings -insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); ---enable_warnings - -# inside a stored procedure - -delimiter |; -create procedure foo() -begin -insert into t1 values("work_25_"); -insert into t1 values(concat("for_26_",UUID())); -insert into t1 select "yesterday_27_"; -end| -create procedure foo2() -begin -insert into t1 values(concat("emergency_28_",UUID())); -insert into t1 values("work_29_"); -insert into t1 values(concat("for_30_",UUID())); -set session binlog_format=row; # accepted for stored procs -insert into t1 values("more work_31_"); -set session binlog_format=mixed; -end| -create function foo3() returns bigint unsigned -begin - set session binlog_format=row; # rejected for stored funcs - insert into t1 values("alarm"); - return 100; -end| -create procedure foo4(x varchar(100)) -begin -insert into t1 values(concat("work_250_",x)); -insert into t1 select "yesterday_270_"; -end| -delimiter ;| -call foo(); -call foo2(); -call foo4("hello"); -call foo4(UUID()); -call foo4("world"); - -# test that can't SET in a stored function ---error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT -select foo3(); -select * from t1 where a="alarm"; - -# Tests of stored functions/triggers/views for BUG#20930 "Mixed -# binlogging mode does not work with stored functions, triggers, -# views" - -# Function which calls procedure -drop function foo3; -delimiter |; -create function foo3() returns bigint unsigned -begin - insert into t1 values("foo3_32_"); - call foo(); - return 100; -end| -delimiter ;| -insert into t2 select foo3(); - -prepare stmt1 from 'insert into t2 select foo3()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test if stored function calls stored function which calls procedure -# which requires row-based. - -delimiter |; -create function foo4() returns bigint unsigned -begin - insert into t2 select foo3(); - return 100; -end| -delimiter ;| -select foo4(); - -prepare stmt1 from 'select foo4()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function -delimiter |; -create function foo5() returns bigint unsigned -begin - insert into t2 select UUID(); - return 100; -end| -delimiter ;| -select foo5(); - -prepare stmt1 from 'select foo5()'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# A simple stored function where UUID() is in the argument -delimiter |; -create function foo6(x varchar(100)) returns bigint unsigned -begin - insert into t2 select x; - return 100; -end| -delimiter ;| -select foo6("foo6_1_"); -select foo6(concat("foo6_2_",UUID())); - -prepare stmt1 from 'select foo6(concat("foo6_3_",UUID()))'; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - - -# Test of views using UUID() - -create view v1 as select uuid(); -create table t11 (data varchar(255)); -insert into t11 select * from v1; -# Test of querying INFORMATION_SCHEMA which parses the view's body, -# to verify that it binlogs statement-based (is not polluted by -# the parsing of the view's body). -insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11'); -prepare stmt1 from "insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11')"; -execute stmt1; -execute stmt1; -deallocate prepare stmt1; - -# Test of triggers with UUID() -delimiter |; -create trigger t11_bi before insert on t11 for each row -begin - set NEW.data = concat(NEW.data,UUID()); -end| -delimiter ;| -insert into t11 values("try_560_"); - -# Test that INSERT DELAYED works in mixed mode (BUG#20649) -insert delayed into t2 values("delay_1_"); -insert delayed into t2 values(concat("delay_2_",UUID())); -insert delayed into t2 values("delay_6_"); - -# Test for BUG#20633 (INSERT DELAYED RAND()/user_variable does not -# replicate fine in statement-based ; we test that in mixed mode it -# works). -insert delayed into t2 values(rand()); -set @a=2.345; -insert delayed into t2 values(@a); - -# With INSERT DELAYED, rows are written to the binlog after they are -# written to the table. Therefore, it is not enough to wait until the -# rows make it to t2 on the master (the rows may not be in the binlog -# at that time, and may still not be in the binlog when -# sync_slave_with_master is later called). Instead, we wait until the -# rows make it to t2 on the slave. We first call -# sync_slave_with_master, so that we are sure that t2 has been created -# on the slave. -sync_slave_with_master; -let $wait_condition= SELECT COUNT(*) = 19 FROM mysqltest1.t2; ---source include/wait_condition.inc -connection master; - -# If you want to do manual testing of the mixed mode regarding UDFs (not -# testable automatically as quite platform- and compiler-dependent), -# you just need to set the variable below to 1, and to -# "make udf_example.so" in sql/, and to copy sql/udf_example.so to -# MYSQL_TEST_DIR/lib/mysql. -let $you_want_to_test_UDF=0; -if ($you_want_to_test_UDF) -{ - CREATE FUNCTION metaphon RETURNS STRING SONAME 'udf_example.so'; - prepare stmt1 from 'insert into t1 select metaphon(?)'; - set @string="emergency_133_"; - insert into t1 values("work_134_"); - execute stmt1 using @string; - deallocate prepare stmt1; - prepare stmt1 from 'insert into t1 select ?'; - insert into t1 values(metaphon("work_135_")); - execute stmt1 using @string; - deallocate prepare stmt1; - insert into t1 values(metaphon("for_136_")); - insert into t1 select "yesterday_137_"; - create table t6 select metaphon("for_138_"); - create table t7 select 1 union select metaphon("for_139_"); - create table t8 select * from t1 where 3 in (select 1 union select 2 union select metaphon("for_140_") union select 3); - create table t9 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); -} - -create table t20 select * from t1; # save for comparing later -create table t21 select * from t2; -create table t22 select * from t3; -drop table t1,t2,t3; - -# This tests the fix to -# BUG#19630 stored function inserting into two auto_increment breaks statement-based binlog -# We verify that under the mixed binlog mode, a stored function -# modifying at least two tables having an auto_increment column, -# is binlogged row-based. Indeed in statement-based binlogging, -# only the auto_increment value generated for the first table -# is recorded in the binlog, the value generated for the 2nd table -# lacking. - -create table t1 (a int primary key auto_increment, b varchar(100)); -create table t2 (a int primary key auto_increment, b varchar(100)); -create table t3 (b varchar(100)); -delimiter |; -create function f (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f("try_41_"); -# Two operations which compensate each other except that their net -# effect is that they advance the auto_increment counter of t2 on slave: -sync_slave_with_master; -use mysqltest1; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# this is the call which didn't replicate well -select f("try_42_"); -sync_slave_with_master; - -# now use prepared statement and test again, just to see that the RBB -# mode isn't set at PREPARE but at EXECUTE. - -insert into t2 values(3,null),(4,null); -delete from t2 where a>=3; - -connection master; -prepare stmt1 from 'select f(?)'; -set @string="try_43_"; -insert into t1 values(null,"try_44_"); # should be SBB -execute stmt1 using @string; # should be RBB -deallocate prepare stmt1; -sync_slave_with_master; - -# verify that if only one table has auto_inc, it does not trigger RBB -# (we'll check in binlog further below) - -connection master; -create table t12 select * from t1; # save for comparing later -drop table t1; -create table t1 (a int, b varchar(100), key(a)); -select f("try_45_"); - -# restore table's key -create table t13 select * from t1; -drop table t1; -create table t1 (a int primary key auto_increment, b varchar(100)); - -# now test if it's two functions, each of them inserts in one table - -drop function f; -# we need a unique key to have sorting of rows by mysqldump -create table t14 (unique (a)) select * from t2; -truncate table t2; -delimiter |; -create function f1 (x varchar(100)) returns int deterministic -begin - insert into t1 values(null,x); - return 1; -end| -create function f2 (x varchar(100)) returns int deterministic -begin - insert into t2 values(null,x); - return 1; -end| -delimiter ;| -select f1("try_46_"),f2("try_47_"); - -sync_slave_with_master; -insert into t2 values(2,null),(3,null),(4,null); -delete from t2 where a>=2; - -connection master; -# Test with SELECT and INSERT -select f1("try_48_"),f2("try_49_"); -insert into t3 values(concat("try_50_",f1("try_51_"),f2("try_52_"))); -sync_slave_with_master; - -# verify that if f2 does only read on an auto_inc table, this does not -# switch to RBB -connection master; -drop function f2; -delimiter |; -create function f2 (x varchar(100)) returns int deterministic -begin - declare y int; - insert into t1 values(null,x); - set y = (select count(*) from t2); - return y; -end| -delimiter ;| -select f1("try_53_"),f2("try_54_"); -sync_slave_with_master; - -# And now, a normal statement with a trigger (no stored functions) - -connection master; -drop function f2; -delimiter |; -create trigger t1_bi before insert on t1 for each row -begin - insert into t2 values(null,"try_55_"); -end| -delimiter ;| -insert into t1 values(null,"try_56_"); -# and now remove one auto_increment and verify SBB -alter table t1 modify a int, drop primary key; -insert into t1 values(null,"try_57_"); -sync_slave_with_master; - -# Test for BUG#20499 "mixed mode with temporary table breaks binlog" -# Slave used to have only 2 rows instead of 3. -connection master; -CREATE TEMPORARY TABLE t15 SELECT UUID(); -create table t16 like t15; -INSERT INTO t16 SELECT * FROM t15; -# we'll verify that this one is done RBB -insert into t16 values("try_65_"); -drop table t15; -# we'll verify that this one is done SBB -insert into t16 values("try_66_"); -sync_slave_with_master; - -# and now compare: - -connection master; - -# first check that data on master is sensible -select count(*) from t1; -select count(*) from t2; -select count(*) from t3; -select count(*) from t4; -select count(*) from t5; -select count(*) from t11; -select count(*) from t20; -select count(*) from t21; -select count(*) from t22; -select count(*) from t12; -select count(*) from t13; -select count(*) from t14; -select count(*) from t16; -if ($you_want_to_test_UDF) -{ - select count(*) from t6; - select count(*) from t7; - select count(*) from t8; - select count(*) from t9; -} - -sync_slave_with_master; - -# -# Bug#20863 If binlog format is changed between update and unlock of -# tables, wrong binlog -# - -connection master; -DROP TABLE IF EXISTS t11; -SET SESSION BINLOG_FORMAT=STATEMENT; -CREATE TABLE t11 (song VARCHAR(255)); -LOCK TABLES t11 WRITE; -SET SESSION BINLOG_FORMAT=ROW; -INSERT INTO t11 VALUES('Several Species of Small Furry Animals Gathered Together in a Cave and Grooving With a Pict'); -SET SESSION BINLOG_FORMAT=STATEMENT; -INSERT INTO t11 VALUES('Careful With That Axe, Eugene'); -UNLOCK TABLES; - ---query_vertical SELECT * FROM t11 -sync_slave_with_master; -USE mysqltest1; ---query_vertical SELECT * FROM t11 - -connection master; -DROP TABLE IF EXISTS t12; -SET SESSION BINLOG_FORMAT=MIXED; -CREATE TABLE t12 (data LONG); -LOCK TABLES t12 WRITE; -INSERT INTO t12 VALUES(UUID()); -UNLOCK TABLES; -sync_slave_with_master; - -# -# BUG#28086: SBR of USER() becomes corrupted on slave -# - -connection master; - -# Just to get something that is non-trivial, albeit still simple, we -# stuff the result of USER() and CURRENT_USER() into a variable. ---delimiter $$ -CREATE FUNCTION my_user() - RETURNS CHAR(64) -BEGIN - DECLARE user CHAR(64); - SELECT USER() INTO user; - RETURN user; -END $$ ---delimiter ; - ---delimiter $$ -CREATE FUNCTION my_current_user() - RETURNS CHAR(64) -BEGIN - DECLARE user CHAR(64); - SELECT CURRENT_USER() INTO user; - RETURN user; -END $$ ---delimiter ; - -DROP TABLE IF EXISTS t13; -CREATE TABLE t13 (data CHAR(64)); -INSERT INTO t13 VALUES (USER()); -INSERT INTO t13 VALUES (my_user()); -INSERT INTO t13 VALUES (CURRENT_USER()); -INSERT INTO t13 VALUES (my_current_user()); - -sync_slave_with_master; - -# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql ---exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql - -# Let's compare. Note: If they match test will pass, if they do not match -# the test will show that the diff statement failed and not reject file -# will be created. You will need to go to the mysql-test dir and diff -# the files your self to see what is not matching - -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; - -connection master; - -# Now test that mysqlbinlog works fine on a binlog generated by the -# mixed mode - -# BUG#11312 "DELIMITER is not written to the binary log that causes -# syntax error" makes that mysqlbinlog will fail if we pass it the -# text of queries; this forces us to use --base64-output here. - -# BUG#20929 "BINLOG command causes invalid free plus assertion -# failure" makes mysqld segfault when receiving --base64-output - -# So I can't enable this piece of test -# SIGH - -if ($enable_when_11312_or_20929_fixed) -{ ---exec $MYSQL_BINLOG --base64-output $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql -drop database mysqltest1; ---exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_mixed.sql ---exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info mysqltest1 > $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql -# the old mysqldump output on slave is the same as what it was on -# master before restoring on master. -diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; -} - -drop database mysqltest1; -sync_slave_with_master; - -connection master; -# Restore binlog format setting -set global binlog_format =@my_binlog_format; ---source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test deleted file mode 100644 index 1f0220421ab..00000000000 --- a/mysql-test/suite/rpl/t/rpl_timezone.test +++ /dev/null @@ -1,209 +0,0 @@ -####################################### -# Change Author: JBM -# Change Date: 2006-01-17 -# Change: Added order by -####################################### -# Test of replication of time zones. -###################################### -# There is currently some bug possibly in prepared statements (this -# test fails with --ps-protocol): sys_var_thd_time_zone::value_ptr() -# is called only at prepare time, not at execution time. So, -# thd->time_zone_used is not equal to 1 (it is back to 0, because of -# reset_thd_for_next_command called at execution time), so the -# timezone used in CONVERT_TZ is not binlogged. To debug (by Guilhem -# and possibly Konstantin). - -source include/master-slave.inc; - ---disable_query_log -CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); ---enable_query_log - ---disable_ps_protocol - -# Save original timezone -set @my_time_zone= @@global.time_zone; - -# Some preparations -let $VERSION=`select version()`; -set timestamp=100000000; # for fixed output of mysqlbinlog -create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n)); -create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n)); - -connection slave; -select @@time_zone; -#set time_zone='UTC'; -#select @@time_zone; -# -# Let us check how well replication works when we are saving datetime -# value in TIMESTAMP field. -# -connection master; -select @@time_zone; -#set time_zone='UTC'; -#select @@time_zone; -insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL); -insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); -SELECT * FROM t1 ORDER BY n; -sync_slave_with_master; -#set time_zone='UTC'; -SELECT * FROM t1 ORDER BY n; - -# Let us check also that setting of time_zone back to default also works -# well -connection master; -delete from t1; -set time_zone='Europe/Moscow'; -insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); -SELECT * FROM t1 ORDER BY n; -sync_slave_with_master; -set time_zone='Europe/Moscow'; -SELECT * FROM t1 ORDER BY n; -connection master; -# Change Author: JBM -# Change Date: 2005-12-22 -# Change: Comment out the exec of the binlog so test works for both SBR and RBR -#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 - -# Let us check with LOAD DATA INFILE -# (we do it after mysqlbinlog because the temp files names are not constant) -connection master; -delete from t1; -set time_zone='UTC'; -load data infile '../../std_data/rpl_timezone2.dat' into table t1; -SELECT * FROM t1 ORDER BY n; -sync_slave_with_master; -set time_zone='UTC'; -SELECT * FROM t1 ORDER BY n; -set time_zone='Europe/Moscow'; - -# Put back values of before the LOAD -connection master; -set time_zone='Europe/Moscow'; -delete from t1; -insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL); - -# -# Now let us check how well we replicate statments reading TIMESTAMP fields -# (We should see the same data on master and on slave but it should differ -# from originally inserted) -# -set time_zone='MET'; ---disable_warnings ONCE -insert into t2 (select * from t1); -SELECT * FROM t1 ORDER BY n; -sync_slave_with_master; -SELECT * FROM t2 ORDER BY n; - -# -# Now let us check how well we replicate various CURRENT_* functions -# -connection master; -delete from t2; -set timestamp=1000072000; -insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL); -sync_slave_with_master; -SELECT * FROM t2 ORDER BY n; - -# -# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions. -# -connection master; -delete from t2; -insert into t2 values (from_unixtime(1000000000),NULL), - (unix_timestamp('2001-09-09 03:46:40'),NULL); -SELECT * FROM t2 ORDER BY n; -sync_slave_with_master; -# We should get same result on slave as on master -SELECT * FROM t2 ORDER BY n; - -# -# Let us check that we are allowing to set global time_zone with -# replication -# -connection master; -set global time_zone='MET'; - -# -# Let us see if CONVERT_TZ(@@time_zone) replicates -# -delete from t2; -set time_zone='UTC'; -insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL); -insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL); -SELECT * FROM t2 ORDER BY n; -sync_slave_with_master; -SELECT * FROM t2 ORDER BY n; - -# Clean up -connection master; -drop table t1, t2; -sync_slave_with_master; - - -# Restore original timezone -connection master; -set global time_zone= @my_time_zone; - ---echo End of 4.1 tests - -# -# Bug #29536: timestamp inconsistent in replication around 1970 -# -connection master; - -CREATE TABLE t1 (a INT, b TIMESTAMP); -INSERT INTO t1 VALUES (1, NOW()); - -SET @@session.time_zone='Japan'; -UPDATE t1 SET b= '1970-01-01 08:59:59' WHERE a= 1; -SELECT * FROM t1 ORDER BY a; - -sync_slave_with_master; -SET @@session.time_zone='Japan'; -# must procdure the same result as the SELECT on the master -SELECT * FROM t1 ORDER BY a; - -SET @@session.time_zone = default; -connection master; -DROP TABLE t1; -SET @@session.time_zone = default; ---sync_slave_with_master ---source include/stop_slave.inc - -# Bug#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging -# To test that time_zone is correctly binloging for 'insert delayed' statement -# Insert 2 values into timestamp col with different time_zone. Check result. - ---connection master -reset master; -CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL); - -SET @@session.time_zone='+01:00'; -insert into t1 values('2008-12-23 19:39:39',1); - ---connection master1 -SET @@session.time_zone='+02:00'; -insert delayed into t1 values ('2008-12-23 19:39:39',2); - -# wait for the delayed insert to be executed -let $wait_condition= SELECT date FROM t1 WHERE a=2; ---source include/wait_condition.inc - -flush table t1; -flush logs; -select * from t1; -DROP TABLE t1; - -let $MYSQLD_DATADIR= `select @@datadir;`; ---exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL ---connection master1 -select * from t1 order by a; -DROP TABLE t1; -SET @@session.time_zone = default; - ---let $rpl_only_running_threads= 1 ---source include/rpl_end.inc - ---echo End of 5.0 tests |