Debian Codegraph @

mysql-test/suite/rpl/t/rpl_ps_status_by_worker_index.test

raw
1 # ==== Implementation ====
2 #
3 # This test will create a workload and will block the table to be written
4 # on the slave to force the SQL thread or slave worker to wait.
5 #
6 # Then, this test case will query P_S tables to ensure that a slave worker
7 # thread if MTS is enabled, or the SQL thread for STS that is considered a
8 # worker too, is waiting.
9 #
10 # ==== Related Bug ====
11 #
12 # BUG#25444610 REPLICATION_APPLIER_STATUS_BY_WORKER USES COORD THREAD_ID AS
13 # INDEX WITH MTS
14 #
15
16 # This test case is binary log format agnostic
17 --source include/have_binlog_format_row.inc
18 --source include/master-slave.inc
19
20 # Create the table, sync slave and lock the table on the slave
21 CREATE TABLE t1 (c1 INT PRIMARY KEY);
22 --source include/sync_slave_sql_with_master.inc
23 LOCK TABLES t1 READ, performance_schema.threads READ;
24
25 --source include/rpl_connection_master.inc
26 INSERT INTO t1 (c1) VALUES (1);
27 --source include/sync_slave_io_with_master.inc
28
29 --echo # check that a worker thread is waiting using the thread id
30 --echo # given as index by the table replication_applier_status_by_worker
31 let $wait_condition=
32 SELECT COUNT(*) = 1
33 FROM performance_schema.threads
34 WHERE THREAD_ID IN
35 (SELECT THREAD_ID
36 FROM performance_schema.replication_applier_status_by_worker)
37 AND PROCESSLIST_STATE = "Waiting for table metadata lock";
38 --source include/wait_condition_or_abort.inc
39
40 UNLOCK TABLES;
41
42 --echo # check that the number of workers in the replication p_s table matches
43 --echo # when their thread id from the replication p_s table is used in
44 --echo # p_s.threads table
45 --let $num_workers= query_get_value(SELECT COUNT(*) FROM performance_schema.replication_applier_status_by_worker, COUNT(*), 1)
46 let $wait_condition=
47 SELECT COUNT(*) = $num_workers
48 FROM performance_schema.threads
49 WHERE THREAD_ID IN
50 (SELECT THREAD_ID
51 FROM performance_schema.replication_applier_status_by_worker)
52 AND PROCESSLIST_STATE LIKE "%";
53 --source include/wait_condition_or_abort.inc
54
55
56 # Cleanup
57 --source include/rpl_connection_master.inc
58 DROP TABLE t1;
59 --source include/rpl_end.inc