Debian Codegraph @

mysql-test/suite/group_replication/t/gr_consistent_statement_hold_show.test

raw
1 ################################################################################
2 # Validate that SHOW statements which output does depend on data consistency
3 # go through the `trans_begin` hook on Group Replication on server1.
4 #
5 # Test:
6 # 0. The test requires one group member: M1.
7 # 1. Bootstrap group on server1.
8 # 2. Validate that a given SHOW statement goes through the
9 # `trans_begin` hook on Group Replication on server1.
10 # 3. Clean up.
11 ################################################################################
12 --source include/have_debug_sync.inc
13 --source include/have_group_replication_plugin.inc
14 --let $rpl_group_replication_single_primary_mode=1
15 --let $rpl_skip_group_replication_start= 1
16 --source include/group_replication.inc
17
18
19 --echo
20 --echo ############################################################
21 --echo # 1. Bootstrap group on server1.
22 --let $rpl_connection_name= server1
23 --source include/rpl_connection.inc
24 --source include/start_and_bootstrap_group_replication.inc
25
26 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
27 CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY);
28
29 USE test;
30 delimiter $$;
31 CREATE PROCEDURE procedure1()
32 BEGIN
33 end$$
34 delimiter ;$$
35
36 CREATE FUNCTION function1() RETURNS INT RETURN (SELECT COUNT(*) FROM t1);
37
38 delimiter $$;
39 CREATE EVENT event1
40 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND
41 ON COMPLETION PRESERVE
42 DISABLE
43 DO
44 BEGIN
45 END$$
46 delimiter ;$$
47
48 DELIMITER |;
49 CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
50 BEGIN
51 INSERT INTO t2 VALUES (NEW.c1);
52 END|
53 DELIMITER ;|
54
55
56 --echo
57 --echo ############################################################
58 --echo # 2. Validate that a given SHOW statement goes through the
59 --echo # `trans_begin` hook on Group Replication on server1.
60 --let $statement_to_hold= SHOW DATABASES
61 --source ../include/gr_consistent_statement_hold.inc
62
63 --let $statement_to_hold= SHOW TABLES
64 --source ../include/gr_consistent_statement_hold.inc
65
66 --let $statement_to_hold= SHOW INDEX FROM t1
67 --source ../include/gr_consistent_statement_hold.inc
68
69 --let $statement_to_hold= SHOW KEYS FROM t1
70 --source ../include/gr_consistent_statement_hold.inc
71
72 --let $statement_to_hold= SHOW GRANTS FOR CURRENT_USER()
73 --source ../include/gr_consistent_statement_hold.inc
74
75 --let $statement_to_hold= SHOW CREATE DATABASE test
76 --source ../include/gr_consistent_statement_hold.inc
77
78 --let $statement_to_hold= SHOW TABLE STATUS FROM test
79 --source ../include/gr_consistent_statement_hold.inc
80
81 --let $statement_to_hold= SHOW TRIGGERS FROM test
82 --source ../include/gr_consistent_statement_hold.inc
83
84 --let $statement_to_hold= SHOW CREATE PROCEDURE test.procedure1
85 --source ../include/gr_consistent_statement_hold.inc
86
87 --let $statement_to_hold= SHOW CREATE FUNCTION test.function1
88 --source ../include/gr_consistent_statement_hold.inc
89
90 --let $statement_to_hold= SHOW PROCEDURE CODE test.procedure1
91 --source ../include/gr_consistent_statement_hold.inc
92
93 --let $statement_to_hold= SHOW FUNCTION CODE test.function1
94 --source ../include/gr_consistent_statement_hold.inc
95
96 --let $statement_to_hold= SHOW CREATE EVENT test.event1
97 --source ../include/gr_consistent_statement_hold.inc
98
99 --let $statement_to_hold= SHOW CREATE TRIGGER test.trigger1
100 --source ../include/gr_consistent_statement_hold.inc
101
102 --let $statement_to_hold= SHOW CREATE USER CURRENT_USER()
103 --source ../include/gr_consistent_statement_hold.inc
104
105
106 --echo
107 --echo ############################################################
108 --echo # 3. Clean up.
109 --let $rpl_connection_name= server1
110 --source include/rpl_connection.inc
111 DROP PROCEDURE procedure1;
112 DROP FUNCTION function1;
113 DROP EVENT event1;
114 DROP TRIGGER trigger1;
115 DROP TABLE t2;
116 DROP TABLE t1;
117
118 --source include/group_replication_end.inc