| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This test checks that: |
| 4 |
# Channels with GTID_ONLY always use the parallel applier |
| 5 |
# Channels with GTID_ONLY reset worker info on replica start |
| 6 |
# |
| 7 |
# ==== Requirements ==== |
| 8 |
# |
| 9 |
# R1: A channel configured with GTID_ONLY always has at least |
| 10 |
# one applier worker |
| 11 |
# |
| 12 |
# ==== Implementation ==== |
| 13 |
# |
| 14 |
# 1. Configure the channel with GTID_ONLY = 1 |
| 15 |
# Add some data to populate repository tables |
| 16 |
# 2. Restart the replica. |
| 17 |
# Check there is no worker info as it was purged after start |
| 18 |
# 3. Set the number of applier workers to 0 |
| 19 |
# Check the channel still has one worker. |
| 20 |
# 4. Disable GTID_ONLY |
| 21 |
# Check the channel has no workers. |
| 22 |
# 5. Cleanup |
| 23 |
# |
| 24 |
# ==== References ==== |
| 25 |
# |
| 26 |
# WL#7491: GTID-based replication applier recovery and positioning |
| 27 |
# |
| 28 |
|
| 29 |
--source include/have_slave_repository_type_table.inc |
| 30 |
--source include/have_binlog_format_row.inc |
| 31 |
--let $rpl_skip_start_slave= 1 |
| 32 |
--source include/master-slave.inc |
| 33 |
|
| 34 |
--echo |
| 35 |
--echo ############################################################ |
| 36 |
--echo # 1. Configure the channel with GTID_ONLY = 1 |
| 37 |
--echo # Add some data to populate repository tables |
| 38 |
|
| 39 |
--source include/rpl_connection_slave.inc |
| 40 |
|
| 41 |
CHANGE REPLICATION SOURCE TO REQUIRE_ROW_FORMAT = 1, GTID_ONLY = 1; |
| 42 |
|
| 43 |
--source include/start_slave.inc |
| 44 |
|
| 45 |
--source include/rpl_connection_master.inc |
| 46 |
|
| 47 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 48 |
INSERT INTO t1 VALUES(1); |
| 49 |
|
| 50 |
--source include/sync_slave_sql_with_master.inc |
| 51 |
|
| 52 |
--echo |
| 53 |
--echo ############################################################ |
| 54 |
--echo # 2. Restart the replica. |
| 55 |
--echo # Check there is no worker info as it was purged after start |
| 56 |
|
| 57 |
--let $rpl_server_number= 2 |
| 58 |
--let $rpl_server_parameters=--skip_replica_start=1 |
| 59 |
--source include/rpl_restart_server.inc |
| 60 |
|
| 61 |
--let $assert_text= No info exists in the repository table |
| 62 |
--let $assert_cond= `SELECT COUNT(*) = 0 FROM mysql.slave_worker_info` |
| 63 |
--source include/assert.inc |
| 64 |
|
| 65 |
--echo |
| 66 |
--echo ############################################################ |
| 67 |
--echo # 3. Set the number of applier workers to 0 |
| 68 |
--echo # Check the channel still has one worker. |
| 69 |
|
| 70 |
--let $saved_replica_parallel_workers = `SELECT @@GLOBAL.replica_parallel_workers` |
| 71 |
SET @@GLOBAL.replica_parallel_workers = 0; |
| 72 |
|
| 73 |
--source include/start_slave.inc |
| 74 |
|
| 75 |
--let $assert_text= There is one worker runnning with id 1 |
| 76 |
--let $assert_cond= `SELECT COUNT(*) = 1 FROM performance_schema.replication_applier_status_by_worker WHERE worker_id=1` |
| 77 |
--source include/assert.inc |
| 78 |
|
| 79 |
--echo |
| 80 |
--echo ############################################################ |
| 81 |
--echo # 4. Disable GTID_ONLY |
| 82 |
--echo # Check the channel has no workers. |
| 83 |
|
| 84 |
--source include/stop_slave.inc |
| 85 |
|
| 86 |
CHANGE REPLICATION SOURCE TO GTID_ONLY = 0; |
| 87 |
|
| 88 |
--source include/start_slave.inc |
| 89 |
|
| 90 |
--let $assert_text= There is no worker with an ID |
| 91 |
--let $assert_cond= `SELECT COUNT(*) = 0 FROM performance_schema.replication_applier_status_by_worker WHERE worker_id=1` |
| 92 |
--source include/assert.inc |
| 93 |
|
| 94 |
--echo |
| 95 |
--echo ############################################################ |
| 96 |
--echo # 5. Cleanup |
| 97 |
|
| 98 |
--source include/rpl_connection_master.inc |
| 99 |
|
| 100 |
DROP TABLE t1; |
| 101 |
|
| 102 |
--source include/sync_slave_sql_with_master.inc |
| 103 |
|
| 104 |
--disable_warnings |
| 105 |
--replace_result $saved_replica_parallel_workers NUMBER_OF_WORKERS |
| 106 |
--eval SET @@GLOBAL.replica_parallel_workers = $saved_replica_parallel_workers |
| 107 |
--enable_warnings |
| 108 |
|
| 109 |
--source include/rpl_end.inc |