~percona-dev/percona-server/release-5.5.11-20.2-fix-bug-764138

3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
72 by kinoyasu
port Yasufumi patches to 5.5.9
11
@@ -729,7 +729,7 @@
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
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"
72 by kinoyasu
port Yasufumi patches to 5.5.9
20
@@ -3216,7 +3216,7 @@
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
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
 			}
72 by kinoyasu
port Yasufumi patches to 5.5.9
29
@@ -3830,7 +3830,7 @@
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
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"
72 by kinoyasu
port Yasufumi patches to 5.5.9
38
@@ -3850,7 +3850,7 @@
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
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 */
72 by kinoyasu
port Yasufumi patches to 5.5.9
47
@@ -4828,9 +4828,9 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
72 by kinoyasu
port Yasufumi patches to 5.5.9
57
 	ut_ad(fil_validate_skip());
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
63
@@ -656,16 +656,18 @@
64
 				0 for uncompressed pages */
3 by kinoyasu
ported part of Yasufumi patches except for some patches
65
 	ulint	offset)		/*!< in: page offset */
66
 {
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
67
-#ifndef DOXYGEN /* Doxygen gets confused of these */
3 by kinoyasu
ported part of Yasufumi patches except for some patches
68
-# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
69
-		+ (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
70
-#  error
71
-# endif
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
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 */
3 by kinoyasu
ported part of Yasufumi patches except for some patches
78
+//# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET
79
+//		+ (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
80
+//#  error
81
+//# endif
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
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 */
3 by kinoyasu
ported part of Yasufumi patches except for some patches
87
+	ut_a(UNIV_PAGE_SIZE > XDES_ARR_OFFSET + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE);
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
88
+	ut_a(PAGE_ZIP_MIN_SIZE > XDES_ARR_OFFSET + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE);
3 by kinoyasu
ported part of Yasufumi patches except for some patches
89
 	ut_ad(ut_is_2pow(zip_size));
90
 
91
 	if (!zip_size) {
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
92
@@ -1464,12 +1466,12 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
24 by Yasufumi Kinoshita
port Yasufumi's patches to 5.5.8
114
@@ -148,6 +148,9 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
115
 static ulong innobase_write_io_threads;
116
 static long innobase_buffer_pool_instances = 1;
117
 
118
+static ulong innobase_page_size;
9 by kinoyasu
add innodb_log_block_size variable
119
+static ulong innobase_log_block_size;
3 by kinoyasu
ported part of Yasufumi patches except for some patches
120
+
121
 static my_bool innobase_thread_concurrency_timer_based;
122
 static long long innobase_buffer_pool_size, innobase_log_file_size;
123
 
88.2.2 by Yasufumi Kinoshita
Yasufumi patches are ported to 5.5.10; Note: option innodb_stats_method was removed from innodb_stats.patch, because implemented officially. And, bug733317 should be fixed before release
124
@@ -2289,6 +2292,65 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
125
 	}
72 by kinoyasu
port Yasufumi patches to 5.5.9
126
 #endif /* DBUG_OFF */
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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,
60.1.1 by Fred Linhoss
Reworded text strings in patch file print statements
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",
3 by kinoyasu
ported part of Yasufumi patches except for some patches
155
+			innobase_page_size);
156
+		goto error;
157
+	}
158
+
9 by kinoyasu
add innodb_log_block_size variable
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,
60.1.1 by Fred Linhoss
Reworded text strings in patch file print statements
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",
9 by kinoyasu
add innodb_log_block_size variable
183
+			innobase_log_block_size);
184
+		goto error;
185
+	}
186
+
3 by kinoyasu
ported part of Yasufumi patches except for some patches
187
 #ifndef MYSQL_SERVER
188
 	innodb_overwrite_relay_log_info = FALSE;
189
 #endif
88.2.2 by Yasufumi Kinoshita
Yasufumi patches are ported to 5.5.10; Note: option innodb_stats_method was removed from innodb_stats.patch, because implemented officially. And, bug733317 should be fixed before release
190
@@ -7241,9 +7303,9 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
 
88.4.1 by Yasufumi Kinoshita
fix bug733317
203
@@ -11412,6 +11474,16 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
+
9 by kinoyasu
add innodb_log_block_size variable
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
+
3 by kinoyasu
ported part of Yasufumi patches except for some patches
217
 static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
218
   PLUGIN_VAR_READONLY,
219
   "The common part for InnoDB table spaces.",
88.4.1 by Yasufumi Kinoshita
fix bug733317
220
@@ -11913,6 +11985,8 @@
88 by Yasufumi Kinoshita
fix bug721611 (rename variables)
221
   NULL, NULL, 0, &corrupt_table_action_typelib);
