Debian Codegraph @

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

raw
1 # ==== Purpose ====
2 #
3 # This test script serves as the functionality testing for the table
4 # performance_schema.replication_applier_status. Test for ddl and dml
5 # operations is a part of the perfschema suite. The ddl/dml tests are named:
6 # 1) ddl_replication_applier_status.test and
7 # 2) dml_replication_applier_status.test.
8 #
9 # The follwing scenarios are tested in this script:
10 #
11 # - Verify that output is same as SSS on a fresh slave.
12 # - Verify that the value of this field is correct after STOP SLAVE.
13 # - Remaining delay is not tested.
14 # - Count_trnsaction is partially tested here making sure it can be queried.
15 # More testing in rpl/include/rpl_deadlock.test
16 #
17 # ==== Related Worklog ====
18 #
19 # MDEV-16437: merge 5.7 P_S replication instrumentation and tables
20 #
21
22 source include/have_perfschema.inc;
23 source include/have_binlog_format_mixed.inc;
24 source include/master-slave.inc;
25
26 let $assert_text= On master, the table should return an empty set.;
27 let $assert_cond= count(*) = 0 from performance_schema.replication_applier_status;
28 source include/assert.inc;
29
30 --connection slave
31
32 --echo
33 --echo # Verify that SELECT works and produces an output similar to
34 --echo # the corresponding field in SHOW SLAVE STATUS(SSS) in all scenarios.
35 --echo
36
37 --echo
38 --echo # Verify that output is same as SSS on a fresh slave.
39 --echo
40
41 let $sss_value= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
42 let $ps_value= query_get_value(select Service_State from performance_schema.replication_applier_status, Service_State, 1);
43 let $assert_text= SSS shows Slave_SQL_Running as "Yes". So, Service_State from this PS table should be "ON".;
44 let $assert_cond= "$sss_value" = "Yes" AND "$ps_value"= "ON";
45 source include/assert.inc;
46
47 let $ss_value= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
48 let $ps_value= query_get_value(select count_transactions_retries from performance_schema.replication_applier_status, count_transactions_retries, 1);
49 let $assert_text= COUNT_TRANSACTION_RETRIES should be equal to Slave_retried_transactions.;
50 let $assert_cond= "$ps_value"= "$ss_value";
51 source include/assert.inc;
52
53 --echo
54 --echo # Verify that the fields show the correct values after STOP SLAVE.
55 --echo
56
57 source include/stop_slave.inc;
58
59 let $sss_value= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
60 let $ps_value= query_get_value(select Service_State from performance_schema.replication_applier_status, Service_State, 1);
61 let $assert_text= SSS shows Slave_SQL_Running as "No". So, Service_State from this PS table should be "OFF".;
62 let $assert_cond= "$sss_value" = "No" AND "$ps_value"= "OFF";
63 source include/assert.inc;
64
65 let $ss_value= query_get_value(SHOW STATUS LIKE 'Slave_retried_transactions', Value, 1);
66 let $ps_value= query_get_value(select count_transactions_retries from performance_schema.replication_applier_status, count_transactions_retries, 1);
67 let $assert_text= COUNT_TRANSACTION_RETRIES should be equal to Slave_retried_transactions.;
68 let $assert_cond= "$ps_value"= "$ss_value";
69 source include/assert.inc;
70
71 source include/start_slave.inc;
72 source include/rpl_end.inc;
73