|
| 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 binary log name. |
| 14 | +--let $first_binlog = query_get_value($stmt_show_binary_log_status, File, 1) |
| 15 | + |
| 16 | +# identifying backend storage type ('file' or 's3') |
| 17 | +--source ../include/identify_storage_backend.inc |
| 18 | + |
| 19 | +# creating data directory, configuration file, etc. |
| 20 | +--let $binsrv_connect_timeout = 20 |
| 21 | +--let $binsrv_read_timeout = 60 |
| 22 | +--let $binsrv_idle_time = 10 |
| 23 | +--let $binsrv_verify_checksum = TRUE |
| 24 | +--let $binsrv_replication_mode = gtid |
| 25 | +--let $binsrv_checkpoint_size = 1 |
| 26 | +--source ../include/set_up_binsrv_environment.inc |
| 27 | + |
| 28 | +--let $read_from_file = $MYSQL_TMP_DIR/search_result.json |
| 29 | + |
| 30 | +--echo |
| 31 | +--echo *** Creating a simple table. |
| 32 | +CREATE TABLE t1(id INT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)) ENGINE=InnoDB; |
| 33 | + |
| 34 | +--echo |
| 35 | +--echo *** Filling the table with some data. |
| 36 | +INSERT INTO t1 VALUES(); |
| 37 | + |
| 38 | +--echo |
| 39 | +--echo *** Flushing the first binary log and switching to the second one. |
| 40 | +FLUSH BINARY LOGS; |
| 41 | + |
| 42 | +--echo |
| 43 | +--echo *** Determining the second binary log name. |
| 44 | +--let $second_binlog = query_get_value($stmt_show_binary_log_status, File, 1) |
| 45 | + |
| 46 | +--echo |
| 47 | +--echo *** Filling the table with more data. |
| 48 | +INSERT INTO t1 VALUES(); |
| 49 | + |
| 50 | +--echo |
| 51 | +--echo *** Filling the table with more data. |
| 52 | +--replace_result $second_binlog <second_binlog> |
| 53 | +eval PURGE BINARY LOGS TO '$second_binlog'; |
| 54 | + |
| 55 | +--let $captured_gtid_purged = `SELECT @@global.gtid_purged` |
| 56 | +--let $captured_second_insert_gtid = `SELECT GTID_SUBTRACT(@@global.gtid_executed, @@global.gtid_purged)` |
| 57 | + |
| 58 | +--echo |
| 59 | +--echo *** Executing the Binlog Server utility and fetching all events. |
| 60 | +--exec $BINSRV fetch $binsrv_config_file_path > /dev/null |
| 61 | + |
| 62 | +--echo |
| 63 | +--echo *** Executing the Binlog Server utility in the 'search_by_gtid_set' |
| 64 | +--exec $BINSRV search_by_gtid_set $binsrv_config_file_path $captured_second_insert_gtid > $read_from_file |
| 65 | + |
| 66 | +--source include/read_file_to_var.inc |
| 67 | +--assert(`SELECT JSON_EXTRACT('$result', '$.status') = 'success'`) |
| 68 | +--assert(`SELECT JSON_LENGTH(JSON_EXTRACT('$result', '$.result')) = 1`) |
| 69 | +--assert(`SELECT JSON_EXTRACT('$result', '$.result[0].name') = '$second_binlog'`) |
| 70 | +--assert(`SELECT JSON_EXTRACT('$result', '$.result[0].previous_gtids') = '$captured_gtid_purged'`) |
| 71 | +--assert(`SELECT JSON_EXTRACT('$result', '$.result[0].added_gtids') = '$captured_second_insert_gtid'`) |
| 72 | + |
| 73 | +--echo |
| 74 | +--echo *** Executing the Binlog Server utility one more time (fetching nothing) |
| 75 | +--exec $BINSRV fetch $binsrv_config_file_path > /dev/null |
| 76 | + |
| 77 | +--echo |
| 78 | +--echo *** Executing the Binlog Server utility in the 'search_by_gtid_set' |
| 79 | +--echo one more time (expecting the same results) |
| 80 | +--exec $BINSRV search_by_gtid_set $binsrv_config_file_path $captured_second_insert_gtid > $read_from_file |
| 81 | + |
| 82 | +--source include/read_file_to_var.inc |
| 83 | +--assert(`SELECT JSON_EXTRACT('$result', '$.status') = 'success'`) |
| 84 | +--assert(`SELECT JSON_LENGTH(JSON_EXTRACT('$result', '$.result')) = 1`) |
| 85 | +--assert(`SELECT JSON_EXTRACT('$result', '$.result[0].name') = '$second_binlog'`) |
| 86 | +--assert(`SELECT JSON_EXTRACT('$result', '$.result[0].previous_gtids') = '$captured_gtid_purged'`) |
| 87 | +--assert(`SELECT JSON_EXTRACT('$result', '$.result[0].added_gtids') = '$captured_second_insert_gtid'`) |
| 88 | + |
| 89 | +--echo |
| 90 | +--echo *** Removing the search result file. |
| 91 | +--remove_file $read_from_file |
| 92 | + |
| 93 | +--echo |
| 94 | +--echo *** Dropping the table. |
| 95 | +DROP TABLE t1; |
| 96 | + |
| 97 | +# cleaning up |
| 98 | +--source ../include/tear_down_binsrv_environment.inc |
0 commit comments