File: innodb_page_size_func.test

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (296 lines) | stat: -rw-r--r-- 13,235 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
284
285
286
287
288
289
290
291
292
293
294
295
296
# 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
#-----------------------------------------
--source include/not_embedded.inc
--source include/have_innodb.inc

# InnoDb page size values in 2011-11
# - supported: 4k, 8k, 16k
# - default:  16k
let $minimal_page_size=  4096;
let $default_page_size= 16384;
let $maximal_page_size= 16384;
let $legal_page_size_list= $minimal_page_size,8192,$maximal_page_size;
let $start_page_size=
`SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE LOWER(variable_name) = 'innodb_page_size'`;
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 0,1
--remove_file $error_log
# $error_log has to be processed by include/search_pattern_in_file.inc which
# contains Perl code requiring that the environment variable SEARCH_FILE points
# to this file.
let SEARCH_FILE= $error_log;
# Stop the server
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--shutdown_server 10
--source include/wait_until_disconnected.inc


--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
--exec $MYSQLD_CMD --innodb-page-size=$other_page_size --loose-console > $error_log 2>&1
if ( $default_page_size != $other_page_size )
{
   # It gets detected that the assigned page size is not the default one
   let SEARCH_PATTERN= InnoDB: innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
   --source include/search_pattern_in_file.inc
}
# We get depending on the platform either "./ibdata1" or ".\ibdata1".
let SEARCH_PATTERN=innodb-page-size mismatch in data file ..ibdata1;
--source include/search_pattern_in_file.inc
# Finally InnoDB becomes an Unknown/unsupported storage engine
let SEARCH_PATTERN= \[ERROR\] Unknown/unsupported storage engine: InnoDB;
--source include/search_pattern_in_file.inc
# The server restart aborts
let SEARCH_PATTERN= \[ERROR\] Aborting;
--source include/search_pattern_in_file.inc
--echo # 1.2 The value assigned is a number followed by 'k'.
--error 1
--exec $MYSQLD_CMD --innodb-page-size=$other_page_size_nk --loose-console > $error_log 2>&1
if ( $default_page_size != $other_page_size )
{
   # It gets detected that the assigned page size is not the default one
   let SEARCH_PATTERN= InnoDB: innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
   --source include/search_pattern_in_file.inc
}
let SEARCH_PATTERN=innodb-page-size mismatch in data file ..ibdata1;

--source include/search_pattern_in_file.inc
# Finally InnoDB becomes an Unknown/unsupported storage engine
let SEARCH_PATTERN= \[ERROR\] Unknown/unsupported storage engine: InnoDB;
--source include/search_pattern_in_file.inc
# The server restart aborts
let SEARCH_PATTERN= \[ERROR\] Aborting;
--source include/search_pattern_in_file.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
--exec $MYSQLD_CMD --innodb-page-size=$out_range_page_size --loose-console > $error_log 2>&1
# The innodb page size gets raised to the lowest or biggest legal value.
let SEARCH_PATTERN= \[Warning\] option 'innodb-page-size': unsigned value $out_range_page_size adjusted to $adjust_page_size;
--source include/search_pattern_in_file.inc
if ( $default_page_size != $adjust_page_size )
{
   # It gets detected that the assigned page size is not the default one
   let SEARCH_PATTERN= InnoDB: innodb-page-size has been changed from the default value $default_page_size to $adjust_page_size;
   --source include/search_pattern_in_file.inc
}
# Some checks omitted because they are already in 1.
# Finally InnoDB becomes an Unknown/unsupported storage engine
let SEARCH_PATTERN= \[ERROR\] Unknown/unsupported storage engine: InnoDB;
--source include/search_pattern_in_file.inc


--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
--exec $MYSQLD_CMD --innodb-page-size=garbage --loose-console > $error_log 2>&1
# 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
let SEARCH_PATTERN= \[Warning\] option 'innodb-page-size': unsigned value 0 adjusted to $minimal_page_size;
--source include/search_pattern_in_file.inc
# It gets detected that the innodb page size has been changed.
let SEARCH_PATTERN= InnoDB: innodb-page-size has been changed from the default value $default_page_size to $minimal_page_size;
--source include/search_pattern_in_file.inc
# Some checks omitted because they are already in 1.
# Finally InnoDB becomes an Unknown/unsupported storage engine
let SEARCH_PATTERN= \[ERROR\] Unknown/unsupported storage engine: InnoDB;
--source include/search_pattern_in_file.inc
}


--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
--error 1
--exec $MYSQLD_CMD --innodb-page-size=$illegal_pagesize --loose-console > $error_log 2>&1
# InnoDB cannot handle this value.
let SEARCH_PATTERN= \[ERROR\] InnoDB: Invalid page size=$illegal_pagesize;
--source include/search_pattern_in_file.inc
# Some checks omitted because they are already in 1.
# Finally InnoDB becomes an Unknown/unsupported storage engine
let SEARCH_PATTERN= \[ERROR\] Unknown/unsupported storage engine: InnoDB;
--source include/search_pattern_in_file.inc


--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
--exec $MYSQLD_CMD --innodb-page-size=$other_page_size_nkaramel --loose-console > $error_log 2>&1
# 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
   let SEARCH_PATTERN= InnoDB: innodb-page-size has been changed from the default value $default_page_size to $other_page_size;
   --source include/search_pattern_in_file.inc
}
# But this change does not fit to the history of the data.
# Some checks omitted because they are already in 1.
# Finally InnoDB becomes an Unknown/unsupported storage engine
let SEARCH_PATTERN= \[ERROR\] Aborting;
--source include/search_pattern_in_file.inc


--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_CMD --innodb-page-size=$other_page_size_ncaramel --loose-console > $error_log 2>&1
# The server dislikes the assigned value.
let SEARCH_PATTERN= Unknown suffix 'c' used for variable 'innodb-page-size' \(value '$other_page_size_ncaramel'\);
--source include/search_pattern_in_file.inc
# The plain wrong value "<number>caramel" assigned to innodb page size gets
# mangled to 0.
let SEARCH_PATTERN= \[Warning\] option 'innodb-page-size': unsigned value 0 adjusted to $minimal_page_size;
--source include/search_pattern_in_file.inc
# Some other layer has also something to tell.
let SEARCH_PATTERN= mysqld.*: Error while setting value '$other_page_size_ncaramel' to 'innodb-page-size';
--source include/search_pattern_in_file.inc
#    Finally InnoDB becomes an Unknown/unsupported storage engine
let SEARCH_PATTERN= \[ERROR\] Unknown/unsupported storage engine: InnoDB;
--source include/search_pattern_in_file.inc
}

--echo # 7. Restart the server and cleanup
#-----------------------------------------
--enable_reconnect
--exec echo "restart" > $restart_file
--source include/wait_until_connected_again.inc
--error 0,1
--remove_file $restart_file
--remove_file $error_log