Debian Codegraph @

mysql-test/suite/innodb/t/innodb_page_size_func.test

raw
1 # Purpose of this test:
2 # Check that server and InnoDB behave correct and give the right messages in
3 # case it is tried to restart the server with
4 # - plain wrong
5 # - too small
6 # - unsupported between too small and too high
7 # - too high
8 # - legal but not to the size during first server startup fitting
9 # innodb page size. So every restart attempt with such a value
10 # has to fail.
11 #
12 # This test should pass with calls of mtr and the following assignments
13 # --mysqld=--innodb-page-size=4k
14 # --mysqld=--innodb-page-size=4096
15 # --mysqld=--innodb-page-size=8k
16 # --mysqld=--innodb-page-size=8192
17 # --mysqld=--innodb-page-size=16k
18 # --mysqld=--innodb-page-size=16384
19 # <no assignment of innodb-page-size at all>
20 #
21 # The current test is placed within the suite "innodb" though many tests for
22 # system variables are stored within the suite "sys_vars". The reason is the
23 # following:
24 # The test is adjusted to be used with different legal innodb page sizes
25 # assigned on command line.
26 # Our current test collections run the test suite
27 # - sys_vars without assignment of innodb-page-size
28 # - innodb with several different assignments of innodb-page-size
29 # Therefore placing this test within the suite "innodb" is better.
30 #
31 # Created: 2011-11-11 mleich
32 #
33
34 # Set this variable to
35 # - 0 for standard test runs (file with expected results is made for such).
36 # - 1 for debugging.(a result difference will show up)
37 let $test_debug= 0;
38
39 --echo # 0. Check and generate prerequites
40 #-----------------------------------------
41
42 # InnoDb page size values in 2011-11
43 # - supported: 4k, 8k, 16k
44 # - default: 16k
45 let $minimal_page_size= 4096;
46 let $default_page_size= 16384;
47 --disable_warnings
48 let $maximal_page_size= 65536;
49 let $legal_page_size_list= $minimal_page_size,8192,16384,32768,$maximal_page_size;
50 let $start_page_size=
51 `SELECT variable_value FROM performance_schema.global_status
52 WHERE LOWER(variable_name) = 'innodb_page_size'`;
53 --enable_warnings
54 if(`SELECT $start_page_size NOT IN ($legal_page_size_list)`)
55 {
56 --echo # ERROR: The current innodb page size ($start_page_size) is not in
57 --echo # the list of expected legal page sizes : $legal_page_size_list
58 --echo # abort
59 exit;
60 }
61 let $other_page_size= $minimal_page_size;
62 if($start_page_size == $minimal_page_size)
63 {
64 let $other_page_size= $maximal_page_size;
65 }
66 let $other_page_size_k= `SELECT $other_page_size DIV 1024`;
67 let $other_page_size_nk= `SELECT CONCAT($other_page_size_k,'k')`;
68 let $other_page_size_nkaramel= `SELECT CONCAT($other_page_size_k,'karamel')`;
69 let $other_page_size_ncaramel= `SELECT CONCAT($other_page_size_k,'caramel')`;
70 if ($start_page_size < $maximal_page_size)
71 {
72 let $out_range_page_size= `SELECT $maximal_page_size * 4`;
73 let $adjust_page_size = $maximal_page_size;
74 }
75 if ($start_page_size > $minimal_page_size)
76 {
77 let $out_range_page_size= `SELECT $minimal_page_size DIV 2`;
78 let $adjust_page_size = $minimal_page_size;
79 }
80 let $illegal_pagesize= `SELECT $minimal_page_size + 1`;
81 let $zero_test= 1;
82 if ($start_page_size == $minimal_page_size)
83 {
84 let $zero_test= 0;
85 }
86 if ($test_debug)
87 {
88 --echo # --- Set in test script --------------------------
89 --echo # minimal_page_size : $minimal_page_size
90 --echo # default_page_size : $default_page_size
91 --echo # maximal_page_size : $maximal_page_size
92 --echo # legal_page_size_list : $legal_page_size_list
93 --echo # --- Calculated ---------------------------------
94 --echo # start_page_size : $start_page_size
95 --echo # other_page_size_k : $other_page_size_k
96 --echo # other_page_size_nk : $other_page_size_nk
97 --echo # other_page_size_nkaramel : $other_page_size_nkaramel
98 --echo # other_page_size_ncaramel : $other_page_size_ncaramel
99 --echo # out_range_page_size : $out_range_page_size
100 --echo # adjust_page_size : $adjust_page_size
101 --echo # illegal_pagesize : $illegal_pagesize
102 --echo # zero_test : $zero_test
103 }
104
105 # We let our server restart attempts write to the file $error_log.
106 let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err;
107 # $error_log has to be processed by include/search_pattern.inc which
108 # contains Perl code requiring that the environment variable SEARCH_FILE points
109 # to this file.
110 let SEARCH_FILE= $error_log;
111
112 --source include/shutdown_mysqld.inc
113
114 let $mysqld=$MYSQLD_CMD --core-file --console > $error_log 2>&1 --innodb-page-size;
115
116 --echo # 1. Try to restart the server with some other legal innodb page size value.
117 --echo # It must fail because we had a different value before.
118 #----------------------------------------------------------------------------------
119 --echo # 1.1 The value assigned is a number.
120 # Detailed explanations of what happens are placed nearby the checks.
121 --error 1,42
122 --exec $mysqld=$other_page_size
123 if ( $default_page_size != $other_page_size )
124 {
125 # It gets detected that the assigned page size is not the default one
126 --replace_result $default_page_size DEFAULT_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
127 let SEARCH_PATTERN= innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
128 --source include/search_pattern.inc
129 }
130 --replace_result $start_page_size START_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
131 let SEARCH_PATTERN=Data file '.*ibdata1' uses page size $start_page_size, but the innodb_page_size start-up parameter is $other_page_size;
132 --source include/search_pattern.inc
133 # The server restart aborts
134 let SEARCH_PATTERN= \[ERROR\] \[[^]]*\] \[[^]]*\] Aborting;
135 --source include/search_pattern.inc
136 --echo # 1.2 The value assigned is a number followed by 'k'.
137 --error 1,42
138 --exec $mysqld=$other_page_size_nk
139 if ( $default_page_size != $other_page_size )
140 {
141 # It gets detected that the assigned page size is not the default one
142 --replace_result $default_page_size DEFAULT_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
143 let SEARCH_PATTERN= innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
144 --source include/search_pattern.inc
145 }
146
147 --replace_result $start_page_size START_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
148 let SEARCH_PATTERN=Data file '.*ibdata1' uses page size $start_page_size, but the innodb_page_size start-up parameter is $other_page_size;
149 --source include/search_pattern.inc
150
151 # The server restart aborts
152 let SEARCH_PATTERN= \[ERROR\] \[[^]]*\] \[[^]]*\] Aborting;
153 --source include/search_pattern.inc
154
155
156 --echo # 2. Try to restart the server with some innodb page size.which is either
157 --echo # bigger than the maximum or smaller than the minimum supported one.
158 --echo # It must fail because we had a different value before.
159 #-------------------------------------------------------------------------------
160 # Properties of the value:
161 # 1. not supported
162 # 2. below the smallest supported one
163 # The restart attempt has to fail.
164 --error 1,42
165 --exec $mysqld=$out_range_page_size
166 # The innodb page size gets raised to the lowest or biggest legal value.
167 --replace_result $out_range_page_size OUT_RANGE_PAGE_SIZE $adjust_page_size ADJUST_PAGE_SIZE
168 let SEARCH_PATTERN= \[Warning\] \[[^]]*\] \[[^]]*\] option 'innodb-page-size': unsigned value $out_range_page_size adjusted to $adjust_page_size;
169 --source include/search_pattern.inc
170 if ( $default_page_size != $adjust_page_size )
171 {
172 # It gets detected that the assigned page size is not the default one
173 --replace_result $default_page_size DEFAULT_PAGE_SIZE $adjust_page_size ADJUST_PAGE_SIZE
174 let SEARCH_PATTERN= innodb-page-size has been changed from the default value $default_page_size to $adjust_page_size;
175 --source include/search_pattern.inc
176 }
177 # Some checks omitted because they are already in 1.
178
179
180 --echo # 3. Try to restart the server with the plain wrong innodb page size value "garbage".
181 --echo # The restart attempt has to
182 --echo # - fail in case start of test page size <> the minimal legal page size.
183 --echo # - to be successful in case start of test page size = minimal legal page size.
184 --echo # In this case we omit the execution of the current sub test!
185 #-------------------------------------------------------------------------------------------
186 if ($zero_test)
187 {
188 if ($test_debug)
189 {
190 --echo # We do not omit the test.
191 }
192 --error 1,42
193 --exec $mysqld=garbage
194 # General server properties cause that
195 # - the plain wrong value "garbage" assigned to innodb page size gets
196 # mangled to 0.
197 # - the 0 which is below the smallest possible page size is adjusted
198 # to the smallest possible page size
199 --replace_result $minimal_page_size MINIMAL_PAGE_SIZE
200 let SEARCH_PATTERN= \[Warning\] \[[^]]*\] \[[^]]*\] option 'innodb-page-size': unsigned value 0 adjusted to $minimal_page_size;
201 --source include/search_pattern_multiline.inc
202 # It gets detected that the innodb page size has been changed.
203 --replace_result $default_page_size DEFAULT_PAGE_SIZE $minimal_page_size MINIMAL_PAGE_SIZE
204 let SEARCH_PATTERN= innodb-page-size has been changed from the default value $default_page_size to $minimal_page_size;
205 --source include/search_pattern_multiline.inc
206 # Some checks omitted because they are already in 1.
207 }
208
209
210 --echo # 4. Try to restart the server with some illegal innodb page size value
211 --echo # being between minimum and maximum legal page size value.
212 --echo # The restart attempt has to fail.
213 #------------------------------------------------------------------------------
214 # Properties of the value:
215 # 1. not supported
216 # 2. between smallest (4k) and biggest (16k) supported one
217 # InnoDB aborts, so ASAN may report leaks
218 --error 1,42
219 --exec $mysqld=$illegal_pagesize
220 # InnoDB cannot handle this value.
221 --replace_result $illegal_pagesize ILLEGAL_PAGESIZE
222 let SEARCH_PATTERN= \[ERROR\] .*MY-\\d+.* Invalid page size=$illegal_pagesize;
223 --source include/search_pattern.inc
224 # Some checks omitted because they are already in 1.
225
226
227 --echo # 5. Try to restart the server with wrong innodb page size <number>karamel.
228 --echo # <number>k is a legal page size.
229 #---------------------------------------------------------------------------------
230 # The restart attempt has to fail.
231 --error 1,42
232 --exec $mysqld=$other_page_size_nkaramel
233 # The plain wrong value "<number>karamel" assigned to innodb page size seems
234 # to get mangled to "<number>k" which is a legal value.
235 if ( $default_page_size != $adjust_page_size )
236 {
237 # It gets detected that the assigned page size is not the default one
238 --replace_result $default_page_size DEFAULT_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
239 let SEARCH_PATTERN= innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
240 --source include/search_pattern.inc
241 }
242 # But this change does not fit to the history of the data.
243 # Some checks omitted because they are already in 1.
244
245
246 --echo # 6. Try to restart the server with the plain wrong innodb page size <number>caramel
247 --echo # <number>k is a legal page size.
248 --echo # The restart attempt has to
249 --echo # - fail in case start of test page size <> the minimal legal page size.
250 --echo # - to be successful in case start of test page size = minimal legal page size.
251 --echo # In this case we omit the execution of the current sub test!
252 #------------------------------------------------------------------------------------------
253 if ($zero_test)
254 {
255 if ($test_debug)
256 {
257 --echo # We do not omit the test.
258 }
259 --error 1
260 --exec $mysqld=$other_page_size_ncaramel
261 # The server dislikes the assigned value.
262 --replace_result $other_page_size_ncaramel OTHER_PAGE_SIZE_NCARAMEL
263 let SEARCH_PATTERN= Unknown suffix 'c' used for variable 'innodb-page-size' \(value '$other_page_size_ncaramel'\);
264 --source include/search_pattern_multiline.inc
265 # The plain wrong value "<number>caramel" assigned to innodb page size gets
266 # mangled to 0.
267 --replace_result $minimal_page_size MINIMAL_PAGE_SIZE
268 let SEARCH_PATTERN= \[Warning\] \[[^]]*\] \[[^]]*\] option 'innodb-page-size': unsigned value 0 adjusted to $minimal_page_size;
269 --source include/search_pattern_multiline.inc
270 # Some other layer has also something to tell.
271 --replace_result $other_page_size_ncaramel OTHER_PAGE_SIZE_NCARAMEL
272 let SEARCH_PATTERN= mysqld.*: Error while setting value '$other_page_size_ncaramel' to 'innodb-page-size';
273 --source include/search_pattern_multiline.inc
274 }
275
276 --echo # 7. Restart the server and cleanup
277 #-----------------------------------------
278 --remove_file $error_log
279 --source include/start_mysqld.inc
280
281 call mtr.add_suppression("Ignoring ib_4096_0.dblwr - page size doesn't match");
282
283