File: innodb_page_size_func.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (283 lines) | stat: -rw-r--r-- 12,590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# Purpose of this test:
#    Check that server and InnoDB behave correct and give the right messages in
#    case it is tried to restart the server with
#    - plain wrong
#    - too small
#    - unsupported between too small and too high
#    - too high
#    - legal but not to the size during first server startup fitting
#    innodb page size. So every restart attempt with such a value
#    has to fail.
#
# This test should pass with calls of mtr and the following assignments
#    --mysqld=--innodb-page-size=4k
#    --mysqld=--innodb-page-size=4096
#    --mysqld=--innodb-page-size=8k
#    --mysqld=--innodb-page-size=8192
#    --mysqld=--innodb-page-size=16k
#    --mysqld=--innodb-page-size=16384
#    <no assignment of innodb-page-size at all>
#
# The current test is placed within the suite "innodb" though many tests for
# system variables are stored within the suite "sys_vars". The reason is the
# following:
#    The test is adjusted to be used with different legal innodb page sizes
#    assigned on command line.
#    Our current test collections run the test suite
#    - sys_vars   without assignment of innodb-page-size
#    - innodb     with several different assignments of innodb-page-size
#    Therefore placing this test within the suite "innodb" is better.
#
# Created: 2011-11-11 mleich
#

# Set this variable to
# -   0 for standard test runs (file with expected results is made for such).
# -   1 for debugging.(a result difference will show up)
let $test_debug= 0;

--echo # 0. Check and generate prerequites
#-----------------------------------------

# InnoDb page size values in 2011-11
# - supported: 4k, 8k, 16k
# - default:  16k
let $minimal_page_size=  4096;
let $default_page_size= 16384;
--disable_warnings
let $maximal_page_size= 65536;
let $legal_page_size_list= $minimal_page_size,8192,16384,32768,$maximal_page_size;
let $start_page_size=
`SELECT variable_value FROM performance_schema.global_status
WHERE LOWER(variable_name) = 'innodb_page_size'`;
--enable_warnings
if(`SELECT $start_page_size NOT IN ($legal_page_size_list)`)
{
   --echo # ERROR: The current innodb page size ($start_page_size) is not in
   --echo #        the list of expected legal page sizes : $legal_page_size_list
   --echo #        abort
   exit;
}
let $other_page_size= $minimal_page_size;
if($start_page_size == $minimal_page_size)
{
   let $other_page_size= $maximal_page_size;
}
let $other_page_size_k=    `SELECT $other_page_size DIV 1024`;
let $other_page_size_nk=       `SELECT CONCAT($other_page_size_k,'k')`;
let $other_page_size_nkaramel= `SELECT CONCAT($other_page_size_k,'karamel')`;
let $other_page_size_ncaramel= `SELECT CONCAT($other_page_size_k,'caramel')`;
if ($start_page_size < $maximal_page_size)
{
   let $out_range_page_size= `SELECT $maximal_page_size * 4`;
   let $adjust_page_size = $maximal_page_size;
}
if ($start_page_size > $minimal_page_size)
{
   let $out_range_page_size= `SELECT $minimal_page_size DIV 2`;
   let $adjust_page_size = $minimal_page_size;
}
let $illegal_pagesize= `SELECT $minimal_page_size + 1`;
let $zero_test= 1;
if ($start_page_size == $minimal_page_size)
{
   let $zero_test= 0;
}
if ($test_debug)
{
   --echo # --- Set in test script --------------------------
   --echo # minimal_page_size :        $minimal_page_size
   --echo # default_page_size :        $default_page_size
   --echo # maximal_page_size :        $maximal_page_size
   --echo # legal_page_size_list :     $legal_page_size_list
   --echo # --- Calculated ---------------------------------
   --echo # start_page_size :          $start_page_size
   --echo # other_page_size_k :        $other_page_size_k
   --echo # other_page_size_nk :       $other_page_size_nk
   --echo # other_page_size_nkaramel : $other_page_size_nkaramel
   --echo # other_page_size_ncaramel : $other_page_size_ncaramel
   --echo # out_range_page_size :      $out_range_page_size
   --echo # adjust_page_size :         $adjust_page_size
   --echo # illegal_pagesize :         $illegal_pagesize
   --echo # zero_test :                $zero_test
}

