|
| 1 | +--source ../include/have_binsrv.inc |
| 2 | + |
| 3 | +--source ../include/v80_v84_compatibility_defines.inc |
| 4 | + |
| 5 | +# in case of --repeat=N, we need to start from a fresh binary log to make |
| 6 | +# this test deterministic |
| 7 | +--echo *** Resetting replication at the very beginning of the test. |
| 8 | +--disable_query_log |
| 9 | +eval $stmt_reset_binary_logs_and_gtids; |
| 10 | +--enable_query_log |
| 11 | + |
| 12 | +--echo |
| 13 | +--echo *** Determining the first fresh binary log name. |
| 14 | +--let $first_binlog = query_get_value($stmt_show_binary_log_status, File, 1) |
| 15 | + |
| 16 | +--echo |
| 17 | +--echo *** Creating a simple table and filling it with some data. |
| 18 | +CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE=InnoDB; |
| 19 | +INSERT INTO t1 VALUES(DEFAULT); |
| 20 | + |
| 21 | +--echo |
| 22 | +--echo *** Restarting the server gracefully |
| 23 | +--source include/restart_mysqld.inc |
| 24 | + |
| 25 | +--echo |
| 26 | +--echo *** Determining the second binary log name after restart |
| 27 | +--let $second_binlog = query_get_value($stmt_show_binary_log_status, File, 1) |
| 28 | + |
| 29 | +--echo |
| 30 | +--echo *** Filling the table with some more data. |
| 31 | +INSERT INTO t1 VALUES(DEFAULT); |
| 32 | + |
| 33 | +--echo |
| 34 | +--echo *** Killing and restarting the server |
| 35 | +--source include/kill_and_restart_mysqld.inc |
| 36 | + |
| 37 | +--echo |
| 38 | +--echo *** Determining the third binary log name after killing and restarting |
| 39 | +--let $third_binlog = query_get_value($stmt_show_binary_log_status, File, 1) |
| 40 | + |
| 41 | +--echo |
| 42 | +--echo *** Filling the table with some more data. |
| 43 | +INSERT INTO t1 VALUES(DEFAULT); |
| 44 | + |
| 45 | +--echo |
| 46 | +--echo *** Flushing the third binary log and switching to the fourth one. |
| 47 | +FLUSH BINARY LOGS; |
| 48 | + |
| 49 | +--echo |
| 50 | +--echo *** Determining the fourth binary log name after binlog rotation |
| 51 | +--let $fourth_binlog = query_get_value($stmt_show_binary_log_status, File, 1) |
| 52 | + |
| 53 | +--echo |
| 54 | +--echo *** Filling the table with some more data. |
| 55 | +INSERT INTO t1 VALUES(DEFAULT); |
| 56 | + |
| 57 | +--echo |
| 58 | +--echo *** Checking if the first binlog file ends with the STOP event. |
| 59 | +# SHOW BINLOG EVENTS IN 'binlog.000001'; |
| 60 | +# Log_name Pos Event_type Server_id End_log_pos Info |
| 61 | +# binlog.000001 4 Format_desc 1 126 Server ver: 8.0.43-34, Binlog ver: 4 |
| 62 | +# binlog.000001 126 Previous_gtids 1 157 |
| 63 | +# binlog.000001 157 Anonymous_Gtid 1 236 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| 64 | +# binlog.000001 236 Query 1 411 use `test`; CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE=InnoDB /* xid=6 */ |
| 65 | +# binlog.000001 411 Anonymous_Gtid 1 490 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| 66 | +# binlog.000001 490 Query 1 565 BEGIN |
| 67 | +# binlog.000001 565 Table_map 1 613 table_id: 125 (test.t1) |
| 68 | +# binlog.000001 613 Write_rows 1 653 table_id: 125 flags: STMT_END_F |
| 69 | +# binlog.000001 653 Xid 1 684 COMMIT /* xid=7 */ |
| 70 | +# binlog.000001 684 Stop 1 707 |
| 71 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$first_binlog', Event_type, 10) |
| 72 | +--assert($extracted_event_type == "Stop") |
| 73 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$first_binlog', Event_type, 11) |
| 74 | +--assert($extracted_event_type == "No such row") |
| 75 | + |
| 76 | +--echo |
| 77 | +--echo *** Checking if the second binlog file ends with neither stop, nor ROTATE event (XID in this case). |
| 78 | +# SHOW BINLOG EVENTS IN 'binlog.000002'; |
| 79 | +# Log_name Pos Event_type Server_id End_log_pos Info |
| 80 | +# binlog.000002 4 Format_desc 1 126 Server ver: 8.0.43-34, Binlog ver: 4 |
| 81 | +# binlog.000002 126 Previous_gtids 1 157 |
| 82 | +# binlog.000002 157 Anonymous_Gtid 1 236 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| 83 | +# binlog.000002 236 Query 1 311 BEGIN |
| 84 | +# binlog.000002 311 Table_map 1 359 table_id: 89 (test.t1) |
| 85 | +# binlog.000002 359 Write_rows 1 399 table_id: 89 flags: STMT_END_F |
| 86 | +# binlog.000002 399 Xid 1 430 COMMIT /* xid=9 */ |
| 87 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$second_binlog', Event_type, 7) |
| 88 | +--assert($extracted_event_type == "Xid") |
| 89 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$second_binlog', Event_type, 8) |
| 90 | +--assert($extracted_event_type == "No such row") |
| 91 | + |
| 92 | +--echo |
| 93 | +--echo *** Checking if the third binlog file ends with the ROTATE event. |
| 94 | +# SHOW BINLOG EVENTS IN 'binlog.000003'; |
| 95 | +# Log_name Pos Event_type Server_id End_log_pos Info |
| 96 | +# binlog.000003 4 Format_desc 1 126 Server ver: 8.0.43-34, Binlog ver: 4 |
| 97 | +# binlog.000003 126 Previous_gtids 1 157 |
| 98 | +# binlog.000003 157 Anonymous_Gtid 1 236 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| 99 | +# binlog.000003 236 Query 1 311 BEGIN |
| 100 | +# binlog.000003 311 Table_map 1 359 table_id: 89 (test.t1) |
| 101 | +# binlog.000003 359 Write_rows 1 399 table_id: 89 flags: STMT_END_F |
| 102 | +# binlog.000003 399 Xid 1 430 COMMIT /* xid=9 */ |
| 103 | +# binlog.000003 430 Rotate 1 474 binlog.000004;pos=4 |
| 104 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$third_binlog', Event_type, 8) |
| 105 | +--assert($extracted_event_type == "Rotate") |
| 106 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$third_binlog', Event_type, 9) |
| 107 | +--assert($extracted_event_type == "No such row") |
| 108 | + |
| 109 | +--echo |
| 110 | +--echo *** Checking if the fourth (still open) binlog file ends with the commit of a transaction (XID). |
| 111 | +# SHOW BINLOG EVENTS IN 'binlog.000004'; |
| 112 | +# Log_name Pos Event_type Server_id End_log_pos Info |
| 113 | +# binlog.000004 4 Format_desc 1 126 Server ver: 8.0.43-34, Binlog ver: 4 |
| 114 | +# binlog.000004 126 Previous_gtids 1 157 |
| 115 | +# binlog.000004 157 Anonymous_Gtid 1 236 SET @@SESSION.GTID_NEXT= 'ANONYMOUS' |
| 116 | +# binlog.000004 236 Query 1 311 BEGIN |
| 117 | +# binlog.000004 311 Table_map 1 359 table_id: 89 (test.t1) |
| 118 | +# binlog.000004 359 Write_rows 1 399 table_id: 89 flags: STMT_END_F |
| 119 | +# binlog.000004 399 Xid 1 430 COMMIT /* xid=12 */ |
| 120 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$fourth_binlog', Event_type, 7) |
| 121 | +--assert($extracted_event_type == "Xid") |
| 122 | +--let $extracted_event_type = query_get_value(SHOW BINLOG EVENTS IN '$fourth_binlog', Event_type, 8) |
| 123 | +--assert($extracted_event_type == "No such row") |
| 124 | + |
| 125 | +# identifying backend storage type ('file' or 's3') |
| 126 | +--source ../include/identify_storage_backend.inc |
| 127 | + |
| 128 | +# creating data directory, configuration file, etc. |
| 129 | +--let $binsrv_connect_timeout = 20 |
| 130 | +--let $binsrv_read_timeout = 60 |
| 131 | +--let $binsrv_idle_time = 10 |
| 132 | +--let $binsrv_verify_checksum = TRUE |
| 133 | +--source ../include/set_up_binsrv_environment.inc |
| 134 | + |
| 135 | +--echo |
| 136 | +--echo *** Executing the Binlog Server utility to download all binlog data |
| 137 | +--echo *** from the server to the <BINSRV_STORAGE_PATH> directory |
| 138 | +--exec $BINSRV fetch $binsrv_config_file_path > /dev/null |
| 139 | + |
| 140 | +--echo |
| 141 | +--echo *** Dropping the table. |
| 142 | +DROP TABLE t1; |
| 143 | + |
| 144 | +# cleaning up |
| 145 | +--source ../include/tear_down_binsrv_environment.inc |
0 commit comments