Debian Codegraph @

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

raw
1 ######### mysql-test\suite\sys_vars\t\session_track_gtids_basic.test ##########
2 # #
3 # Variable Name: session_track_gtids #
4 # Scope: Global & Session #
5 # Data Type: enumeration #
6 # Default: OFF #
7 # Accepted Values: OFF, OWN_GTID, ALL_GTIDS, DEFAULT #
8 # #
9 # #
10 # Creation Date: 2013-12-19 #
11 # Author : Luis Soares #
12 # #
13 # #
14 # Description:Test Cases of Dynamic System Variable session_track_gtids #
15 # that checks the behavior of this variable in the following ways #
16 # * Value Check #
17 # * Scope Check #
18 # #
19 ###############################################################################
20
21 # Assert that the default value is OFF.
22
23 --let $default_value_global=`SELECT @@GLOBAL.session_track_gtids`
24 --let $assert_text= Assert that the global default value is OFF.
25 --let $assert_cond= `SELECT '$default_value_global'='OFF'`
26 --source include/assert.inc
27
28 --let $default_value_session= `SELECT @@SESSION.session_track_gtids`
29 --let $assert_text= Assert that the session default value is OFF.
30 --let $assert_cond= `SELECT '$default_value_session'='OFF'`
31 --source include/assert.inc
32
33 --let $i=3
34 while ($i)
35 {
36 if ($i==3)
37 {
38 --let $val=ALL_GTIDS
39 }
40 if ($i==2)
41 {
42 --let $val=OWN_GTID
43 }
44 if ($i==1)
45 {
46 --let $val=OFF
47 }
48
49 --eval SET @@GLOBAL.session_track_gtids=$val
50 --eval SET @@SESSION.session_track_gtids=$val
51
52 # Assert that we can set the value for SESSION and GLOBAL
53
54 --let $global_value= `SELECT @@GLOBAL.session_track_gtids`
55 --let $assert_text= Assert that the global value is $val
56 --let $assert_cond= `SELECT '$global_value'='$val'`
57 --source include/assert.inc
58
59 --let $session_value= `SELECT @@SESSION.session_track_gtids`
60 --let $assert_text= Assert that the session value is $val
61 --let $assert_cond= `SELECT '$session_value'='$val'`
62 --source include/assert.inc
63
64 # Check if the value in GLOBAL Table matches value in variable
65
66 --let $is_value=`SELECT VARIABLE_VALUE FROM performance_schema.global_variables WHERE VARIABLE_NAME='session_track_gtids'`
67 --let $val= `SELECT @@GLOBAL.session_track_gtids`
68 --let $assert_text= Assert that I_S.GLOBAL_VARIABLES captures the variable value.
69 --let $assert_cond= `SELECT '$is_value'='$val'`
70 --source include/assert.inc
71
72 # Check if the value in SESSION Table matches value in variable
73
74 --let $is_value= `SELECT VARIABLE_VALUE FROM performance_schema.session_variables WHERE VARIABLE_NAME='session_track_gtids'`
75 --let $val= `SELECT @@SESSION.session_track_gtids`
76 --let $assert_text= Assert that I_S.SESSION_VARIABLES captures the variable value.
77 --let $assert_cond= `SELECT '$is_value'='$val'`
78 --source include/assert.inc
79
80 --dec $i
81 }
82
83
84 # Check that we can access the variable in its different contexts
85 # and that there is only one entry for each
86 --let $assert_text= Assert that COUNT(@@session_track_gtids)=1
87 --let $assert_cond= COUNT(@@session_track_gtids)=1
88 --source include/assert.inc
89
90 --let $assert_text= Assert that COUNT(@@local.session_track_gtids)=1
91 --let $assert_cond= COUNT(@@local.session_track_gtids)=1
92 --source include/assert.inc
93
94 --let $assert_text= Assert that COUNT(@@global.session_track_gtids)=1
95 --let $assert_cond= COUNT(@@global.session_track_gtids)=1
96 --source include/assert.inc
97
98 --let $assert_text= Assert that COUNT(@@session.session_track_gtids)=1
99 --let $assert_cond= COUNT(@@session.session_track_gtids)=1
100 --source include/assert.inc
101
102 # Check that the default is set to the correct value
103 SET @@GLOBAL.session_track_gtids=DEFAULT;
104 --let $val=`SELECT @@GLOBAL.session_track_gtids`
105 --let $assert_text= Assert that the global default value is $default_value_global
106 --let $assert_cond= `SELECT '$val'='$default_value_global'`
107 --source include/assert.inc
108
109 SET @@SESSION.session_track_gtids=DEFAULT;
110 --let $val=`SELECT @@SESSION.session_track_gtids`
111 --let $assert_text= Assert that the session default value is $default_value_session
112 --let $assert_cond= `SELECT '$val'='$default_value_session'`
113 --source include/assert.inc
114
115 # Check that session_track_gtids cannot be set inside a transaction
116 BEGIN;
117 --error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION
118 SET @@SESSION.session_track_gtids=OFF;
119 ROLLBACK;