# We let our server restart attempts write to the file $error_log.
let $error_log= $MYSQLTEST_VARDIR/log/my_restart.err;
# $error_log has to be processed by include/search_pattern.inc which
# contains Perl code requiring that the environment variable SEARCH_FILE points
# to this file.
let SEARCH_FILE= $error_log;

--source include/shutdown_mysqld.inc

let $mysqld=$MYSQLD_CMD --core-file --console > $error_log 2>&1 --innodb-page-size;

--echo # 1. Try to restart the server with some other legal innodb page size value.
--echo #    It must fail because we had a different value before.
#----------------------------------------------------------------------------------
--echo # 1.1 The value assigned is a number.
# Detailed explanations of what happens are placed nearby the checks.
--error 1,42
--exec $mysqld=$other_page_size
if ( $default_page_size != $other_page_size )
{
   # It gets detected that the assigned page size is not the default one
   --replace_result $default_page_size DEFAULT_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
   let SEARCH_PATTERN=  innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
   --source include/search_pattern.inc
}
--replace_result $start_page_size START_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
let SEARCH_PATTERN=Data file '.*ibdata1' uses page size $start_page_size, but the innodb_page_size start-up parameter is $other_page_size;
--source include/search_pattern.inc
# The server restart aborts
let SEARCH_PATTERN= \[ERROR\] \[[^]]*\] \[[^]]*\] Aborting;
--source include/search_pattern.inc
--echo # 1.2 The value assigned is a number followed by 'k'.
--error 1,42
--exec $mysqld=$other_page_size_nk
if ( $default_page_size != $other_page_size )
{
   # It gets detected that the assigned page size is not the default one
   --replace_result $default_page_size DEFAULT_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
   let SEARCH_PATTERN=  innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
   --source include/search_pattern.inc
}

--replace_result $start_page_size START_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
let SEARCH_PATTERN=Data file '.*ibdata1' uses page size $start_page_size, but the innodb_page_size start-up parameter is $other_page_size;
--source include/search_pattern.inc

# The server restart aborts
let SEARCH_PATTERN= \[ERROR\] \[[^]]*\] \[[^]]*\] Aborting;
--source include/search_pattern.inc


--echo # 2. Try to restart the server with some innodb page size.which is either
--echo #    bigger than the maximum or smaller than the minimum supported one.
--echo #    It must fail because we had a different value before.
#-------------------------------------------------------------------------------
# Properties of the value:
# 1. not supported
# 2. below the smallest supported one
# The restart attempt has to fail.
--error 1,42
--exec $mysqld=$out_range_page_size
# The innodb page size gets raised to the lowest or biggest legal value.
--replace_result $out_range_page_size OUT_RANGE_PAGE_SIZE $adjust_page_size ADJUST_PAGE_SIZE
let SEARCH_PATTERN= \[Warning\] \[[^]]*\] \[[^]]*\] option 'innodb-page-size': unsigned value $out_range_page_size adjusted to $adjust_page_size;
--source include/search_pattern.inc
if ( $default_page_size != $adjust_page_size )
{
   # It gets detected that the assigned page size is not the default one
   --replace_result $default_page_size DEFAULT_PAGE_SIZE $adjust_page_size ADJUST_PAGE_SIZE
   let SEARCH_PATTERN=  innodb-page-size has been changed from the default value $default_page_size to $adjust_page_size;
   --source include/search_pattern.inc
}
# Some checks omitted because they are already in 1.