3 by kinoyasu
ported part of Yasufumi patches except for some patches
222
 
223
 static struct st_mysql_sys_var* innobase_system_variables[]= {
224
+  MYSQL_SYSVAR(page_size),
9 by kinoyasu
add innodb_log_block_size variable
225
+  MYSQL_SYSVAR(log_block_size),
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
72 by kinoyasu
port Yasufumi patches to 5.5.9
232
@@ -1682,7 +1682,7 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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 */
72 by kinoyasu
port Yasufumi patches to 5.5.9
241
@@ -1778,7 +1778,7 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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];
72 by kinoyasu
port Yasufumi patches to 5.5.9
250
@@ -1786,9 +1786,9 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
266
@@ -72,12 +72,13 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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;
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
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 */
9 by kinoyasu
add innodb_log_block_size variable
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
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
9 by kinoyasu
add innodb_log_block_size variable
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;
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
88.2.2 by Yasufumi Kinoshita
Yasufumi patches are ported to 5.5.10; Note: option innodb_stats_method was removed from innodb_stats.patch, because implemented officially. And, bug733317 should be fixed before release
382
@@ -296,9 +296,13 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
88.2.2 by Yasufumi Kinoshita
Yasufumi patches are ported to 5.5.10; Note: option innodb_stats_method was removed from innodb_stats.patch, because implemented officially. And, bug733317 should be fixed before release
398
@@ -417,7 +421,7 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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)
88.2.2 by Yasufumi Kinoshita
Yasufumi patches are ported to 5.5.10; Note: option innodb_stats_method was removed from innodb_stats.patch, because implemented officially. And, bug733317 should be fixed before release
407
@@ -520,4 +524,6 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
417
@@ -604,7 +604,9 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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",
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
427
@@ -1201,6 +1203,9 @@
9 by kinoyasu
add innodb_log_block_size variable
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
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
437
@@ -1794,9 +1799,7 @@
9 by kinoyasu
add innodb_log_block_size variable
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
 
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
448
@@ -1810,6 +1813,7 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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 {
65 by Yasufumi Kinoshita
eliminate warnings/build problems from XtraDB
456
@@ -1823,7 +1827,9 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
 
9 by kinoyasu
add innodb_log_block_size variable
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;
64 by Yasufumi Kinoshita
merged 5.5.8-reword_print_strings_2
501
@@ -3056,6 +3071,21 @@
9 by kinoyasu
add innodb_log_block_size variable
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) "
58.1.1 by Fred Linhoss
Reworded text strings in patch file print statements.
514
+			"is not equal to innodb_log_block_size.\n"
60.1.1 by Fred Linhoss
Reworded text strings in patch file print statements
515
+			"InnoDB: Error: Suggestion - Recreate log files.\n",
9 by kinoyasu
add innodb_log_block_size variable
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
 
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
72 by kinoyasu
port Yasufumi patches to 5.5.9
550
@@ -241,6 +241,13 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
+
9 by kinoyasu
add innodb_log_block_size variable
558
+/* The log block size */
559
+UNIV_INTERN ulint	srv_log_block_size	= 0;
560
+
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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
88.2.2 by Yasufumi Kinoshita
Yasufumi patches are ported to 5.5.10; Note: option innodb_stats_method was removed from innodb_stats.patch, because implemented officially. And, bug733317 should be fixed before release
567
@@ -1556,11 +1556,13 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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))) {
72 by kinoyasu
port Yasufumi patches to 5.5.9
575
 		ut_print_timestamp(stderr);
3 by kinoyasu
ported part of Yasufumi patches except for some patches
576
 		fprintf(stderr,
72 by kinoyasu
port Yasufumi patches to 5.5.9
577
 			" InnoDB: Error: combined size of log files"
3 by kinoyasu
ported part of Yasufumi patches except for some patches
578
-			" must be < 4 GB\n");
579
+			" must be < 4 GB on 32-bit systems\n");
580
 
581
 		return(DB_ERROR);
582
 	}
88.2.2 by Yasufumi Kinoshita
Yasufumi patches are ported to 5.5.10; Note: option innodb_stats_method was removed from innodb_stats.patch, because implemented officially. And, bug733317 should be fixed before release
583
@@ -1569,7 +1571,7 @@
3 by kinoyasu
ported part of Yasufumi patches except for some patches
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))) {
72 by kinoyasu
port Yasufumi patches to 5.5.9
589
 			ut_print_timestamp(stderr);
3 by kinoyasu
ported part of Yasufumi patches except for some patches
590
 			fprintf(stderr,
72 by kinoyasu
port Yasufumi patches to 5.5.9
591
 				" InnoDB: Error: file size must be < 4 GB"