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