Debian Codegraph @

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

raw
1 ############## mysql-test\t\expire_logs_days_basic.test ###############
2 # #
3 # Variable Name: expire_logs_days #
4 # Scope: GLOBAL #
5 # Access Type: Dynamic #
6 # Data Type: numeric #
7 # Default Value:30 #
8 # Range: 0-99 #
9 # #
10 # #
11 # Creation Date: 2008-02-07 #
12 # Author: Salman #
13 # #
14 # Description: Test Cases of Dynamic System Variable expire_logs_days and #
15 # that checks the behavior of this variable in the following ways#
16 # * Default Value #
17 # * Valid & Invalid values #
18 # * Scope & Access method #
19 # * Data Integrity #
20 # #
21 # Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22 # server-system-variables.html #
23 # #
24 ###############################################################################
25
26 --source include/load_sysvars.inc
27
28 ########################################################################
29 # START OF expire_logs_days TESTS #
30 ########################################################################
31
32
33 ########################################################################
34 # Saving initial value of expire_logs_days in a temporary variable #
35 ########################################################################
36
37 SET @start_value = @@global.expire_logs_days;
38 SELECT @start_value;
39 SET @start_value_sec = @@global.binlog_expire_logs_seconds;
40 SELECT @start_value_sec;
41 # Set binlog_expire_logs_seconds to 0 in order to test expire_logs_days
42 # or we will get error while setting expire_logs_days
43 SET @@global.binlog_expire_logs_seconds = 0;
44
45
46 --echo '#--------------------FN_DYNVARS_029_01------------------------#'
47 ########################################################################
48 # Display the DEFAULT value of expire_logs_days #
49 ########################################################################
50
51 SET @@global.expire_logs_days = 99;
52 SET @@global.expire_logs_days = DEFAULT;
53 SELECT @@global.expire_logs_days;
54
55
56 --echo '#---------------------FN_DYNVARS_029_02-------------------------#'
57 ###############################################
58 # Verify default value of variable #
59 ###############################################
60
61 SET @@global.expire_logs_days = @start_value;
62 SELECT @@global.expire_logs_days = 0;
63
64 --echo '#--------------------FN_DYNVARS_029_03_01------------------------#'
65 ########################################################################
66 # Change the value of expire_logs_days to a valid value #
67 ########################################################################
68
69 SET @@global.expire_logs_days = 0;
70 SELECT @@global.expire_logs_days;
71 SET @@global.expire_logs_days = 99;
72 SELECT @@global.expire_logs_days;
73 SET @@global.expire_logs_days = 10;
74 SELECT @@global.expire_logs_days;
75 SET @@global.expire_logs_days = 21;
76 SELECT @@global.expire_logs_days;
77
78
79 --echo '#--------------------FN_DYNVARS_029_04_01-------------------------#'
80 ###########################################################################
81 # Change the value of expire_logs_days to invalid value #
82 ###########################################################################
83
84 SET @@global.expire_logs_days = -1;
85 SELECT @@global.expire_logs_days;
86 SET @@global.expire_logs_days = 100;
87 SELECT @@global.expire_logs_days;
88 SET @@global.expire_logs_days = 1024;
89 SELECT @@global.expire_logs_days;
90 --Error ER_WRONG_TYPE_FOR_VAR
91 SET @@global.expire_logs_days = 10000.01;
92 SELECT @@global.expire_logs_days;
93 SET @@global.expire_logs_days = -1024;
94 SELECT @@global.expire_logs_days;
95 SET @@global.expire_logs_days = 42949672950;
96 SELECT @@global.expire_logs_days;
97
98 --Error ER_WRONG_TYPE_FOR_VAR
99 SET @@global.expire_logs_days = ON;
100 SELECT @@global.expire_logs_days;
101 --Error ER_WRONG_TYPE_FOR_VAR
102 SET @@global.expire_logs_days = 'test';
103 SELECT @@global.expire_logs_days;
104
105
106 --echo '#-------------------FN_DYNVARS_029_05_01----------------------------#'
107 ###########################################################################
108 # Test if accessing session expire_logs_days gives error #
109 ###########################################################################
110
111 --Error ER_GLOBAL_VARIABLE
112 SET @@session.expire_logs_days = 0;
113 SELECT @@expire_logs_days;
114
115
116 --echo '#----------------------FN_DYNVARS_029_06_01------------------------#'
117 ##############################################################################
118 # Check if the value in GLOBAL & SESSION Tables matches values in variable #
119 ##############################################################################
120
121 --disable_warnings
122 SELECT @@global.expire_logs_days = VARIABLE_VALUE
123 FROM performance_schema.global_variables
124 WHERE VARIABLE_NAME='expire_logs_days';
125
126 SELECT @@expire_logs_days = VARIABLE_VALUE
127 FROM performance_schema.session_variables
128 WHERE VARIABLE_NAME='expire_logs_days';
129 --enable_warnings
130
131
132 --echo '#---------------------FN_DYNVARS_029_07_01----------------------#'
133 ###################################################################
134 # Check if TRUE and FALSE values can be used on variable #
135 ###################################################################
136
137 SET @@global.expire_logs_days = TRUE;
138 SELECT @@global.expire_logs_days;
139 SET @@global.expire_logs_days = FALSE;
140 SELECT @@global.expire_logs_days;
141
142
143 --echo '#---------------------FN_DYNVARS_029_08_01----------------------#'
144 ########################################################################################################
145 # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
146 ########################################################################################################
147
148 SET @@global.expire_logs_days = 1;
149 SELECT @@expire_logs_days = @@global.expire_logs_days;
150
151
152 --echo '#---------------------FN_DYNVARS_029_09_01----------------------#'
153 ##########################################################################
154 # Check if expire_logs_days can be accessed with and without @@ sign #
155 ##########################################################################
156
157 --Error ER_GLOBAL_VARIABLE
158 SET expire_logs_days = 1;
159 SELECT @@expire_logs_days;
160 --Error ER_PARSE_ERROR
161 SET local.expire_logs_days = 1;
162 --Error ER_UNKNOWN_TABLE
163 SELECT local.expire_logs_days;
164 --Error ER_PARSE_ERROR
165 SET global.expire_logs_days = 1;
166 --Error ER_UNKNOWN_TABLE
167 SELECT global.expire_logs_days;
168 --Error ER_BAD_FIELD_ERROR
169 SELECT expire_logs_days;
170 --Error ER_INCORRECT_GLOBAL_LOCAL_VAR
171 SELECT @@session.expire_logs_days;
172
173 ########################################################################
174 # END OF expire_logs_days TESTS #
175 ########################################################################
176
177 ##############################
178 # Restore initial value #
179 ##############################
180
181 SET @@global.expire_logs_days = @start_value;
182 SELECT @@global.expire_logs_days;
183
184 SET @@global.binlog_expire_logs_seconds = @start_value_sec;
185 SELECT @@global.binlog_expire_logs_seconds;