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