--echo # 3. Try to restart the server with the plain wrong innodb page size value "garbage".
--echo #    The restart attempt has to
--echo #    - fail in case start of test page size <> the minimal legal page size.
--echo #    - to be successful in case start of test page size = minimal legal page size.
--echo #      In this case we omit the execution of the current sub test!
#-------------------------------------------------------------------------------------------
if ($zero_test)
{
   if ($test_debug)
   {
     --echo # We do not omit the test.
   }
--error 1,42
--exec $mysqld=garbage
# General server properties cause that
# - the plain wrong value "garbage" assigned to innodb page size gets
#   mangled to 0.
# - the 0 which is below the smallest possible page size is adjusted
#   to the smallest possible page size
--replace_result $minimal_page_size MINIMAL_PAGE_SIZE
let SEARCH_PATTERN= \[Warning\] \[[^]]*\] \[[^]]*\] option 'innodb-page-size': unsigned value 0 adjusted to $minimal_page_size;
--source include/search_pattern_multiline.inc
# It gets detected that the innodb page size has been changed.
--replace_result $default_page_size DEFAULT_PAGE_SIZE $minimal_page_size MINIMAL_PAGE_SIZE
let SEARCH_PATTERN=  innodb-page-size has been changed from the default value $default_page_size to $minimal_page_size;
--source include/search_pattern_multiline.inc
# Some checks omitted because they are already in 1.
}


--echo # 4. Try to restart the server with some illegal innodb page size value
--echo #    being between minimum and maximum legal page size value.
--echo #    The restart attempt has to fail.
#------------------------------------------------------------------------------
# Properties of the value:
# 1. not supported
# 2. between smallest (4k) and biggest (16k) supported one
# InnoDB aborts, so ASAN may report leaks
--error 1,42
--exec $mysqld=$illegal_pagesize
# InnoDB cannot handle this value.
--replace_result $illegal_pagesize ILLEGAL_PAGESIZE
let SEARCH_PATTERN= \[ERROR\] .*MY-\\d+.* Invalid page size=$illegal_pagesize;
--source include/search_pattern.inc
# Some checks omitted because they are already in 1.


--echo # 5. Try to restart the server with wrong innodb page size <number>karamel.
--echo #    <number>k is a legal page size.
#---------------------------------------------------------------------------------
# The restart attempt has to fail.
--error 1,42
--exec $mysqld=$other_page_size_nkaramel
# The plain wrong value "<number>karamel" assigned to innodb page size seems
# to get mangled to "<number>k" which is a legal value.
if ( $default_page_size != $adjust_page_size )
{
   # It gets detected that the assigned page size is not the default one
   --replace_result $default_page_size DEFAULT_PAGE_SIZE $other_page_size OTHER_PAGE_SIZE
   let SEARCH_PATTERN=  innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
   --source include/search_pattern.inc
}
# But this change does not fit to the history of the data.
# Some checks omitted because they are already in 1.


--echo # 6. Try to restart the server with the plain wrong innodb page size <number>caramel
--echo #    <number>k is a legal page size.
--echo #    The restart attempt has to
--echo #    - fail in case start of test page size <> the minimal legal page size.
--echo #    - to be successful in case start of test page size = minimal legal page size.
--echo #      In this case we omit the execution of the current sub test!
#------------------------------------------------------------------------------------------
if ($zero_test)
{
   if ($test_debug)
   {
     --echo # We do not omit the test.
   }
--error 1
--exec $mysqld=$other_page_size_ncaramel
# The server dislikes the assigned value.
--replace_result $other_page_size_ncaramel OTHER_PAGE_SIZE_NCARAMEL
let SEARCH_PATTERN= Unknown suffix 'c' used for variable 'innodb-page-size' \(value '$other_page_size_ncaramel'\);
--source include/search_pattern_multiline.inc
# The plain wrong value "<number>caramel" assigned to innodb page size gets
# mangled to 0.
--replace_result $minimal_page_size MINIMAL_PAGE_SIZE
let SEARCH_PATTERN= \[Warning\] \[[^]]*\] \[[^]]*\] option 'innodb-page-size': unsigned value 0 adjusted to $minimal_page_size;
--source include/search_pattern_multiline.inc
# Some other layer has also something to tell.
--replace_result $other_page_size_ncaramel OTHER_PAGE_SIZE_NCARAMEL
let SEARCH_PATTERN= mysqld.*: Error while setting value '$other_page_size_ncaramel' to 'innodb-page-size';
--source include/search_pattern_multiline.inc
}

--echo # 7. Restart the server and cleanup
#-----------------------------------------
--remove_file $error_log
--source include/start_mysqld.inc

call mtr.add_suppression("Ignoring ib_4096_0.dblwr - page size doesn't match");