1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
include/master-slave.inc
[connection master]
include/assert.inc [On master, the table should return an empty set.]
# Setup MTS and perform testing on a fresh slave.
connection slave;
call mtr.add_suppression("Error 'Table 'test.t' doesn't exist' on query.");
include/stop_slave.inc
set @save_slave_parallel_workers= @@global.slave_parallel_workers;
set @save_slave_transaction_retries= @@global.slave_transaction_retries;
RESET SLAVE ALL;
CHANGE MASTER 'slave1' TO MASTER_USER='root',MASTER_PORT=$MASTER_MYPORT, MASTER_HOST='127.0.0.1', MASTER_USE_GTID=slave_pos, MASTER_SSL_VERIFY_SERVER_CERT=0;
SET default_master_connection='slave1';
SET @@global.slave_parallel_workers=1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
START SLAVE 'slave1';
include/wait_for_slave_to_start.inc
include/assert.inc [Channel_name will be empty for a worker when it has not processed any transaction]
include/assert.inc [thread_name should should indicate worker thread.]
include/assert.inc [Service_State should be "ON" on a fresh slave server.]
include/assert.inc [Last_Seen_Transaction should show "" if no transaction applierd]
connection master;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/assert.inc [Channel_name must be slave1]
include/assert.inc [Last_Seen_Transaction should show 0-1-1]
include/assert.inc [Value returned by SSS and PS table for Last_Error_Number should be same.]
include/assert.inc [Value returned by SSS and PS table for Last_Error_Message should both be empty.]
include/assert.inc [Value returned by PS table for Last_Error_Timestamp should be 0000-00-00 00:00:00.]
connection master;
connection slave;
include/assert.inc [Value returned by PS table for worker_idle_time should be >= 1]
connection master;
DROP TABLE t1;
connection slave;
STOP SLAVE 'slave1';
include/wait_for_slave_to_stop.inc
RESET SLAVE ALL;
SET default_master_connection='';
CHANGE MASTER TO MASTER_USER='root', MASTER_HOST='127.0.0.1',MASTER_PORT=$MASTER_MYPORT;
include/start_slave.inc
# Introduce an error in the worker thread and check for the correctness
# of error number, message and timestamp fields.
connection master;
use test;
create table t(a int primary key);
connection slave;
drop table t;
connection master;
insert into t values(1);
connection slave;
include/wait_for_slave_sql_error.inc [errno=1146]
# Extract the error related fields from SSS and PS table and compare
# them for correctness.
include/assert.inc [Value returned by SSS and PS table for Last_Error_Number should be same.]
Last_Error_Message
Error 'Table 'test.t' doesn't exist' on query. Default database: 'test'. Query: 'insert into t values(1)'
# Verify that the error fields are preserved after STOP SLAVE.
# 1. Verify that thread_id changes to NULL and service_state to "off" on
# STOP SLAVE.
include/assert.inc [After STOP SLAVE, thread_id should be NULL]
include/assert.inc [So, Service_State after STOP SLAVE should be "OFF".]
# 2. Extract the worker_id and the error related fields from SSS and PS
# table and compare them. These fields should preserve their values.
include/assert.inc [Value returned by SSS and PS table for Last_Error_Number should be same.]
Last_Error_Message
Error 'Table 'test.t' doesn't exist' on query. Default database: 'test'. Query: 'insert into t values(1)'
include/stop_slave.inc
RESET SLAVE;
connection master;
DROP TABLE t;
RESET MASTER;
# Verify that number of rows in 'replication_applier_status_by_worker' table match with
# number of slave_parallel_workers.
connection slave;
SET @@global.slave_parallel_workers=4;
include/start_slave.inc
include/assert.inc [On slave, the table should return 4 rows.]
include/stop_slave.inc
# Cleanup.
set @@global.slave_parallel_workers= @save_slave_parallel_workers;
set @@global.slave_transaction_retries= @save_slave_transaction_retries;
include/start_slave.inc
include/rpl_end.inc
|