]>
Commit | Line | Data |
---|---|---|
b4e1fa2c AM |
1 | # name : innodb_files_extend.patch |
2 | # introduced : 11 or before | |
3 | # maintainer : Yasufumi | |
4 | # | |
5 | #!!! notice !!! | |
6 | # Any small change to this file in the main branch | |
7 | # should be done or reviewed by the maintainer! | |
db82db79 AM |
8 | --- a/storage/innobase/fil/fil0fil.c |
9 | +++ b/storage/innobase/fil/fil0fil.c | |
adf0fb13 | 10 | @@ -731,7 +731,7 @@ |
d8778560 AM |
11 | ut_a(space->purpose != FIL_LOG); |
12 | ut_a(!trx_sys_sys_space(space->id)); | |
13 | ||
14 | - if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { | |
15 | + if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { | |
16 | fprintf(stderr, | |
17 | "InnoDB: Error: the size of single-table" | |
18 | " tablespace file %s\n" | |
29ffd636 | 19 | @@ -4169,7 +4169,7 @@ |
d8778560 AM |
20 | |
21 | size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low; | |
22 | #ifndef UNIV_HOTBACKUP | |
23 | - if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { | |
24 | + if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { | |
25 | fprintf(stderr, | |
26 | "InnoDB: Error: the size of single-table tablespace" | |
27 | " file %s\n" | |
29ffd636 | 28 | @@ -4189,7 +4189,7 @@ |
d8778560 AM |
29 | /* Align the memory for file i/o if we might have O_DIRECT set */ |
30 | page = ut_align(buf2, UNIV_PAGE_SIZE); | |
31 | ||
32 | - if (size >= FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { | |
33 | + if (size >= FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) { | |
34 | success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE); | |
35 | ||
36 | /* We have to read the tablespace id from the file */ | |
29ffd636 | 37 | @@ -5167,9 +5167,9 @@ |
b4e1fa2c AM |
38 | ut_ad(ut_is_2pow(zip_size)); |
39 | ut_ad(buf); | |
40 | ut_ad(len > 0); | |
41 | -#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE | |
42 | -# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE" | |
43 | -#endif | |
44 | +//#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE | |
45 | +//# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE" | |
46 | +//#endif | |
d8778560 | 47 | ut_ad(fil_validate_skip()); |
b4e1fa2c AM |
48 | #ifndef UNIV_HOTBACKUP |
49 | # ifndef UNIV_LOG_DEBUG | |
db82db79 AM |
50 | --- a/storage/innobase/fsp/fsp0fsp.c |
51 | +++ b/storage/innobase/fsp/fsp0fsp.c | |
29ffd636 | 52 | @@ -595,16 +595,18 @@ |
d8778560 | 53 | 0 for uncompressed pages */ |
b4e1fa2c AM |
54 | ulint offset) /*!< in: page offset */ |
55 | { | |
d8778560 | 56 | -#ifndef DOXYGEN /* Doxygen gets confused of these */ |
b4e1fa2c AM |
57 | -# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \ |
58 | - + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE | |
59 | -# error | |
60 | -# endif | |
d8778560 AM |
61 | -# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \ |
62 | - + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE | |
63 | -# error | |
64 | -# endif | |
65 | -#endif /* !DOXYGEN */ | |
66 | +//#ifndef DOXYGEN /* Doxygen gets confused of these */ | |
b4e1fa2c AM |
67 | +//# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET |
68 | +// + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE | |
69 | +//# error | |
70 | +//# endif | |
d8778560 AM |
71 | +//# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET |
72 | +// + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE | |
73 | +//# error | |
74 | +//# endif | |
75 | +//#endif /* !DOXYGEN */ | |
b4e1fa2c | 76 | + ut_a(UNIV_PAGE_SIZE > XDES_ARR_OFFSET + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE); |
d8778560 | 77 | + ut_a(PAGE_ZIP_MIN_SIZE > XDES_ARR_OFFSET + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE); |
b4e1fa2c AM |
78 | ut_ad(ut_is_2pow(zip_size)); |
79 | ||
80 | if (!zip_size) { | |
29ffd636 | 81 | @@ -1403,12 +1405,12 @@ |
b4e1fa2c AM |
82 | mtr); |
83 | xdes_init(descr, mtr); | |
84 | ||
85 | -#if UNIV_PAGE_SIZE % FSP_EXTENT_SIZE | |
86 | -# error "UNIV_PAGE_SIZE % FSP_EXTENT_SIZE != 0" | |
87 | -#endif | |
88 | -#if PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE | |
89 | -# error "PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE != 0" | |
90 | -#endif | |
91 | +//#if UNIV_PAGE_SIZE % FSP_EXTENT_SIZE | |
92 | +//# error "UNIV_PAGE_SIZE % FSP_EXTENT_SIZE != 0" | |
93 | +//#endif | |
94 | +//#if PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE | |
95 | +//# error "PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE != 0" | |
96 | +//#endif | |
97 | ||
98 | if (UNIV_UNLIKELY(init_xdes)) { | |
99 | ||
db82db79 AM |
100 | --- a/storage/innobase/handler/ha_innodb.cc |
101 | +++ b/storage/innobase/handler/ha_innodb.cc | |
b4e1fa2c AM |
102 | @@ -148,6 +148,9 @@ |
103 | static ulong innobase_write_io_threads; | |
104 | static long innobase_buffer_pool_instances = 1; | |
105 | ||
106 | +static ulong innobase_page_size; | |
107 | +static ulong innobase_log_block_size; | |
108 | + | |
109 | static my_bool innobase_thread_concurrency_timer_based; | |
110 | static long long innobase_buffer_pool_size, innobase_log_file_size; | |
111 | ||
734d6226 | 112 | @@ -2352,6 +2355,65 @@ |
b4e1fa2c | 113 | } |
d8778560 | 114 | #endif /* DBUG_OFF */ |
b4e1fa2c AM |
115 | |
116 | + srv_page_size = 0; | |
117 | + srv_page_size_shift = 0; | |
118 | + | |
119 | + if (innobase_page_size != (1 << 14)) { | |
120 | + uint n_shift; | |
121 | + | |
122 | + fprintf(stderr, | |
123 | + "InnoDB: Warning: innodb_page_size has been changed from default value 16384. (###EXPERIMENTAL### operation)\n"); | |
124 | + for (n_shift = 12; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) { | |
125 | + if (innobase_page_size == ((ulong)1 << n_shift)) { | |
126 | + srv_page_size_shift = n_shift; | |
127 | + srv_page_size = (1 << srv_page_size_shift); | |
128 | + fprintf(stderr, | |
129 | + "InnoDB: The universal page size of the database is set to %lu.\n", | |
130 | + srv_page_size); | |
131 | + break; | |
132 | + } | |
133 | + } | |
134 | + } else { | |
135 | + srv_page_size_shift = 14; | |
136 | + srv_page_size = (1 << srv_page_size_shift); | |
137 | + } | |
138 | + | |
139 | + if (!srv_page_size_shift) { | |
140 | + fprintf(stderr, | |
d8778560 AM |
141 | + "InnoDB: Error: %lu is not a valid value for innodb_page_size.\n" |
142 | + "InnoDB: Error: Valid values are 4096, 8192, and 16384 (default=16384).\n", | |
b4e1fa2c AM |
143 | + innobase_page_size); |
144 | + goto error; | |
145 | + } | |
146 | + | |
147 | + srv_log_block_size = 0; | |
148 | + if (innobase_log_block_size != (1 << 9)) { /*!=512*/ | |
149 | + uint n_shift; | |
150 | + | |
151 | + fprintf(stderr, | |
152 | + "InnoDB: Warning: innodb_log_block_size has been changed from default value 512. (###EXPERIMENTAL### operation)\n"); | |
153 | + for (n_shift = 9; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) { | |
154 | + if (innobase_log_block_size == ((ulong)1 << n_shift)) { | |
155 | + srv_log_block_size = (1 << n_shift); | |
156 | + fprintf(stderr, | |
157 | + "InnoDB: The log block size is set to %lu.\n", | |
158 | + srv_log_block_size); | |
159 | + break; | |
160 | + } | |
161 | + } | |
162 | + } else { | |
163 | + srv_log_block_size = 512; | |
164 | + } | |
165 | + | |
166 | + if (!srv_log_block_size) { | |
167 | + fprintf(stderr, | |
d8778560 AM |
168 | + "InnoDB: Error: %lu is not a valid value for innodb_log_block_size.\n" |
169 | + "InnoDB: Error: A valid value for innodb_log_block_size is\n" | |
170 | + "InnoDB: Error: a power of 2 from 512 to 16384.\n", | |
b4e1fa2c AM |
171 | + innobase_log_block_size); |
172 | + goto error; | |
173 | + } | |
174 | + | |
175 | #ifndef MYSQL_SERVER | |
176 | innodb_overwrite_relay_log_info = FALSE; | |
177 | #endif | |
29ffd636 | 178 | @@ -7289,9 +7351,9 @@ |
b4e1fa2c AM |
179 | | DICT_TF_COMPACT |
180 | | DICT_TF_FORMAT_ZIP | |
181 | << DICT_TF_FORMAT_SHIFT; | |
182 | -#if DICT_TF_ZSSIZE_MAX < 1 | |
183 | -# error "DICT_TF_ZSSIZE_MAX < 1" | |
184 | -#endif | |
185 | +//#if DICT_TF_ZSSIZE_MAX < 1 | |
186 | +//# error "DICT_TF_ZSSIZE_MAX < 1" | |
187 | +//#endif | |
188 | } | |
189 | } | |
190 | ||
29ffd636 | 191 | @@ -11552,6 +11614,16 @@ |
b4e1fa2c AM |
192 | "#### Attention: The checksum is not compatible for normal or disabled version! ####", |
193 | NULL, NULL, FALSE); | |
194 | ||
195 | +static MYSQL_SYSVAR_ULONG(page_size, innobase_page_size, | |
196 | + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, | |
197 | + "###EXPERIMENTAL###: The universal page size of the database. Changing for created database is not supported. Use on your own risk!", | |
198 | + NULL, NULL, (1 << 14), (1 << 12), (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0); | |
199 | + | |
200 | +static MYSQL_SYSVAR_ULONG(log_block_size, innobase_log_block_size, | |
201 | + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, | |
202 | + "###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!", | |
203 | + NULL, NULL, (1 << 9)/*512*/, (1 << 9)/*512*/, (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0); | |
204 | + | |
205 | static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir, | |
206 | PLUGIN_VAR_READONLY, | |
207 | "The common part for InnoDB table spaces.", | |
29ffd636 | 208 | @@ -12118,6 +12190,8 @@ |
a9ee80b9 | 209 | NULL, NULL, 0, &corrupt_table_action_typelib); |
b4e1fa2c AM |
210 | |
211 | static struct st_mysql_sys_var* innobase_system_variables[]= { | |
212 | + MYSQL_SYSVAR(page_size), | |
213 | + MYSQL_SYSVAR(log_block_size), | |
214 | MYSQL_SYSVAR(additional_mem_pool_size), | |
215 | MYSQL_SYSVAR(autoextend_increment), | |
216 | MYSQL_SYSVAR(buffer_pool_size), | |
db82db79 AM |
217 | --- a/storage/innobase/include/buf0buf.h |
218 | +++ b/storage/innobase/include/buf0buf.h | |
29ffd636 | 219 | @@ -1725,7 +1725,7 @@ |
b4e1fa2c AM |
220 | time_t last_printout_time; |
221 | /*!< when buf_print_io was last time | |
222 | called */ | |
223 | - buf_buddy_stat_t buddy_stat[BUF_BUDDY_SIZES + 1]; | |
224 | + buf_buddy_stat_t buddy_stat[BUF_BUDDY_SIZES_MAX + 1]; | |
225 | /*!< Statistics of buddy system, | |
226 | indexed by block size */ | |
227 | buf_pool_stat_t stat; /*!< current statistics */ | |
29ffd636 | 228 | @@ -1823,7 +1823,7 @@ |
b4e1fa2c AM |
229 | UT_LIST_BASE_NODE_T(buf_page_t) zip_clean; |
230 | /*!< unmodified compressed pages */ | |
db82db79 | 231 | #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ |
b4e1fa2c AM |
232 | - UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES]; |
233 | + UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES_MAX]; | |
234 | /*!< buddy free lists */ | |
235 | ||
236 | buf_page_t watch[BUF_POOL_WATCH_SIZE]; | |
29ffd636 | 237 | @@ -1831,9 +1831,9 @@ |
b4e1fa2c AM |
238 | pool watches. Protected by |
239 | buf_pool->mutex. */ | |
240 | ||
241 | -#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE | |
242 | -# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE" | |
243 | -#endif | |
244 | +//#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE | |
245 | +//# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE" | |
246 | +//#endif | |
247 | #if BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE | |
248 | # error "BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE" | |
249 | #endif | |
db82db79 AM |
250 | --- a/storage/innobase/include/buf0types.h |
251 | +++ b/storage/innobase/include/buf0types.h | |
29ffd636 | 252 | @@ -70,12 +70,13 @@ |
db82db79 AM |
253 | #define BUF_BUDDY_LOW (1 << BUF_BUDDY_LOW_SHIFT) |
254 | ||
b4e1fa2c AM |
255 | #define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT) |
256 | +#define BUF_BUDDY_SIZES_MAX (UNIV_PAGE_SIZE_SHIFT_MAX - BUF_BUDDY_LOW_SHIFT) | |
257 | /*!< number of buddy sizes */ | |
258 | ||
259 | /** twice the maximum block size of the buddy system; | |
d8778560 AM |
260 | the underlying memory is aligned by this amount: |
261 | this must be equal to UNIV_PAGE_SIZE */ | |
262 | -#define BUF_BUDDY_HIGH (BUF_BUDDY_LOW << BUF_BUDDY_SIZES) | |
263 | +#define BUF_BUDDY_HIGH ((ulint)BUF_BUDDY_LOW << BUF_BUDDY_SIZES) | |
264 | /* @} */ | |
265 | ||
266 | #endif | |
db82db79 AM |
267 | --- a/storage/innobase/include/fsp0types.h |
268 | +++ b/storage/innobase/include/fsp0types.h | |
d8778560 AM |
269 | @@ -42,7 +42,7 @@ |
270 | /* @} */ | |
271 | ||
272 | /** File space extent size (one megabyte) in pages */ | |
273 | -#define FSP_EXTENT_SIZE (1 << (20 - UNIV_PAGE_SIZE_SHIFT)) | |
274 | +#define FSP_EXTENT_SIZE ((ulint)1 << (20 - UNIV_PAGE_SIZE_SHIFT)) | |
275 | ||
276 | /** On a page of any file segment, data may be put starting from this | |
277 | offset */ | |
db82db79 AM |
278 | --- a/storage/innobase/include/log0log.h |
279 | +++ b/storage/innobase/include/log0log.h | |
b4e1fa2c AM |
280 | @@ -672,6 +672,9 @@ |
281 | when mysqld is first time started | |
282 | on the restored database, it can | |
283 | print helpful info for the user */ | |
284 | +#define LOG_FILE_OS_FILE_LOG_BLOCK_SIZE 64 | |
285 | + /* extend to record log_block_size | |
286 | + of XtraDB. 0 means default 512 */ | |
287 | #define LOG_FILE_ARCH_COMPLETED OS_FILE_LOG_BLOCK_SIZE | |
288 | /* this 4-byte field is TRUE when | |
289 | the writing of an archived log file | |
db82db79 AM |
290 | --- a/storage/innobase/include/mtr0log.ic |
291 | +++ b/storage/innobase/include/mtr0log.ic | |
b4e1fa2c AM |
292 | @@ -203,7 +203,7 @@ |
293 | system tablespace */ | |
294 | if ((space == TRX_SYS_SPACE | |
295 | || (srv_doublewrite_file && space == TRX_DOUBLEWRITE_SPACE)) | |
296 | - && offset >= FSP_EXTENT_SIZE && offset < 3 * FSP_EXTENT_SIZE) { | |
297 | + && offset >= (ulint)FSP_EXTENT_SIZE && offset < 3 * (ulint)FSP_EXTENT_SIZE) { | |
298 | if (trx_doublewrite_buf_is_being_created) { | |
299 | /* Do nothing: we only come to this branch in an | |
300 | InnoDB database creation. We do not redo log | |
db82db79 AM |
301 | --- a/storage/innobase/include/os0file.h |
302 | +++ b/storage/innobase/include/os0file.h | |
b4e1fa2c AM |
303 | @@ -101,7 +101,7 @@ |
304 | if this fails for a log block, then it is equivalent to a media failure in the | |
305 | log. */ | |
306 | ||
307 | -#define OS_FILE_LOG_BLOCK_SIZE 512 | |
308 | +#define OS_FILE_LOG_BLOCK_SIZE srv_log_block_size | |
309 | ||
310 | /** Options for file_create @{ */ | |
311 | #define OS_FILE_OPEN 51 | |
312 | @@ -190,6 +190,8 @@ | |
313 | extern ulint os_n_file_writes; | |
314 | extern ulint os_n_fsyncs; | |
315 | ||
316 | +extern ulint srv_log_block_size; | |
317 | + | |
318 | #ifdef UNIV_PFS_IO | |
319 | /* Keys to register InnoDB I/O with performance schema */ | |
320 | extern mysql_pfs_key_t innodb_file_data_key; | |
db82db79 AM |
321 | --- a/storage/innobase/include/page0types.h |
322 | +++ b/storage/innobase/include/page0types.h | |
b4e1fa2c AM |
323 | @@ -56,8 +56,9 @@ |
324 | ||
325 | /** Number of supported compressed page sizes */ | |
326 | #define PAGE_ZIP_NUM_SSIZE (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 2) | |
327 | -#if PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS) | |
328 | -# error "PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)" | |
329 | +#define PAGE_ZIP_NUM_SSIZE_MAX (UNIV_PAGE_SIZE_SHIFT_MAX - PAGE_ZIP_MIN_SIZE_SHIFT + 2) | |
330 | +#if PAGE_ZIP_NUM_SSIZE_MAX > (1 << PAGE_ZIP_SSIZE_BITS) | |
331 | +# error "PAGE_ZIP_NUM_SSIZE_MAX > (1 << PAGE_ZIP_SSIZE_BITS)" | |
332 | #endif | |
333 | ||
334 | /** Compressed page descriptor */ | |
335 | @@ -98,7 +99,7 @@ | |
336 | typedef struct page_zip_stat_struct page_zip_stat_t; | |
337 | ||
338 | /** Statistics on compression, indexed by page_zip_des_struct::ssize - 1 */ | |
339 | -extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1]; | |
340 | +extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE_MAX - 1]; | |
341 | ||
342 | /**********************************************************************//** | |
343 | Write the "deleted" flag of a record on a compressed page. The flag must | |
db82db79 AM |
344 | --- a/storage/innobase/include/trx0sys.h |
345 | +++ b/storage/innobase/include/trx0sys.h | |
346 | @@ -526,9 +526,9 @@ | |
b4e1fa2c AM |
347 | /** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */ |
348 | #define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344 | |
349 | ||
350 | -#if UNIV_PAGE_SIZE < 4096 | |
351 | -# error "UNIV_PAGE_SIZE < 4096" | |
352 | -#endif | |
353 | +//#if UNIV_PAGE_SIZE < 4096 | |
354 | +//# error "UNIV_PAGE_SIZE < 4096" | |
355 | +//#endif | |
356 | /** The offset of the MySQL replication info in the trx system header; | |
357 | this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ | |
358 | #define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000) | |
db82db79 AM |
359 | --- a/storage/innobase/include/univ.i |
360 | +++ b/storage/innobase/include/univ.i | |
734d6226 | 361 | @@ -313,9 +313,13 @@ |
b4e1fa2c AM |
362 | */ |
363 | ||
364 | /* The 2-logarithm of UNIV_PAGE_SIZE: */ | |
365 | -#define UNIV_PAGE_SIZE_SHIFT 14 | |
366 | +/* #define UNIV_PAGE_SIZE_SHIFT 14 */ | |
367 | +#define UNIV_PAGE_SIZE_SHIFT_MAX 14 | |
368 | +#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift | |
369 | /* The universal page size of the database */ | |
370 | -#define UNIV_PAGE_SIZE (1 << UNIV_PAGE_SIZE_SHIFT) | |
371 | +/* #define UNIV_PAGE_SIZE (1 << UNIV_PAGE_SIZE_SHIFT) */ | |
372 | +#define UNIV_PAGE_SIZE srv_page_size | |
373 | +#define UNIV_PAGE_SIZE_MAX (1 << UNIV_PAGE_SIZE_SHIFT_MAX) | |
374 | ||
375 | /* Maximum number of parallel threads in a parallelized operation */ | |
376 | #define UNIV_MAX_PARALLELISM 32 | |
734d6226 | 377 | @@ -434,7 +438,7 @@ |
b4e1fa2c AM |
378 | stored part of the field in the tablespace. The length field then |
379 | contains the sum of the following flag and the locally stored len. */ | |
380 | ||
381 | -#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE) | |
382 | +#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE_MAX) | |
383 | ||
384 | /* Some macros to improve branch prediction and reduce cache misses */ | |
385 | #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) | |
734d6226 | 386 | @@ -537,4 +541,6 @@ |
b4e1fa2c AM |
387 | UNIV_MEM_ALLOC(addr, size); \ |
388 | } while (0) | |
389 | ||
390 | +extern ulint srv_page_size_shift; | |
391 | +extern ulint srv_page_size; | |
392 | #endif | |
db82db79 AM |
393 | --- a/storage/innobase/log/log0log.c |
394 | +++ b/storage/innobase/log/log0log.c | |
d8778560 | 395 | @@ -604,7 +604,9 @@ |
b4e1fa2c AM |
396 | |
397 | offset = (gr_lsn_size_offset + difference) % group_size; | |
398 | ||
399 | + if (sizeof(ulint) == 4) { | |
400 | ut_a(offset < (((ib_int64_t) 1) << 32)); /* offset must be < 4 GB */ | |
401 | + } | |
402 | ||
403 | /* fprintf(stderr, | |
404 | "Offset is %lu gr_lsn_offset is %lu difference is %lu\n", | |
d8778560 | 405 | @@ -1201,6 +1203,9 @@ |
b4e1fa2c AM |
406 | /* Wipe over possible label of ibbackup --restore */ |
407 | memcpy(buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, " ", 4); | |
408 | ||
409 | + mach_write_to_4(buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE, | |
410 | + srv_log_block_size); | |
411 | + | |
412 | dest_offset = nth_file * group->file_size; | |
413 | ||
414 | #ifdef UNIV_DEBUG | |
29ffd636 | 415 | @@ -1797,9 +1802,7 @@ |
b4e1fa2c AM |
416 | ulint i; |
417 | ||
418 | ut_ad(mutex_own(&(log_sys->mutex))); | |
419 | -#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE | |
420 | -# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE" | |
421 | -#endif | |
422 | + ut_a(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE); | |
423 | ||
424 | buf = group->checkpoint_buf; | |
425 | ||
29ffd636 | 426 | @@ -1813,6 +1816,7 @@ |
b4e1fa2c AM |
427 | mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size); |
428 | ||
429 | #ifdef UNIV_LOG_ARCHIVE | |
430 | +#error "UNIV_LOG_ARCHIVE could not be enabled" | |
431 | if (log_sys->archiving_state == LOG_ARCH_OFF) { | |
432 | archived_lsn = IB_ULONGLONG_MAX; | |
433 | } else { | |
29ffd636 | 434 | @@ -1826,7 +1830,9 @@ |
b4e1fa2c AM |
435 | |
436 | mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn); | |
437 | #else /* UNIV_LOG_ARCHIVE */ | |
438 | - mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, IB_ULONGLONG_MAX); | |
439 | + mach_write_to_8(buf + LOG_CHECKPOINT_ARCHIVED_LSN, | |
440 | + (ib_uint64_t)log_group_calc_lsn_offset( | |
441 | + log_sys->next_checkpoint_lsn, group)); | |
442 | #endif /* UNIV_LOG_ARCHIVE */ | |
443 | ||
444 | for (i = 0; i < LOG_MAX_N_GROUPS; i++) { | |
db82db79 AM |
445 | --- a/storage/innobase/log/log0recv.c |
446 | +++ b/storage/innobase/log/log0recv.c | |
b4e1fa2c AM |
447 | @@ -712,8 +712,22 @@ |
448 | ||
449 | group->lsn = mach_read_from_8( | |
450 | buf + LOG_CHECKPOINT_LSN); | |
451 | + | |
452 | +#ifdef UNIV_LOG_ARCHIVE | |
453 | +#error "UNIV_LOG_ARCHIVE could not be enabled" | |
454 | +#endif | |
455 | + { | |
456 | + ib_uint64_t tmp_lsn_offset = mach_read_from_8( | |
457 | + buf + LOG_CHECKPOINT_ARCHIVED_LSN); | |
458 | + if (sizeof(ulint) != 4 | |
459 | + && tmp_lsn_offset != IB_ULONGLONG_MAX) { | |
460 | + group->lsn_offset = (ulint) tmp_lsn_offset; | |
461 | + } else { | |
462 | group->lsn_offset = mach_read_from_4( | |
463 | buf + LOG_CHECKPOINT_OFFSET); | |
464 | + } | |
465 | + } | |
466 | + | |
467 | checkpoint_no = mach_read_from_8( | |
468 | buf + LOG_CHECKPOINT_NO); | |
469 | ||
470 | @@ -2955,6 +2969,7 @@ | |
471 | log_group_t* max_cp_group; | |
472 | log_group_t* up_to_date_group; | |
473 | ulint max_cp_field; | |
474 | + ulint log_hdr_log_block_size; | |
475 | ib_uint64_t checkpoint_lsn; | |
476 | ib_uint64_t checkpoint_no; | |
477 | ib_uint64_t old_scanned_lsn; | |
d8778560 | 478 | @@ -3056,6 +3071,21 @@ |
b4e1fa2c AM |
479 | log_hdr_buf, max_cp_group); |
480 | } | |
481 | ||
482 | + log_hdr_log_block_size | |
483 | + = mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE); | |
484 | + if (log_hdr_log_block_size == 0) { | |
485 | + /* 0 means default value */ | |
486 | + log_hdr_log_block_size = 512; | |
487 | + } | |
488 | + if (log_hdr_log_block_size != srv_log_block_size) { | |
489 | + fprintf(stderr, | |
490 | + "InnoDB: Error: The block size of ib_logfile (%lu) " | |
d8778560 AM |
491 | + "is not equal to innodb_log_block_size.\n" |
492 | + "InnoDB: Error: Suggestion - Recreate log files.\n", | |
b4e1fa2c AM |
493 | + log_hdr_log_block_size); |
494 | + return(DB_ERROR); | |
495 | + } | |
496 | + | |
497 | #ifdef UNIV_LOG_ARCHIVE | |
498 | group = UT_LIST_GET_FIRST(log_sys->log_groups); | |
499 | ||
db82db79 AM |
500 | --- a/storage/innobase/page/page0zip.c |
501 | +++ b/storage/innobase/page/page0zip.c | |
b4e1fa2c AM |
502 | @@ -49,7 +49,7 @@ |
503 | ||
504 | #ifndef UNIV_HOTBACKUP | |
505 | /** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */ | |
506 | -UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1]; | |
507 | +UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE_MAX - 1]; | |
508 | #endif /* !UNIV_HOTBACKUP */ | |
509 | ||
510 | /* Please refer to ../include/page0zip.ic for a description of the | |
db82db79 AM |
511 | --- a/storage/innobase/row/row0merge.c |
512 | +++ b/storage/innobase/row/row0merge.c | |
b4e1fa2c AM |
513 | @@ -97,7 +97,7 @@ |
514 | row_merge_block_t. Thus, it must be able to hold one merge record, | |
515 | whose maximum size is the same as the minimum size of | |
516 | row_merge_block_t. */ | |
517 | -typedef byte mrec_buf_t[UNIV_PAGE_SIZE]; | |
518 | +typedef byte mrec_buf_t[UNIV_PAGE_SIZE_MAX]; | |
519 | ||
520 | /** @brief Merge record in row_merge_block_t. | |
521 | ||
db82db79 AM |
522 | --- a/storage/innobase/srv/srv0srv.c |
523 | +++ b/storage/innobase/srv/srv0srv.c | |
734d6226 | 524 | @@ -236,6 +236,14 @@ |
b4e1fa2c | 525 | |
734d6226 AM |
526 | /* Switch to enable random read ahead. */ |
527 | UNIV_INTERN my_bool srv_random_read_ahead = FALSE; | |
528 | + | |
b4e1fa2c AM |
529 | +/* The universal page size of the database */ |
530 | +UNIV_INTERN ulint srv_page_size_shift = 0; | |
531 | +UNIV_INTERN ulint srv_page_size = 0; | |
532 | + | |
533 | +/* The log block size */ | |
534 | +UNIV_INTERN ulint srv_log_block_size = 0; | |
535 | + | |
536 | /* User settable value of the number of pages that must be present | |
537 | in the buffer cache and accessed sequentially for InnoDB to trigger a | |
538 | readahead request. */ | |
db82db79 AM |
539 | --- a/storage/innobase/srv/srv0start.c |
540 | +++ b/storage/innobase/srv/srv0start.c | |
29ffd636 | 541 | @@ -1582,11 +1582,13 @@ |
b4e1fa2c AM |
542 | } |
543 | #endif /* UNIV_LOG_ARCHIVE */ | |
544 | ||
545 | - if (srv_n_log_files * srv_log_file_size >= 262144) { | |
546 | + if (sizeof(ulint) == 4 | |
547 | + && srv_n_log_files * srv_log_file_size | |
548 | + >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) { | |
d8778560 | 549 | ut_print_timestamp(stderr); |
b4e1fa2c | 550 | fprintf(stderr, |
d8778560 | 551 | " InnoDB: Error: combined size of log files" |
b4e1fa2c AM |
552 | - " must be < 4 GB\n"); |
553 | + " must be < 4 GB on 32-bit systems\n"); | |
554 | ||
555 | return(DB_ERROR); | |
556 | } | |
29ffd636 | 557 | @@ -1595,7 +1597,7 @@ |
b4e1fa2c AM |
558 | |
559 | for (i = 0; i < srv_n_data_files; i++) { | |
560 | #ifndef __WIN__ | |
561 | - if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) { | |
562 | + if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) { | |
d8778560 | 563 | ut_print_timestamp(stderr); |
b4e1fa2c | 564 | fprintf(stderr, |
d8778560 | 565 | " InnoDB: Error: file size must be < 4 GB" |