Debian Codegraph @

mysql-test/suite/sys_vars/t/replication_sender_observe_commit_only.test

raw
1 # Variable Name: replication_sender_observe_commit_only
2 # Scope: Global
3 # Access Type: Static
4 # Data Type: boolean
5 #
6 # Creation Date: 2019-12-22
7 # Author : Pedro Figueiredo
8
9 --let $saved_global_replication_sender_observe_commit_only = `SELECT @@global.replication_sender_observe_commit_only`
10
11 ####################################################################
12 # Displaying default value #
13 ####################################################################
14
15 --let $assert_text = Default GLOBAL value is FALSE
16 --let $assert_cond = [SELECT @@global.replication_sender_observe_commit_only = 0]
17 --source include/assert.inc
18
19 ####################################################################
20 # Check if Value can set and that P_S reports the correct value #
21 ####################################################################
22
23 # 1, TRUE, ON, 0, FALSE, OFF
24 --let $j=6
25
26 while($j>0)
27 {
28 if ($j == 6)
29 {
30 --let $to_set = OFF
31 --let $expected = OFF
32 }
33 if ($j == 5)
34 {
35 --let $to_set = FALSE
36 --let $expected = OFF
37 }
38 if ($j == 4)
39 {
40 --let $to_set = 0
41 --let $expected = OFF
42 }
43 if ($j == 3)
44 {
45 --let $to_set = ON
46 --let $expected = ON
47 }
48 if ($j == 2)
49 {
50 --let $to_set = TRUE
51 --let $expected = ON
52 }
53 if ($j == 1)
54 {
55 --let $to_set = 1
56 --let $expected = ON
57 }
58
59 --let $scope = GLOBAL
60 --let $ps_table = global_variables
61
62 --eval SET @@$scope.replication_sender_observe_commit_only = $to_set
63 --let $reported=`SELECT variable_value FROM performance_schema.$ps_table WHERE variable_name = 'replication_sender_observe_commit_only'`
64
65 --let $assert_text= Reported value matches the one set (set $to_set in $scope scope)
66 --let $assert_cond = "$reported" = "$expected"
67 --source include/assert.inc
68
69 --dec $j
70 }
71
72 ####################################################################
73 # Privileges #
74 ####################################################################
75
76 CREATE USER user1;
77 --connect(conn_user1,localhost,user1,,)
78
79 # assert that one cannot change the value without privileges
80 --error ER_SPECIFIC_ACCESS_DENIED_ERROR
81 SET GLOBAL replication_sender_observe_commit_only = 1;
82
83 # assert that one can change the value if SUPER is given
84 --connection default
85 GRANT SUPER ON *.* TO user1@'%';
86 FLUSH PRIVILEGES;
87 --connect(conn2_user1,localhost,user1,,)
88 SET GLOBAL replication_sender_observe_commit_only = 1;
89
90 --connection default
91 DROP USER user1;
92
93 ####################################################################
94 # Transactional context #
95 ####################################################################
96
97 BEGIN;
98
99 # can change the variable's value in global scope while inside a transaction
100 SET GLOBAL replication_sender_observe_commit_only = ON;
101
102 ROLLBACK;
103
104 ####################################################################
105 # End of tests #
106 ####################################################################
107
108 --eval SET @@global.replication_sender_observe_commit_only = $saved_global_replication_sender_observe_commit_only