Merge lp:~percona-dev/percona-server/5.1.46-separate_doublewrite into lp:~percona-dev/percona-server/5.1.46

Proposed by Yasufumi Kinoshita
Status: Merged
Approved by: Vadim Tkachenko
Approved revision: no longer in the source branch.
Merged at revision: 7
Proposed branch: lp:~percona-dev/percona-server/5.1.46-separate_doublewrite
Merge into: lp:~percona-dev/percona-server/5.1.46
Diff against target: 2019 lines (+1246/-249)
20 files modified
innodb_adjust_defaults.patch (+5/-5)
innodb_fast_checksum.patch (+9/-9)
innodb_files_extend.patch (+10/-10)
innodb_fix_misc.patch (+1/-1)
innodb_pass_corrupt_table.patch (+35/-35)
innodb_separate_doublewrite.patch (+958/-0)
innodb_show_sys_tables.patch (+2/-2)
innodb_split_buf_pool_mutex.patch (+0/-56)
mysql-test.diff (+38/-0)
mysql-test/percona_innodb_doublewrite_path-master.opt (+1/-0)
mysql-test/percona_innodb_doublewrite_path.result (+4/-0)
mysql-test/percona_innodb_doublewrite_path.test (+2/-0)
mysql-test/percona_show_temp_tables.result (+58/-0)
mysql-test/percona_show_temp_tables.test (+65/-0)
mysql-test/percona_xtradb_admin_command.result (+6/-0)
mysql-test/percona_xtradb_admin_command.test (+3/-0)
mysql-test/percona_xtradb_bug317074.result (+4/-0)
mysql-test/percona_xtradb_bug317074.test (+44/-0)
series (+1/-0)
show_temp_51.patch (+0/-131)
To merge this branch: bzr merge lp:~percona-dev/percona-server/5.1.46-separate_doublewrite
Reviewer Review Type Date Requested Status
Vadim Tkachenko Approve
Review via email: mp+25676@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vadim Tkachenko (vadim-tk) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innodb_adjust_defaults.patch'
2--- innodb_adjust_defaults.patch 2010-05-07 02:07:22 +0000
3+++ innodb_adjust_defaults.patch 2010-05-20 10:47:30 +0000
4@@ -1,7 +1,7 @@
5 diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
6 --- a/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 16:39:14.000000000 +0900
7 +++ b/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 16:43:26.000000000 +0900
8-@@ -10912,7 +10912,7 @@
9+@@ -10915,7 +10915,7 @@
10 static MYSQL_SYSVAR_BOOL(fast_recovery, innobase_fast_recovery,
11 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
12 "Enable to use speed hack of recovery avoiding flush list sorting.",
13@@ -10,7 +10,7 @@
14
15 static MYSQL_SYSVAR_BOOL(recovery_stats, innobase_recovery_stats,
16 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
17-@@ -10922,7 +10922,7 @@
18+@@ -10925,7 +10925,7 @@
19 static MYSQL_SYSVAR_ULONG(use_purge_thread, srv_use_purge_thread,
20 PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
21 "Number of purge devoted threads. #### over 1 is EXPERIMENTAL ####",
22@@ -19,7 +19,7 @@
23
24 static MYSQL_SYSVAR_BOOL(overwrite_relay_log_info, innobase_overwrite_relay_log_info,
25 PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
26-@@ -11022,7 +11022,7 @@
27+@@ -11025,7 +11025,7 @@
28 static MYSQL_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
29 PLUGIN_VAR_NOCMDARG,
30 "Attempt flushing dirty pages to avoid IO bursts at checkpoints.",
31@@ -28,7 +28,7 @@
32
33 static MYSQL_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
34 PLUGIN_VAR_RQCMDARG,
35-@@ -11247,7 +11247,7 @@
36+@@ -11255,7 +11255,7 @@
37 static MYSQL_SYSVAR_ULONG(ibuf_active_contract, srv_ibuf_active_contract,
38 PLUGIN_VAR_RQCMDARG,
39 "Enable/Disable active_contract of insert buffer. 0:disable 1:enable",
40@@ -37,7 +37,7 @@
41
42 static MYSQL_SYSVAR_ULONG(ibuf_accel_rate, srv_ibuf_accel_rate,
43 PLUGIN_VAR_RQCMDARG,
44-@@ -11325,8 +11325,8 @@
45+@@ -11333,8 +11333,8 @@
46 };
47 static MYSQL_SYSVAR_ENUM(adaptive_checkpoint, srv_adaptive_checkpoint,
48 PLUGIN_VAR_RQCMDARG,
49
50=== modified file 'innodb_fast_checksum.patch'
51--- innodb_fast_checksum.patch 2010-05-07 02:07:22 +0000
52+++ innodb_fast_checksum.patch 2010-05-20 10:47:30 +0000
53@@ -88,7 +88,7 @@
54 diff -ruN a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c
55 --- a/storage/innodb_plugin/buf/buf0flu.c 2010-04-30 14:13:25.000000000 +0900
56 +++ b/storage/innodb_plugin/buf/buf0flu.c 2010-04-30 16:32:03.000000000 +0900
57-@@ -937,7 +937,9 @@
58+@@ -939,7 +939,9 @@
59
60 mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
61 srv_use_checksums
62@@ -155,7 +155,7 @@
63 diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
64 --- a/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 16:31:04.000000000 +0900
65 +++ b/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 16:32:03.000000000 +0900
66-@@ -185,6 +185,7 @@
67+@@ -186,6 +186,7 @@
68 #endif /* UNIV_LOG_ARCHIVE */
69 static my_bool innobase_use_doublewrite = TRUE;
70 static my_bool innobase_use_checksums = TRUE;
71@@ -163,7 +163,7 @@
72 static my_bool innobase_extra_undoslots = FALSE;
73 static my_bool innobase_fast_recovery = FALSE;
74 static my_bool innobase_recovery_stats = TRUE;
75-@@ -2324,6 +2325,7 @@
76+@@ -2327,6 +2328,7 @@
77
78 srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite;
79 srv_use_checksums = (ibool) innobase_use_checksums;
80@@ -171,7 +171,7 @@
81
82 #ifdef HAVE_LARGE_PAGES
83 if ((os_use_large_pages = (ibool) my_use_large_pages))
84-@@ -10849,6 +10851,15 @@
85+@@ -10852,6 +10854,15 @@
86 "Disable with --skip-innodb-checksums.",
87 NULL, NULL, TRUE);
88
89@@ -187,7 +187,7 @@
90 static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
91 PLUGIN_VAR_READONLY,
92 "The common part for InnoDB table spaces.",
93-@@ -11318,6 +11329,7 @@
94+@@ -11326,6 +11337,7 @@
95 MYSQL_SYSVAR(autoextend_increment),
96 MYSQL_SYSVAR(buffer_pool_size),
97 MYSQL_SYSVAR(checksums),
98@@ -198,9 +198,9 @@
99 diff -ruN a/storage/innodb_plugin/handler/innodb_patch_info.h b/storage/innodb_plugin/handler/innodb_patch_info.h
100 --- a/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 16:31:04.000000000 +0900
101 +++ b/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 16:32:03.000000000 +0900
102-@@ -44,5 +44,6 @@
103- {"innodb_relax_table_creation","Relax limitation of column size at table creation as builtin InnoDB.","","http://www.percona.com/docs/wiki/percona-xtradb"},
104+@@ -45,5 +45,6 @@
105 {"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"},
106+ {"innodb_separate_doublewrite","Add option 'innodb_doublewrite_path' to separate doublewrite dedicated tablespace","","http://www.percona.com/docs/wiki/percona-xtradb"},
107 {"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"},
108 +{"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
109 {NULL, NULL, NULL, NULL}
110@@ -234,7 +234,7 @@
111 diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h
112 --- a/storage/innodb_plugin/include/srv0srv.h 2010-04-30 16:31:04.000000000 +0900
113 +++ b/storage/innodb_plugin/include/srv0srv.h 2010-04-30 16:32:03.000000000 +0900
114-@@ -209,6 +209,7 @@
115+@@ -211,6 +211,7 @@
116
117 extern ibool srv_use_doublewrite_buf;
118 extern ibool srv_use_checksums;
119@@ -294,7 +294,7 @@
120 diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
121 --- a/storage/innodb_plugin/srv/srv0srv.c 2010-04-30 16:31:04.000000000 +0900
122 +++ b/storage/innodb_plugin/srv/srv0srv.c 2010-04-30 16:32:03.000000000 +0900
123-@@ -378,6 +378,7 @@
124+@@ -380,6 +380,7 @@
125
126 UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
127 UNIV_INTERN ibool srv_use_checksums = TRUE;
128
129=== modified file 'innodb_files_extend.patch'
130--- innodb_files_extend.patch 2010-05-07 02:07:22 +0000
131+++ innodb_files_extend.patch 2010-05-20 10:47:30 +0000
132@@ -81,7 +81,7 @@
133 static my_bool innobase_thread_concurrency_timer_based;
134 static long long innobase_buffer_pool_size, innobase_log_file_size;
135
136-@@ -2017,6 +2019,36 @@
137+@@ -2018,6 +2020,36 @@
138 }
139 #endif /* UNIV_DEBUG */
140
141@@ -118,7 +118,7 @@
142 #ifndef MYSQL_SERVER
143 innodb_overwrite_relay_log_info = FALSE;
144 #endif
145-@@ -6899,9 +6931,9 @@
146+@@ -6902,9 +6934,9 @@
147 | DICT_TF_COMPACT
148 | DICT_TF_FORMAT_ZIP
149 << DICT_TF_FORMAT_SHIFT;
150@@ -131,7 +131,7 @@
151 }
152 }
153
154-@@ -10860,6 +10892,11 @@
155+@@ -10863,6 +10895,11 @@
156 "#### Attention: The checksum is not compatible for normal or disabled version! ####",
157 NULL, NULL, FALSE);
158
159@@ -143,7 +143,7 @@
160 static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
161 PLUGIN_VAR_READONLY,
162 "The common part for InnoDB table spaces.",
163-@@ -11325,6 +11362,7 @@
164+@@ -11333,6 +11370,7 @@
165 NULL, NULL, 0, 0, 1, 0);
166
167 static struct st_mysql_sys_var* innobase_system_variables[]= {
168@@ -154,8 +154,8 @@
169 diff -ruN a/storage/innodb_plugin/handler/innodb_patch_info.h b/storage/innodb_plugin/handler/innodb_patch_info.h
170 --- a/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 16:34:36.000000000 +0900
171 +++ b/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 16:35:09.000000000 +0900
172-@@ -45,5 +45,6 @@
173- {"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"},
174+@@ -46,5 +46,6 @@
175+ {"innodb_separate_doublewrite","Add option 'innodb_doublewrite_path' to separate doublewrite dedicated tablespace","","http://www.percona.com/docs/wiki/percona-xtradb"},
176 {"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"},
177 {"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
178 +{"innodb_files_extend","allow >4GB transaction log files, and can vary universal page size of datafiles","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
179@@ -230,7 +230,7 @@
180 diff -ruN a/storage/innodb_plugin/include/trx0sys.h b/storage/innodb_plugin/include/trx0sys.h
181 --- a/storage/innodb_plugin/include/trx0sys.h 2010-04-29 16:43:16.000000000 +0900
182 +++ b/storage/innodb_plugin/include/trx0sys.h 2010-04-30 16:35:09.000000000 +0900
183-@@ -489,9 +489,9 @@
184+@@ -514,9 +514,9 @@
185 /** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */
186 #define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344
187
188@@ -363,7 +363,7 @@
189 diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
190 --- a/storage/innodb_plugin/srv/srv0srv.c 2010-04-30 16:34:37.000000000 +0900
191 +++ b/storage/innodb_plugin/srv/srv0srv.c 2010-04-30 16:35:09.000000000 +0900
192-@@ -216,6 +216,10 @@
193+@@ -218,6 +218,10 @@
194 UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX;
195 UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX;
196
197@@ -377,7 +377,7 @@
198 diff -ruN a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
199 --- a/storage/innodb_plugin/srv/srv0start.c 2010-04-30 16:31:04.000000000 +0900
200 +++ b/storage/innodb_plugin/srv/srv0start.c 2010-04-30 16:35:09.000000000 +0900
201-@@ -1347,10 +1347,12 @@
202+@@ -1497,10 +1497,12 @@
203 }
204 #endif /* UNIV_LOG_ARCHIVE */
205
206@@ -392,7 +392,7 @@
207
208 return(DB_ERROR);
209 }
210-@@ -1359,7 +1361,7 @@
211+@@ -1509,7 +1511,7 @@
212
213 for (i = 0; i < srv_n_data_files; i++) {
214 #ifndef __WIN__
215
216=== modified file 'innodb_fix_misc.patch'
217--- innodb_fix_misc.patch 2010-04-30 10:17:55 +0000
218+++ innodb_fix_misc.patch 2010-05-20 10:47:30 +0000
219@@ -35,7 +35,7 @@
220 diff -ruN a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
221 --- a/storage/innodb_plugin/srv/srv0start.c 2010-04-30 16:37:05.000000000 +0900
222 +++ b/storage/innodb_plugin/srv/srv0start.c 2010-04-30 16:41:46.000000000 +0900
223-@@ -1815,7 +1815,7 @@
224+@@ -1974,7 +1974,7 @@
225 if (srv_print_verbose_log) {
226 ut_print_timestamp(stderr);
227 fprintf(stderr,
228
229=== modified file 'innodb_pass_corrupt_table.patch'
230--- innodb_pass_corrupt_table.patch 2010-05-07 02:07:22 +0000
231+++ innodb_pass_corrupt_table.patch 2010-05-20 10:47:30 +0000
232@@ -369,7 +369,7 @@
233 {
234 enum buf_io_fix io_type;
235 const ibool uncompressed = (buf_page_get_state(bpage)
236-@@ -3428,6 +3447,7 @@
237+@@ -3429,6 +3448,7 @@
238 (ulong) bpage->offset);
239 }
240
241@@ -377,11 +377,11 @@
242 /* From version 3.23.38 up we store the page checksum
243 to the 4 first bytes of the page end lsn field */
244
245-@@ -3469,6 +3489,19 @@
246+@@ -3470,6 +3490,19 @@
247 REFMAN "forcing-recovery.html\n"
248 "InnoDB: about forcing recovery.\n", stderr);
249
250-+ if (srv_pass_corrupt_table && bpage->space > 0
251++ if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)
252 + && bpage->space < SRV_LOG_SPACE_FIRST_ID) {
253 + fprintf(stderr,
254 + "InnoDB: space %lu will be treated as corrupt.\n",
255@@ -397,7 +397,7 @@
256 if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
257 fputs("InnoDB: Ending processing because of"
258 " a corrupt database page.\n",
259-@@ -3476,6 +3509,7 @@
260+@@ -3477,6 +3510,7 @@
261 exit(1);
262 }
263 }
264@@ -405,7 +405,7 @@
265
266 if (recv_recovery_is_on()) {
267 /* Pages must be uncompressed for crash recovery. */
268-@@ -3485,8 +3519,11 @@
269+@@ -3486,8 +3520,11 @@
270
271 if (uncompressed && !recv_no_ibuf_operations) {
272 ibuf_merge_or_delete_for_page(
273@@ -420,7 +420,7 @@
274 diff -ruN a/storage/innodb_plugin/buf/buf0rea.c b/storage/innodb_plugin/buf/buf0rea.c
275 --- a/storage/innodb_plugin/buf/buf0rea.c 2010-04-30 15:48:30.000000000 +0900
276 +++ b/storage/innodb_plugin/buf/buf0rea.c 2010-04-30 15:49:22.000000000 +0900
277-@@ -187,12 +187,19 @@
278+@@ -189,12 +189,19 @@
279 sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
280 ((buf_block_t*) bpage)->frame, bpage, trx);
281 }
282@@ -499,7 +499,7 @@
283 + dict_table_t* table;
284 + ibool found = FALSE;
285 +
286-+ ut_a(space_id != 0 && space_id < SRV_LOG_SPACE_FIRST_ID);
287++ ut_a(!trx_sys_sys_space(space_id) && space_id < SRV_LOG_SPACE_FIRST_ID);
288 +
289 + if (need_mutex)
290 + mutex_enter(&(dict_sys->mutex));
291@@ -759,7 +759,7 @@
292 diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
293 --- a/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 15:46:35.000000000 +0900
294 +++ b/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 16:23:01.000000000 +0900
295-@@ -3640,6 +3640,12 @@
296+@@ -3643,6 +3643,12 @@
297 DBUG_RETURN(1);
298 }
299
300@@ -772,7 +772,7 @@
301 /* Create buffers for packing the fields of a record. Why
302 table->reclength did not work here? Obviously, because char
303 fields when packed actually became 1 byte longer, when we also
304-@@ -3667,6 +3673,19 @@
305+@@ -3670,6 +3676,19 @@
306 /* Get pointer to a table object in InnoDB dictionary cache */
307 ib_table = dict_table_get(norm_name, TRUE);
308
309@@ -792,7 +792,7 @@
310 if (NULL == ib_table) {
311 if (is_part && retries < 10) {
312 ++retries;
313-@@ -4829,6 +4848,10 @@
314+@@ -4832,6 +4851,10 @@
315
316 ha_statistic_increment(&SSV::ha_write_count);
317
318@@ -803,7 +803,7 @@
319 if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
320 table->timestamp_field->set_time();
321
322-@@ -5046,6 +5069,10 @@
323+@@ -5049,6 +5072,10 @@
324 func_exit:
325 innobase_active_small();
326
327@@ -814,7 +814,7 @@
328 DBUG_RETURN(error_result);
329 }
330
331-@@ -5222,6 +5249,10 @@
332+@@ -5225,6 +5252,10 @@
333
334 ha_statistic_increment(&SSV::ha_update_count);
335
336@@ -825,7 +825,7 @@
337 if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
338 table->timestamp_field->set_time();
339
340-@@ -5311,6 +5342,10 @@
341+@@ -5314,6 +5345,10 @@
342
343 innobase_active_small();
344
345@@ -836,7 +836,7 @@
346 DBUG_RETURN(error);
347 }
348
349-@@ -5332,6 +5367,10 @@
350+@@ -5335,6 +5370,10 @@
351
352 ha_statistic_increment(&SSV::ha_delete_count);
353
354@@ -847,7 +847,7 @@
355 if (!prebuilt->upd_node) {
356 row_get_prebuilt_update_vector(prebuilt);
357 }
358-@@ -5358,6 +5397,10 @@
359+@@ -5361,6 +5400,10 @@
360
361 innobase_active_small();
362
363@@ -858,7 +858,7 @@
364 DBUG_RETURN(error);
365 }
366
367-@@ -5597,6 +5640,10 @@
368+@@ -5600,6 +5643,10 @@
369
370 ha_statistic_increment(&SSV::ha_read_key_count);
371
372@@ -869,7 +869,7 @@
373 index = prebuilt->index;
374
375 if (UNIV_UNLIKELY(index == NULL)) {
376-@@ -5659,6 +5706,10 @@
377+@@ -5662,6 +5709,10 @@
378 ret = DB_UNSUPPORTED;
379 }
380
381@@ -880,7 +880,7 @@
382 switch (ret) {
383 case DB_SUCCESS:
384 error = 0;
385-@@ -5769,6 +5820,10 @@
386+@@ -5772,6 +5823,10 @@
387 {
388 DBUG_ENTER("change_active_index");
389
390@@ -891,7 +891,7 @@
391 ut_ad(user_thd == ha_thd());
392 ut_a(prebuilt->trx == thd_to_trx(user_thd));
393
394-@@ -5859,6 +5914,10 @@
395+@@ -5862,6 +5917,10 @@
396
397 DBUG_ENTER("general_fetch");
398
399@@ -902,7 +902,7 @@
400 ut_a(prebuilt->trx == thd_to_trx(user_thd));
401
402 innodb_srv_conc_enter_innodb(prebuilt->trx);
403-@@ -5868,6 +5927,10 @@
404+@@ -5871,6 +5930,10 @@
405
406 innodb_srv_conc_exit_innodb(prebuilt->trx);
407
408@@ -913,7 +913,7 @@
409 switch (ret) {
410 case DB_SUCCESS:
411 error = 0;
412-@@ -7100,6 +7163,10 @@
413+@@ -7103,6 +7166,10 @@
414 DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND);
415 }
416
417@@ -924,7 +924,7 @@
418 /* Truncate the table in InnoDB */
419
420 error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
421-@@ -7108,6 +7175,10 @@
422+@@ -7111,6 +7178,10 @@
423 goto fallback;
424 }
425
426@@ -935,7 +935,7 @@
427 error = convert_error_code_to_mysql(error, prebuilt->table->flags,
428 NULL);
429
430-@@ -7615,6 +7686,16 @@
431+@@ -7618,6 +7689,16 @@
432 return(ranges + (double) rows / (double) total_rows * time_for_scan);
433 }
434
435@@ -952,7 +952,7 @@
436 /*********************************************************************//**
437 Returns statistics information of the table to the MySQL interpreter,
438 in various fields of the handle object. */
439-@@ -7666,9 +7747,9 @@
440+@@ -7669,9 +7750,9 @@
441 ib_table = prebuilt->table;
442
443 if (flag & HA_STATUS_TIME) {
444@@ -965,7 +965,7 @@
445 /* In sql_show we call with this flag: update
446 then statistics so that they are up-to-date */
447
448-@@ -7909,6 +7990,10 @@
449+@@ -7912,6 +7993,10 @@
450 THD* thd, /*!< in: connection thread handle */
451 HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
452 {
453@@ -976,7 +976,7 @@
454 /* Serialize ANALYZE TABLE inside InnoDB, see
455 Bug#38996 Race condition in ANALYZE TABLE */
456 pthread_mutex_lock(&analyze_mutex);
457-@@ -7918,6 +8003,10 @@
458+@@ -7921,6 +8006,10 @@
459
460 pthread_mutex_unlock(&analyze_mutex);
461
462@@ -987,7 +987,7 @@
463 return(0);
464 }
465
466-@@ -8099,6 +8188,10 @@
467+@@ -8102,6 +8191,10 @@
468 my_error(ER_QUERY_INTERRUPTED, MYF(0));
469 }
470
471@@ -998,7 +998,7 @@
472 DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
473 }
474
475-@@ -8826,6 +8919,10 @@
476+@@ -8829,6 +8922,10 @@
477
478 update_thd(thd);
479
480@@ -1009,7 +1009,7 @@
481 if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
482 ut_print_timestamp(stderr);
483 fprintf(stderr,
484-@@ -11208,6 +11305,14 @@
485+@@ -11216,6 +11313,14 @@
486 "Relax limitation of column size at table creation as builtin InnoDB.",
487 NULL, NULL, 0, 0, 1, 0);
488
489@@ -1024,7 +1024,7 @@
490 static struct st_mysql_sys_var* innobase_system_variables[]= {
491 MYSQL_SYSVAR(additional_mem_pool_size),
492 MYSQL_SYSVAR(autoextend_increment),
493-@@ -11287,6 +11392,7 @@
494+@@ -11296,6 +11401,7 @@
495 MYSQL_SYSVAR(io_capacity),
496 MYSQL_SYSVAR(use_purge_thread),
497 MYSQL_SYSVAR(relax_table_creation),
498@@ -1054,10 +1054,10 @@
499 diff -ruN a/storage/innodb_plugin/handler/innodb_patch_info.h b/storage/innodb_plugin/handler/innodb_patch_info.h
500 --- a/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 15:48:30.000000000 +0900
501 +++ b/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 15:49:22.000000000 +0900
502-@@ -43,5 +43,6 @@
503- {"innodb_extend_slow","Extended statistics in slow.log","It is InnoDB-part only. It needs to patch also to mysqld.","http://www.percona.com/docs/wiki/percona-xtradb"},
504+@@ -44,5 +44,6 @@
505 {"innodb_relax_table_creation","Relax limitation of column size at table creation as builtin InnoDB.","","http://www.percona.com/docs/wiki/percona-xtradb"},
506 {"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"},
507+ {"innodb_separate_doublewrite","Add option 'innodb_doublewrite_path' to separate doublewrite dedicated tablespace","","http://www.percona.com/docs/wiki/percona-xtradb"},
508 +{"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"},
509 {NULL, NULL, NULL, NULL}
510 };
511@@ -1219,7 +1219,7 @@
512 diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h
513 --- a/storage/innodb_plugin/include/srv0srv.h 2010-04-30 15:46:35.000000000 +0900
514 +++ b/storage/innodb_plugin/include/srv0srv.h 2010-04-30 15:49:22.000000000 +0900
515-@@ -229,6 +229,7 @@
516+@@ -231,6 +231,7 @@
517
518 extern ulint srv_expand_import;
519 extern ulint srv_relax_table_creation;
520@@ -1280,7 +1280,7 @@
521 diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
522 --- a/storage/innodb_plugin/srv/srv0srv.c 2010-04-30 15:46:35.000000000 +0900
523 +++ b/storage/innodb_plugin/srv/srv0srv.c 2010-04-30 15:49:22.000000000 +0900
524-@@ -398,6 +398,7 @@
525+@@ -400,6 +400,7 @@
526
527 UNIV_INTERN ulint srv_expand_import = 0; /* 0:disable 1:enable */
528 UNIV_INTERN ulint srv_relax_table_creation = 0; /* 0:disable 1:enable */
529@@ -1291,7 +1291,7 @@
530 diff -ruN a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
531 --- a/storage/innodb_plugin/srv/srv0start.c 2010-04-30 14:35:00.000000000 +0900
532 +++ b/storage/innodb_plugin/srv/srv0start.c 2010-04-30 15:49:22.000000000 +0900
533-@@ -1803,6 +1803,13 @@
534+@@ -1962,6 +1962,13 @@
535
536 os_fast_mutex_free(&srv_os_test_mutex);
537
538
539=== added file 'innodb_separate_doublewrite.patch'
540--- innodb_separate_doublewrite.patch 1970-01-01 00:00:00 +0000
541+++ innodb_separate_doublewrite.patch 2010-05-20 10:47:30 +0000
542@@ -0,0 +1,958 @@
543+diff -ruN a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c
544+--- a/storage/innodb_plugin/buf/buf0buf.c 2010-05-19 18:55:03.000000000 +0900
545++++ b/storage/innodb_plugin/buf/buf0buf.c 2010-05-19 18:55:53.000000000 +0900
546+@@ -3398,7 +3398,8 @@
547+ read_space_id = mach_read_from_4(
548+ frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
549+
550+- if (bpage->space == TRX_SYS_SPACE
551++ if ((bpage->space == TRX_SYS_SPACE
552++ || (srv_doublewrite_path && bpage->space == TRX_DOUBLEWRITE_SPACE))
553+ && trx_doublewrite_page_inside(bpage->offset)) {
554+
555+ ut_print_timestamp(stderr);
556+diff -ruN a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c
557+--- a/storage/innodb_plugin/buf/buf0flu.c 2010-05-19 18:55:03.000000000 +0900
558++++ b/storage/innodb_plugin/buf/buf0flu.c 2010-05-19 18:55:53.000000000 +0900
559+@@ -678,7 +678,8 @@
560+ write_buf = trx_doublewrite->write_buf;
561+ i = 0;
562+
563+- fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, 0,
564++ fil_io(OS_FILE_WRITE, TRUE,
565++ (srv_doublewrite_path ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE), 0,
566+ trx_doublewrite->block1, 0, len,
567+ (void*) write_buf, NULL);
568+
569+@@ -715,7 +716,8 @@
570+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
571+ ut_ad(i == TRX_SYS_DOUBLEWRITE_BLOCK_SIZE);
572+
573+- fil_io(OS_FILE_WRITE, TRUE, TRX_SYS_SPACE, 0,
574++ fil_io(OS_FILE_WRITE, TRUE,
575++ (srv_doublewrite_path ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE), 0,
576+ trx_doublewrite->block2, 0, len,
577+ (void*) write_buf, NULL);
578+
579+@@ -745,7 +747,7 @@
580+ flush:
581+ /* Now flush the doublewrite buffer data to disk */
582+
583+- fil_flush(TRX_SYS_SPACE);
584++ fil_flush(srv_doublewrite_path ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE);
585+
586+ /* We know that the writes have been flushed to disk now
587+ and in recovery we will find them in the doublewrite buffer
588+diff -ruN a/storage/innodb_plugin/buf/buf0rea.c b/storage/innodb_plugin/buf/buf0rea.c
589+--- a/storage/innodb_plugin/buf/buf0rea.c 2010-05-19 18:55:03.000000000 +0900
590++++ b/storage/innodb_plugin/buf/buf0rea.c 2010-05-19 18:55:53.000000000 +0900
591+@@ -86,7 +86,9 @@
592+ wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
593+ mode = mode & ~OS_AIO_SIMULATED_WAKE_LATER;
594+
595+- if (trx_doublewrite && space == TRX_SYS_SPACE
596++ if (trx_doublewrite
597++ && (space == TRX_SYS_SPACE
598++ || (srv_doublewrite_path && space == TRX_DOUBLEWRITE_SPACE))
599+ && ( (offset >= trx_doublewrite->block1
600+ && offset < trx_doublewrite->block1
601+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
602+diff -ruN a/storage/innodb_plugin/dict/dict0load.c b/storage/innodb_plugin/dict/dict0load.c
603+--- a/storage/innodb_plugin/dict/dict0load.c 2010-05-19 18:55:03.000000000 +0900
604++++ b/storage/innodb_plugin/dict/dict0load.c 2010-05-19 18:55:53.000000000 +0900
605+@@ -390,7 +390,7 @@
606+
607+ mtr_commit(&mtr);
608+
609+- if (space_id == 0) {
610++ if (trx_sys_sys_space(space_id)) {
611+ /* The system tablespace always exists. */
612+ } else if (in_crash_recovery) {
613+ /* Check that the tablespace (the .ibd file) really
614+@@ -898,7 +898,7 @@
615+ space = mach_read_from_4(field);
616+
617+ /* Check if the tablespace exists and has the right name */
618+- if (space != 0) {
619++ if (!trx_sys_sys_space(space)) {
620+ flags = dict_sys_tables_get_flags(rec);
621+
622+ if (UNIV_UNLIKELY(flags == ULINT_UNDEFINED)) {
623+@@ -951,7 +951,7 @@
624+ }
625+
626+ /* See if the tablespace is available. */
627+- if (space == 0) {
628++ if (trx_sys_sys_space(space)) {
629+ /* The system tablespace is always available. */
630+ } else if (!fil_space_for_table_exists_in_mem(
631+ space, name,
632+diff -ruN a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c
633+--- a/storage/innodb_plugin/fil/fil0fil.c 2010-05-19 18:55:03.000000000 +0900
634++++ b/storage/innodb_plugin/fil/fil0fil.c 2010-05-19 18:55:53.000000000 +0900
635+@@ -673,14 +673,14 @@
636+ size_bytes = (((ib_int64_t)size_high) << 32)
637+ + (ib_int64_t)size_low;
638+ #ifdef UNIV_HOTBACKUP
639+- if (space->id == 0) {
640++ if (trx_sys_sys_space(space->id)) {
641+ node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
642+ os_file_close(node->handle);
643+ goto add_size;
644+ }
645+ #endif /* UNIV_HOTBACKUP */
646+ ut_a(space->purpose != FIL_LOG);
647+- ut_a(space->id != 0);
648++ ut_a(!trx_sys_sys_space(space->id));
649+
650+ if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
651+ fprintf(stderr,
652+@@ -726,7 +726,7 @@
653+ }
654+
655+ if (UNIV_UNLIKELY(space_id == ULINT_UNDEFINED
656+- || space_id == 0)) {
657++ || trx_sys_sys_space(space_id))) {
658+ fprintf(stderr,
659+ "InnoDB: Error: tablespace id %lu"
660+ " in file %s is not sensible\n",
661+@@ -788,7 +788,7 @@
662+
663+ system->n_open++;
664+
665+- if (space->purpose == FIL_TABLESPACE && space->id != 0) {
666++ if (space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(space->id)) {
667+ /* Put the node to the LRU list */
668+ UT_LIST_ADD_FIRST(LRU, system->LRU, node);
669+ }
670+@@ -821,7 +821,7 @@
671+ ut_a(system->n_open > 0);
672+ system->n_open--;
673+
674+- if (node->space->purpose == FIL_TABLESPACE && node->space->id != 0) {
675++ if (node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) {
676+ ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
677+
678+ /* The node is in the LRU list, remove it */
679+@@ -907,7 +907,7 @@
680+ retry:
681+ mutex_enter(&fil_system->mutex);
682+
683+- if (space_id == 0 || space_id >= SRV_LOG_SPACE_FIRST_ID) {
684++ if (trx_sys_sys_space(space_id) || space_id >= SRV_LOG_SPACE_FIRST_ID) {
685+ /* We keep log files and system tablespace files always open;
686+ this is important in preventing deadlocks in this module, as
687+ a page read completion often performs another read from the
688+@@ -1137,7 +1137,7 @@
689+ " tablespace memory cache!\n",
690+ (ulong) space->id);
691+
692+- if (id == 0 || purpose != FIL_TABLESPACE) {
693++ if (trx_sys_sys_space(id) || purpose != FIL_TABLESPACE) {
694+
695+ mutex_exit(&fil_system->mutex);
696+
697+@@ -1529,7 +1529,7 @@
698+ fil_system->max_n_open = max_n_open;
699+
700+ fil_system->modification_counter = 0;
701+- fil_system->max_assigned_id = 0;
702++ fil_system->max_assigned_id = TRX_SYS_SPACE_MAX;
703+
704+ fil_system->tablespace_version = 0;
705+
706+@@ -1556,7 +1556,7 @@
707+ space = UT_LIST_GET_FIRST(fil_system->space_list);
708+
709+ while (space != NULL) {
710+- if (space->purpose != FIL_TABLESPACE || space->id == 0) {
711++ if (space->purpose != FIL_TABLESPACE || trx_sys_sys_space(space->id)) {
712+ node = UT_LIST_GET_FIRST(space->chain);
713+
714+ while (node != NULL) {
715+@@ -3599,7 +3599,7 @@
716+ }
717+
718+ #ifndef UNIV_HOTBACKUP
719+- if (space_id == ULINT_UNDEFINED || space_id == 0) {
720++ if (space_id == ULINT_UNDEFINED || trx_sys_sys_space(space_id)) {
721+ fprintf(stderr,
722+ "InnoDB: Error: tablespace id %lu in file %s"
723+ " is not sensible\n",
724+@@ -3608,7 +3608,7 @@
725+ goto func_exit;
726+ }
727+ #else
728+- if (space_id == ULINT_UNDEFINED || space_id == 0) {
729++ if (space_id == ULINT_UNDEFINED || trx_sys_sys_space(space_id)) {
730+ char* new_path;
731+
732+ fprintf(stderr,
733+@@ -3887,7 +3887,7 @@
734+ space = UT_LIST_GET_FIRST(fil_system->space_list);
735+
736+ while (space) {
737+- if (space->purpose == FIL_TABLESPACE && space->id != 0
738++ if (space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(space->id)
739+ && !space->mark) {
740+ fputs("InnoDB: Warning: tablespace ", stderr);
741+ ut_print_filename(stderr, space->name);
742+@@ -4462,7 +4462,7 @@
743+ }
744+
745+ if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
746+- && space->id != 0) {
747++ && !trx_sys_sys_space(space->id)) {
748+ /* The node is in the LRU list, remove it */
749+
750+ ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
751+@@ -4508,7 +4508,7 @@
752+ }
753+
754+ if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
755+- && node->space->id != 0) {
756++ && !trx_sys_sys_space(node->space->id)) {
757+ /* The node must be put back to the LRU list */
758+ UT_LIST_ADD_FIRST(LRU, system->LRU, node);
759+ }
760+@@ -5121,7 +5121,7 @@
761+ ut_a(fil_node->n_pending == 0);
762+ ut_a(fil_node->open);
763+ ut_a(fil_node->space->purpose == FIL_TABLESPACE);
764+- ut_a(fil_node->space->id != 0);
765++ ut_a(!trx_sys_sys_space(fil_node->space->id));
766+
767+ fil_node = UT_LIST_GET_NEXT(LRU, fil_node);
768+ }
769+diff -ruN a/storage/innodb_plugin/fsp/fsp0fsp.c b/storage/innodb_plugin/fsp/fsp0fsp.c
770+--- a/storage/innodb_plugin/fsp/fsp0fsp.c 2010-04-06 23:07:12.000000000 +0900
771++++ b/storage/innodb_plugin/fsp/fsp0fsp.c 2010-05-19 18:55:53.000000000 +0900
772+@@ -1002,10 +1002,10 @@
773+ flst_init(header + FSP_SEG_INODES_FREE, mtr);
774+
775+ mlog_write_dulint(header + FSP_SEG_ID, ut_dulint_create(0, 1), mtr);
776+- if (space == 0) {
777++ if (space == TRX_SYS_SPACE || space == TRX_DOUBLEWRITE_SPACE) {
778+ fsp_fill_free_list(FALSE, space, header, mtr);
779+ btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,
780+- 0, 0, ut_dulint_add(DICT_IBUF_ID_MIN, space),
781++ space, 0, ut_dulint_add(DICT_IBUF_ID_MIN, space),
782+ dict_ind_redundant, mtr);
783+ } else {
784+ fsp_fill_free_list(TRUE, space, header, mtr);
785+diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
786+--- a/storage/innodb_plugin/handler/ha_innodb.cc 2010-05-19 18:55:03.000000000 +0900
787++++ b/storage/innodb_plugin/handler/ha_innodb.cc 2010-05-19 18:55:53.000000000 +0900
788+@@ -167,6 +167,7 @@
789+ static char* innobase_log_group_home_dir = NULL;
790+ static char* innobase_file_format_name = NULL;
791+ static char* innobase_change_buffering = NULL;
792++static char* innobase_doublewrite_path = NULL;
793+
794+ /* Note: This variable can be set to on/off and any of the supported
795+ file formats in the configuration file, but can only be set to any
796+@@ -2182,6 +2183,8 @@
797+ goto error;
798+ }
799+
800++ srv_doublewrite_path = innobase_doublewrite_path;
801++
802+ srv_extra_undoslots = (ibool) innobase_extra_undoslots;
803+
804+ /* -------------- Log files ---------------------------*/
805+@@ -11060,6 +11063,11 @@
806+ "Path to individual files and their sizes.",
807+ NULL, NULL, NULL);
808+
809++static MYSQL_SYSVAR_STR(doublewrite_path, innobase_doublewrite_path,
810++ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
811++ "Path to special datafile for doublewrite buffer. (default is "": not used) ### ONLY FOR EXPERTS!!! ###",
812++ NULL, NULL, NULL);
813++
814+ static MYSQL_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
815+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
816+ "The AUTOINC lock modes supported by InnoDB: "
817+@@ -11216,6 +11224,7 @@
818+ MYSQL_SYSVAR(commit_concurrency),
819+ MYSQL_SYSVAR(concurrency_tickets),
820+ MYSQL_SYSVAR(data_file_path),
821++ MYSQL_SYSVAR(doublewrite_path),
822+ MYSQL_SYSVAR(data_home_dir),
823+ MYSQL_SYSVAR(doublewrite),
824+ MYSQL_SYSVAR(extra_undoslots),
825+diff -ruN a/storage/innodb_plugin/handler/innodb_patch_info.h b/storage/innodb_plugin/handler/innodb_patch_info.h
826+--- a/storage/innodb_plugin/handler/innodb_patch_info.h 2010-05-19 18:55:03.000000000 +0900
827++++ b/storage/innodb_plugin/handler/innodb_patch_info.h 2010-05-19 19:20:08.000000000 +0900
828+@@ -43,5 +43,6 @@
829+ {"innodb_extend_slow","Extended statistics in slow.log","It is InnoDB-part only. It needs to patch also to mysqld.","http://www.percona.com/docs/wiki/percona-xtradb"},
830+ {"innodb_relax_table_creation","Relax limitation of column size at table creation as builtin InnoDB.","","http://www.percona.com/docs/wiki/percona-xtradb"},
831+ {"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"},
832++{"innodb_separate_doublewrite","Add option 'innodb_doublewrite_path' to separate doublewrite dedicated tablespace","","http://www.percona.com/docs/wiki/percona-xtradb"},
833+ {NULL, NULL, NULL, NULL}
834+ };
835+diff -ruN a/storage/innodb_plugin/include/mtr0log.ic b/storage/innodb_plugin/include/mtr0log.ic
836+--- a/storage/innodb_plugin/include/mtr0log.ic 2010-04-06 23:07:12.000000000 +0900
837++++ b/storage/innodb_plugin/include/mtr0log.ic 2010-05-19 18:55:53.000000000 +0900
838+@@ -201,7 +201,8 @@
839+ the doublewrite buffer is located in pages
840+ FSP_EXTENT_SIZE, ..., 3 * FSP_EXTENT_SIZE - 1 in the
841+ system tablespace */
842+- if (space == TRX_SYS_SPACE
843++ if ((space == TRX_SYS_SPACE
844++ || (srv_doublewrite_path && space == TRX_DOUBLEWRITE_SPACE))
845+ && offset >= FSP_EXTENT_SIZE && offset < 3 * FSP_EXTENT_SIZE) {
846+ if (trx_doublewrite_buf_is_being_created) {
847+ /* Do nothing: we only come to this branch in an
848+diff -ruN a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h
849+--- a/storage/innodb_plugin/include/srv0srv.h 2010-05-19 18:55:03.000000000 +0900
850++++ b/storage/innodb_plugin/include/srv0srv.h 2010-05-19 18:55:53.000000000 +0900
851+@@ -115,6 +115,8 @@
852+ extern ulint* srv_data_file_sizes;
853+ extern ulint* srv_data_file_is_raw_partition;
854+
855++extern char* srv_doublewrite_path;
856++
857+ extern ibool srv_extra_undoslots;
858+
859+ extern ibool srv_fast_recovery;
860+diff -ruN a/storage/innodb_plugin/include/trx0sys.h b/storage/innodb_plugin/include/trx0sys.h
861+--- a/storage/innodb_plugin/include/trx0sys.h 2010-05-19 18:55:03.000000000 +0900
862++++ b/storage/innodb_plugin/include/trx0sys.h 2010-05-19 18:55:53.000000000 +0900
863+@@ -124,6 +124,22 @@
864+ /*=============*/
865+ ulint space, /*!< in: space */
866+ ulint page_no);/*!< in: page number */
867++/***************************************************************//**
868++Checks if a space is the system tablespaces.
869++@return TRUE if system tablespace */
870++UNIV_INLINE
871++ibool
872++trx_sys_sys_space(
873++/*==============*/
874++ ulint space); /*!< in: space */
875++/***************************************************************//**
876++Checks if a space is the doublewrite tablespace.
877++@return TRUE if doublewrite tablespace */
878++UNIV_INLINE
879++ibool
880++trx_sys_doublewrite_space(
881++/*======================*/
882++ ulint space); /*!< in: space */
883+ /*****************************************************************//**
884+ Creates and initializes the central memory structures for the transaction
885+ system. This is called when the database is started. */
886+@@ -137,6 +153,13 @@
887+ void
888+ trx_sys_create(void);
889+ /*================*/
890++/*****************************************************************//**
891++Creates and initializes the dummy transaction system page for tablespace. */
892++UNIV_INTERN
893++void
894++trx_sys_dummy_create(
895++/*=================*/
896++ ulint space);
897+ /*********************************************************************
898+ Create extra rollback segments when create_new_db */
899+ UNIV_INTERN
900+@@ -446,6 +469,8 @@
901+
902+ /* Space id and page no where the trx system file copy resides */
903+ #define TRX_SYS_SPACE 0 /* the SYSTEM tablespace */
904++#define TRX_DOUBLEWRITE_SPACE 1 /* the doublewrite buffer tablespace if used */
905++#define TRX_SYS_SPACE_MAX 9 /* reserved max space id for system tablespaces */
906+ #include "fsp0fsp.h"
907+ #define TRX_SYS_PAGE_NO FSP_TRX_SYS_PAGE_NO
908+
909+diff -ruN a/storage/innodb_plugin/include/trx0sys.ic b/storage/innodb_plugin/include/trx0sys.ic
910+--- a/storage/innodb_plugin/include/trx0sys.ic 2010-04-06 23:07:13.000000000 +0900
911++++ b/storage/innodb_plugin/include/trx0sys.ic 2010-05-19 18:55:53.000000000 +0900
912+@@ -71,6 +71,40 @@
913+ }
914+
915+ /***************************************************************//**
916++Checks if a space is the system tablespaces.
917++@return TRUE if system tablespace */
918++UNIV_INLINE
919++ibool
920++trx_sys_sys_space(
921++/*==============*/
922++ ulint space) /*!< in: space */
923++{
924++ if (srv_doublewrite_path) {
925++ /* several spaces are reserved */
926++ return((ibool)(space <= TRX_SYS_SPACE_MAX));
927++ } else {
928++ return((ibool)(space == TRX_SYS_SPACE));
929++ }
930++}
931++
932++/***************************************************************//**
933++Checks if a space is the doublewrite tablespace.
934++@return TRUE if doublewrite tablespace */
935++UNIV_INLINE
936++ibool
937++trx_sys_doublewrite_space(
938++/*======================*/
939++ ulint space) /*!< in: space */
940++{
941++ if (srv_doublewrite_path) {
942++ /* doublewrite buffer is separated */
943++ return((ibool)(space == TRX_DOUBLEWRITE_SPACE));
944++ } else {
945++ return((ibool)(space == TRX_SYS_SPACE));
946++ }
947++}
948++
949++/***************************************************************//**
950+ Gets the pointer in the nth slot of the rseg array.
951+ @return pointer to rseg object, NULL if slot not in use */
952+ UNIV_INLINE
953+diff -ruN a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c
954+--- a/storage/innodb_plugin/row/row0mysql.c 2010-05-19 18:55:03.000000000 +0900
955++++ b/storage/innodb_plugin/row/row0mysql.c 2010-05-19 18:55:53.000000000 +0900
956+@@ -3297,7 +3297,7 @@
957+ /* Do not drop possible .ibd tablespace if something went
958+ wrong: we do not want to delete valuable data of the user */
959+
960+- if (err == DB_SUCCESS && space_id > 0) {
961++ if (err == DB_SUCCESS && !trx_sys_sys_space(space_id)) {
962+ if (!fil_space_for_table_exists_in_mem(space_id,
963+ name_or_path,
964+ is_temp, FALSE,
965+diff -ruN a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c
966+--- a/storage/innodb_plugin/srv/srv0srv.c 2010-05-19 18:55:03.000000000 +0900
967++++ b/storage/innodb_plugin/srv/srv0srv.c 2010-05-19 18:55:53.000000000 +0900
968+@@ -145,6 +145,8 @@
969+ /* size in database pages */
970+ UNIV_INTERN ulint* srv_data_file_sizes = NULL;
971+
972++UNIV_INTERN char* srv_doublewrite_path = NULL;
973++
974+ UNIV_INTERN ibool srv_extra_undoslots = FALSE;
975+
976+ UNIV_INTERN ibool srv_fast_recovery = FALSE;
977+diff -ruN a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
978+--- a/storage/innodb_plugin/srv/srv0start.c 2010-05-19 18:55:03.000000000 +0900
979++++ b/storage/innodb_plugin/srv/srv0start.c 2010-05-19 18:55:53.000000000 +0900
980+@@ -711,6 +711,7 @@
981+ /*======================*/
982+ ibool* create_new_db, /*!< out: TRUE if new database should be
983+ created */
984++ ibool* create_new_doublewrite_file,
985+ #ifdef UNIV_LOG_ARCHIVE
986+ ulint* min_arch_log_no,/*!< out: min of archived log
987+ numbers in data files */
988+@@ -743,6 +744,7 @@
989+ *sum_of_new_sizes = 0;
990+
991+ *create_new_db = FALSE;
992++ *create_new_doublewrite_file = FALSE;
993+
994+ srv_normalize_path_for_win(srv_data_home);
995+
996+@@ -975,6 +977,153 @@
997+ srv_data_file_is_raw_partition[i] != 0);
998+ }
999+
1000++ /* special file for doublewrite buffer */
1001++ if (srv_doublewrite_path)
1002++ {
1003++ ulint dirnamelen;
1004++
1005++ srv_normalize_path_for_win(srv_doublewrite_path);
1006++ dirnamelen = strlen(srv_data_home);
1007++
1008++ fprintf(stderr,
1009++ "InnoDB: Notice: innodb_doublewrite_path is specified.\n"
1010++ "InnoDB: This is for expert only. Don't use if you don't understand what is it 'WELL'.\n"
1011++ "InnoDB: ### Don't specify older file than the last checkpoint ###\n"
1012++ "InnoDB: otherwise the older doublewrite buffer will break your data during recovery!\n");
1013++
1014++ ut_a(dirnamelen + strlen(srv_doublewrite_path)
1015++ < (sizeof name) - 1);
1016++ memcpy(name, srv_data_home, dirnamelen);
1017++ /* Add a path separator if needed. */
1018++ if (dirnamelen && name[dirnamelen - 1] != SRV_PATH_SEPARATOR) {
1019++ name[dirnamelen++] = SRV_PATH_SEPARATOR;
1020++ }
1021++
1022++ strcpy(name + dirnamelen, srv_doublewrite_path);
1023++
1024++ /* First we try to create the file: if it already
1025++ exists, ret will get value FALSE */
1026++
1027++ files[i] = os_file_create(name, OS_FILE_CREATE,
1028++ OS_FILE_NORMAL,
1029++ OS_DATA_FILE, &ret);
1030++
1031++ if (ret == FALSE && os_file_get_last_error(FALSE)
1032++ != OS_FILE_ALREADY_EXISTS
1033++#ifdef UNIV_AIX
1034++ /* AIX 5.1 after security patch ML7 may have
1035++ errno set to 0 here, which causes our function
1036++ to return 100; work around that AIX problem */
1037++ && os_file_get_last_error(FALSE) != 100
1038++#endif
1039++ ) {
1040++ fprintf(stderr,
1041++ "InnoDB: Error in creating"
1042++ " or opening %s\n",
1043++ name);
1044++
1045++ return(DB_ERROR);
1046++ }
1047++
1048++ if (ret == FALSE) {
1049++ /* We open the data file */
1050++
1051++ files[i] = os_file_create(
1052++ name, OS_FILE_OPEN, OS_FILE_NORMAL,
1053++ OS_DATA_FILE, &ret);
1054++
1055++ if (!ret) {
1056++ fprintf(stderr,
1057++ "InnoDB: Error in opening %s\n", name);
1058++ os_file_get_last_error(TRUE);
1059++
1060++ return(DB_ERROR);
1061++ }
1062++
1063++ ret = os_file_get_size(files[i], &size, &size_high);
1064++ ut_a(ret);
1065++ /* Round size downward to megabytes */
1066++
1067++ rounded_size_pages
1068++ = (size / (1024 * 1024) + 4096 * size_high)
1069++ << (20 - UNIV_PAGE_SIZE_SHIFT);
1070++
1071++ if (rounded_size_pages != TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9) {
1072++
1073++ fprintf(stderr,
1074++ "InnoDB: Warning: doublewrite buffer file %s"
1075++ " is of a different size\n"
1076++ "InnoDB: %lu pages"
1077++ " (rounded down to MB)\n"
1078++ "InnoDB: than intended size"
1079++ " %lu pages...\n",
1080++ name,
1081++ (ulong) rounded_size_pages,
1082++ (ulong) TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9);
1083++ }
1084++
1085++ fil_read_flushed_lsn_and_arch_log_no(
1086++ files[i], one_opened,
1087++#ifdef UNIV_LOG_ARCHIVE
1088++ min_arch_log_no, max_arch_log_no,
1089++#endif /* UNIV_LOG_ARCHIVE */
1090++ min_flushed_lsn, max_flushed_lsn);
1091++ one_opened = TRUE;
1092++ } else {
1093++ /* We created the data file and now write it full of
1094++ zeros */
1095++
1096++ *create_new_doublewrite_file = TRUE;
1097++
1098++ ut_print_timestamp(stderr);
1099++ fprintf(stderr,
1100++ " InnoDB: Doublewrite buffer file %s did not"
1101++ " exist: new to be created\n",
1102++ name);
1103++
1104++ if (*create_new_db == FALSE) {
1105++ fprintf(stderr,
1106++ "InnoDB: Warning: Previous version's ibdata files may cause crash.\n"
1107++ " If you use that, please use the ibdata files of this version.\n");
1108++ }
1109++
1110++ ut_print_timestamp(stderr);
1111++ fprintf(stderr,
1112++ " InnoDB: Setting file %s size to %lu MB\n",
1113++ name,
1114++ (ulong) ((TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9)
1115++ >> (20 - UNIV_PAGE_SIZE_SHIFT)));
1116++
1117++ fprintf(stderr,
1118++ "InnoDB: Database physically writes the"
1119++ " file full: wait...\n");
1120++
1121++ ret = os_file_set_size(
1122++ name, files[i],
1123++ srv_calc_low32(TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9),
1124++ srv_calc_high32(TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9));
1125++
1126++ if (!ret) {
1127++ fprintf(stderr,
1128++ "InnoDB: Error in creating %s:"
1129++ " probably out of disk space\n", name);
1130++
1131++ return(DB_ERROR);
1132++ }
1133++ }
1134++
1135++ ret = os_file_close(files[i]);
1136++ ut_a(ret);
1137++
1138++ fil_space_create(name, TRX_DOUBLEWRITE_SPACE, 0, FIL_TABLESPACE);
1139++
1140++ ut_a(fil_validate());
1141++
1142++ fil_node_create(name, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9, TRX_DOUBLEWRITE_SPACE, FALSE);
1143++
1144++ i++;
1145++ }
1146++
1147+ ios = 0;
1148+
1149+ mutex_create(&ios_mutex, SYNC_NO_ORDER_CHECK);
1150+@@ -993,6 +1142,7 @@
1151+ {
1152+ buf_pool_t* ret;
1153+ ibool create_new_db;
1154++ ibool create_new_doublewrite_file;
1155+ ibool log_file_created;
1156+ ibool log_created = FALSE;
1157+ ibool log_opened = FALSE;
1158+@@ -1381,6 +1531,7 @@
1159+ }
1160+
1161+ err = open_or_create_data_files(&create_new_db,
1162++ &create_new_doublewrite_file,
1163+ #ifdef UNIV_LOG_ARCHIVE
1164+ &min_arch_log_no, &max_arch_log_no,
1165+ #endif /* UNIV_LOG_ARCHIVE */
1166+@@ -1497,6 +1648,14 @@
1167+
1168+ trx_sys_file_format_init();
1169+
1170++ if (create_new_doublewrite_file) {
1171++ mtr_start(&mtr);
1172++ fsp_header_init(TRX_DOUBLEWRITE_SPACE, TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 9, &mtr);
1173++ mtr_commit(&mtr);
1174++
1175++ trx_sys_dummy_create(TRX_DOUBLEWRITE_SPACE);
1176++ }
1177++
1178+ if (create_new_db) {
1179+ mtr_start(&mtr);
1180+ fsp_header_init(0, sum_of_new_sizes, &mtr);
1181+diff -ruN a/storage/innodb_plugin/trx/trx0sys.c b/storage/innodb_plugin/trx/trx0sys.c
1182+--- a/storage/innodb_plugin/trx/trx0sys.c 2010-05-19 18:55:03.000000000 +0900
1183++++ b/storage/innodb_plugin/trx/trx0sys.c 2010-05-19 18:55:53.000000000 +0900
1184+@@ -402,6 +402,149 @@
1185+
1186+ goto start_again;
1187+ }
1188++
1189++ if (srv_doublewrite_path) {
1190++ /* the same doublewrite buffer to TRX_SYS_SPACE should exist.
1191++ check and create if not exist.*/
1192++
1193++ mtr_start(&mtr);
1194++ trx_doublewrite_buf_is_being_created = TRUE;
1195++
1196++ block = buf_page_get(TRX_DOUBLEWRITE_SPACE, 0, TRX_SYS_PAGE_NO,
1197++ RW_X_LATCH, &mtr);
1198++ buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
1199++
1200++ doublewrite = buf_block_get_frame(block) + TRX_SYS_DOUBLEWRITE;
1201++
1202++ if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
1203++ == TRX_SYS_DOUBLEWRITE_MAGIC_N) {
1204++ /* The doublewrite buffer has already been created:
1205++ just read in some numbers */
1206++
1207++ mtr_commit(&mtr);
1208++ } else {
1209++ fprintf(stderr,
1210++ "InnoDB: Doublewrite buffer not found in the doublewrite file:"
1211++ " creating new\n");
1212++
1213++ if (buf_pool_get_curr_size()
1214++ < ((2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
1215++ + FSP_EXTENT_SIZE / 2 + 100)
1216++ * UNIV_PAGE_SIZE)) {
1217++ fprintf(stderr,
1218++ "InnoDB: Cannot create doublewrite buffer:"
1219++ " you must\n"
1220++ "InnoDB: increase your buffer pool size.\n"
1221++ "InnoDB: Cannot continue operation.\n");
1222++
1223++ exit(1);
1224++ }
1225++
1226++ block2 = fseg_create(TRX_DOUBLEWRITE_SPACE, TRX_SYS_PAGE_NO,
1227++ TRX_SYS_DOUBLEWRITE
1228++ + TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
1229++
1230++ /* fseg_create acquires a second latch on the page,
1231++ therefore we must declare it: */
1232++
1233++ buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK);
1234++
1235++ if (block2 == NULL) {
1236++ fprintf(stderr,
1237++ "InnoDB: Cannot create doublewrite buffer:"
1238++ " you must\n"
1239++ "InnoDB: increase your tablespace size.\n"
1240++ "InnoDB: Cannot continue operation.\n");
1241++
1242++ /* We exit without committing the mtr to prevent
1243++ its modifications to the database getting to disk */
1244++
1245++ exit(1);
1246++ }
1247++
1248++ fseg_header = buf_block_get_frame(block)
1249++ + TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG;
1250++ prev_page_no = 0;
1251++
1252++ for (i = 0; i < 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
1253++ + FSP_EXTENT_SIZE / 2; i++) {
1254++ page_no = fseg_alloc_free_page(fseg_header,
1255++ prev_page_no + 1,
1256++ FSP_UP, &mtr);
1257++ if (page_no == FIL_NULL) {
1258++ fprintf(stderr,
1259++ "InnoDB: Cannot create doublewrite"
1260++ " buffer: you must\n"
1261++ "InnoDB: increase your"
1262++ " tablespace size.\n"
1263++ "InnoDB: Cannot continue operation.\n"
1264++ );
1265++
1266++ exit(1);
1267++ }
1268++
1269++ /* We read the allocated pages to the buffer pool;
1270++ when they are written to disk in a flush, the space
1271++ id and page number fields are also written to the
1272++ pages. When we at database startup read pages
1273++ from the doublewrite buffer, we know that if the
1274++ space id and page number in them are the same as
1275++ the page position in the tablespace, then the page
1276++ has not been written to in doublewrite. */
1277++
1278++ new_block = buf_page_get(TRX_DOUBLEWRITE_SPACE, 0, page_no,
1279++ RW_X_LATCH, &mtr);
1280++ buf_block_dbg_add_level(new_block,
1281++ SYNC_NO_ORDER_CHECK);
1282++
1283++ if (i == FSP_EXTENT_SIZE / 2) {
1284++ ut_a(page_no == FSP_EXTENT_SIZE);
1285++ mlog_write_ulint(doublewrite
1286++ + TRX_SYS_DOUBLEWRITE_BLOCK1,
1287++ page_no, MLOG_4BYTES, &mtr);
1288++ mlog_write_ulint(doublewrite
1289++ + TRX_SYS_DOUBLEWRITE_REPEAT
1290++ + TRX_SYS_DOUBLEWRITE_BLOCK1,
1291++ page_no, MLOG_4BYTES, &mtr);
1292++ } else if (i == FSP_EXTENT_SIZE / 2
1293++ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
1294++ ut_a(page_no == 2 * FSP_EXTENT_SIZE);
1295++ mlog_write_ulint(doublewrite
1296++ + TRX_SYS_DOUBLEWRITE_BLOCK2,
1297++ page_no, MLOG_4BYTES, &mtr);
1298++ mlog_write_ulint(doublewrite
1299++ + TRX_SYS_DOUBLEWRITE_REPEAT
1300++ + TRX_SYS_DOUBLEWRITE_BLOCK2,
1301++ page_no, MLOG_4BYTES, &mtr);
1302++ } else if (i > FSP_EXTENT_SIZE / 2) {
1303++ ut_a(page_no == prev_page_no + 1);
1304++ }
1305++
1306++ prev_page_no = page_no;
1307++ }
1308++
1309++ mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC,
1310++ TRX_SYS_DOUBLEWRITE_MAGIC_N,
1311++ MLOG_4BYTES, &mtr);
1312++ mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC
1313++ + TRX_SYS_DOUBLEWRITE_REPEAT,
1314++ TRX_SYS_DOUBLEWRITE_MAGIC_N,
1315++ MLOG_4BYTES, &mtr);
1316++
1317++ mlog_write_ulint(doublewrite
1318++ + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
1319++ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
1320++ MLOG_4BYTES, &mtr);
1321++ mtr_commit(&mtr);
1322++
1323++ /* Flush the modified pages to disk and make a checkpoint */
1324++ log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
1325++
1326++ fprintf(stderr, "InnoDB: Doublewrite buffer created in the doublewrite file\n");
1327++ }
1328++
1329++ trx_doublewrite_buf_is_being_created = FALSE;
1330++ }
1331+ }
1332+
1333+ /****************************************************************//**
1334+@@ -425,10 +568,19 @@
1335+ ulint source_page_no;
1336+ byte* page;
1337+ byte* doublewrite;
1338++ ulint doublewrite_space_id;
1339+ ulint space_id;
1340+ ulint page_no;
1341+ ulint i;
1342+
1343++ doublewrite_space_id = (srv_doublewrite_path ? TRX_DOUBLEWRITE_SPACE : TRX_SYS_SPACE);
1344++
1345++ if (srv_doublewrite_path) {
1346++ fprintf(stderr,
1347++ "InnoDB: doublewrite file '%s' is used.\n",
1348++ srv_doublewrite_path);
1349++ }
1350++
1351+ /* We do the file i/o past the buffer pool */
1352+
1353+ unaligned_read_buf = ut_malloc(2 * UNIV_PAGE_SIZE);
1354+@@ -437,7 +589,7 @@
1355+ /* Read the trx sys header to check if we are using the doublewrite
1356+ buffer */
1357+
1358+- fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, TRX_SYS_PAGE_NO, 0,
1359++ fil_io(OS_FILE_READ, TRUE, doublewrite_space_id, 0, TRX_SYS_PAGE_NO, 0,
1360+ UNIV_PAGE_SIZE, read_buf, NULL);
1361+ doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
1362+
1363+@@ -475,10 +627,10 @@
1364+
1365+ /* Read the pages from the doublewrite buffer to memory */
1366+
1367+- fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block1, 0,
1368++ fil_io(OS_FILE_READ, TRUE, doublewrite_space_id, 0, block1, 0,
1369+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
1370+ buf, NULL);
1371+- fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, 0, block2, 0,
1372++ fil_io(OS_FILE_READ, TRUE, doublewrite_space_id, 0, block2, 0,
1373+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
1374+ buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
1375+ NULL);
1376+@@ -534,7 +686,8 @@
1377+ " doublewrite buf.\n",
1378+ (ulong) space_id, (ulong) page_no, (ulong) i);
1379+
1380+- } else if (space_id == TRX_SYS_SPACE
1381++ } else if ((space_id == TRX_SYS_SPACE
1382++ || (srv_doublewrite_path && space_id == TRX_DOUBLEWRITE_SPACE))
1383+ && ((page_no >= block1
1384+ && page_no
1385+ < block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
1386+@@ -982,6 +1135,87 @@
1387+ }
1388+
1389+ /*****************************************************************//**
1390++Creates dummy of the file page for the transaction system. */
1391++static
1392++void
1393++trx_sysf_dummy_create(
1394++/*==================*/
1395++ ulint space,
1396++ mtr_t* mtr)
1397++{
1398++ trx_sysf_t* sys_header;
1399++ ulint slot_no;
1400++ buf_block_t* block;
1401++ page_t* page;
1402++ ulint page_no;
1403++ ulint i;
1404++
1405++ ut_ad(mtr);
1406++
1407++ /* Note that below we first reserve the file space x-latch, and
1408++ then enter the kernel: we must do it in this order to conform
1409++ to the latching order rules. */
1410++
1411++ mtr_x_lock(fil_space_get_latch(space, NULL), mtr);
1412++ mutex_enter(&kernel_mutex);
1413++
1414++ /* Create the trx sys file block in a new allocated file segment */
1415++ block = fseg_create(space, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
1416++ mtr);
1417++ buf_block_dbg_add_level(block, SYNC_TRX_SYS_HEADER);
1418++
1419++ fprintf(stderr, "%lu\n", buf_block_get_page_no(block));
1420++ ut_a(buf_block_get_page_no(block) == TRX_SYS_PAGE_NO);
1421++
1422++ page = buf_block_get_frame(block);
1423++
1424++ mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_TRX_SYS,
1425++ MLOG_2BYTES, mtr);
1426++
1427++ /* Reset the doublewrite buffer magic number to zero so that we
1428++ know that the doublewrite buffer has not yet been created (this
1429++ suppresses a Valgrind warning) */
1430++
1431++ mlog_write_ulint(page + TRX_SYS_DOUBLEWRITE
1432++ + TRX_SYS_DOUBLEWRITE_MAGIC, 0, MLOG_4BYTES, mtr);
1433++
1434++#ifdef UNDEFINED
1435++ /* TODO: REMOVE IT: The bellow is not needed, I think */
1436++ sys_header = trx_sysf_get(mtr);
1437++
1438++ /* Start counting transaction ids from number 1 up */
1439++ mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
1440++ ut_dulint_create(0, 1), mtr);
1441++
1442++ /* Reset the rollback segment slots */
1443++ for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
1444++
1445++ trx_sysf_rseg_set_space(sys_header, i, ULINT_UNDEFINED, mtr);
1446++ trx_sysf_rseg_set_page_no(sys_header, i, FIL_NULL, mtr);
1447++ }
1448++
1449++ /* The remaining area (up to the page trailer) is uninitialized.
1450++ Silence Valgrind warnings about it. */
1451++ UNIV_MEM_VALID(sys_header + (TRX_SYS_RSEGS
1452++ + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
1453++ + TRX_SYS_RSEG_SPACE),
1454++ (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END
1455++ - (TRX_SYS_RSEGS
1456++ + TRX_SYS_N_RSEGS * TRX_SYS_RSEG_SLOT_SIZE
1457++ + TRX_SYS_RSEG_SPACE))
1458++ + page - sys_header);
1459++
1460++ /* Create the first rollback segment in the SYSTEM tablespace */
1461++ page_no = trx_rseg_header_create(space, 0, ULINT_MAX, &slot_no,
1462++ mtr);
1463++ ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
1464++ ut_a(page_no != FIL_NULL);
1465++#endif
1466++
1467++ mutex_exit(&kernel_mutex);
1468++}
1469++
1470++/*****************************************************************//**
1471+ Creates and initializes the central memory structures for the transaction
1472+ system. This is called when the database is started. */
1473+ UNIV_INTERN
1474+@@ -1087,6 +1321,26 @@
1475+ trx_sys_init_at_db_start();
1476+ }
1477+
1478++/*****************************************************************//**
1479++Creates and initializes the dummy transaction system page for tablespace. */
1480++UNIV_INTERN
1481++void
1482++trx_sys_dummy_create(
1483++/*=================*/
1484++ ulint space)
1485++{
1486++ mtr_t mtr;
1487++
1488++ /* This function is only for doublewrite file for now */
1489++ ut_a(space == TRX_DOUBLEWRITE_SPACE);
1490++
1491++ mtr_start(&mtr);
1492++
1493++ trx_sysf_dummy_create(space, &mtr);
1494++
1495++ mtr_commit(&mtr);
1496++}
1497++
1498+ /*********************************************************************
1499+ Create extra rollback segments when create_new_db */
1500+ UNIV_INTERN
1501
1502=== modified file 'innodb_show_sys_tables.patch'
1503--- innodb_show_sys_tables.patch 2010-05-07 02:07:22 +0000
1504+++ innodb_show_sys_tables.patch 2010-05-20 10:47:30 +0000
1505@@ -1,7 +1,7 @@
1506 diff -ruN a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc
1507 --- a/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 16:37:05.000000000 +0900
1508 +++ b/storage/innodb_plugin/handler/ha_innodb.cc 2010-04-30 16:37:36.000000000 +0900
1509-@@ -11475,6 +11475,8 @@
1510+@@ -11484,6 +11484,8 @@
1511 i_s_innodb_table_stats,
1512 i_s_innodb_index_stats,
1513 i_s_innodb_admin_command,
1514@@ -597,7 +597,7 @@
1515 diff -ruN a/storage/innodb_plugin/handler/innodb_patch_info.h b/storage/innodb_plugin/handler/innodb_patch_info.h
1516 --- a/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 16:37:05.000000000 +0900
1517 +++ b/storage/innodb_plugin/handler/innodb_patch_info.h 2010-04-30 16:37:36.000000000 +0900
1518-@@ -46,5 +46,6 @@
1519+@@ -47,5 +47,6 @@
1520 {"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"},
1521 {"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
1522 {"innodb_files_extend","allow >4GB transaction log files, and can vary universal page size of datafiles","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
1523
1524=== modified file 'innodb_split_buf_pool_mutex.patch'
1525--- innodb_split_buf_pool_mutex.patch 2010-04-30 10:17:55 +0000
1526+++ innodb_split_buf_pool_mutex.patch 2010-05-20 10:47:30 +0000
1527@@ -1,59 +1,3 @@
1528-diff -ruN a/mysql-test/suite/innodb/r/innodb_xtradb_bug317074.result b/mysql-test/suite/innodb/r/innodb_xtradb_bug317074.result
1529---- /dev/null 1970-01-01 09:00:00.000000000 +0900
1530-+++ b/mysql-test/suite/innodb/r/innodb_xtradb_bug317074.result 2010-04-29 16:59:37.000000000 +0900
1531-@@ -0,0 +1,4 @@
1532-+SET @old_innodb_file_format=@@innodb_file_format;
1533-+SET @old_innodb_file_per_table=@@innodb_file_per_table;
1534-+SET GLOBAL innodb_file_format='Barracuda';
1535-+SET GLOBAL innodb_file_per_table=ON;
1536-diff -ruN a/mysql-test/suite/innodb/t/innodb_xtradb_bug317074.test b/mysql-test/suite/innodb/t/innodb_xtradb_bug317074.test
1537---- /dev/null 1970-01-01 09:00:00.000000000 +0900
1538-+++ b/mysql-test/suite/innodb/t/innodb_xtradb_bug317074.test 2010-04-29 16:59:37.000000000 +0900
1539-@@ -0,0 +1,44 @@
1540-+-- source include/have_innodb.inc
1541-+
1542-+SET @old_innodb_file_format=@@innodb_file_format;
1543-+SET @old_innodb_file_per_table=@@innodb_file_per_table;
1544-+let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
1545-+SET GLOBAL innodb_file_format='Barracuda';
1546-+SET GLOBAL innodb_file_per_table=ON;
1547-+
1548-+-- disable_query_log
1549-+-- disable_result_log
1550-+
1551-+DROP TABLE IF EXISTS `test1`;
1552-+CREATE TABLE IF NOT EXISTS `test1` (
1553-+ `a` int primary key auto_increment,
1554-+ `b` int default 0,
1555-+ `c` char(100) default 'testtest'
1556-+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
1557-+
1558-+delimiter |;
1559-+CREATE PROCEDURE insert_many(p1 int)
1560-+BEGIN
1561-+SET @x = 0;
1562-+SET @y = 0;
1563-+REPEAT
1564-+ insert into test1 set b=1;
1565-+ SET @x = @x + 1;
1566-+ SET @y = @y + 1;
1567-+ IF @y >= 100 THEN
1568-+ commit;
1569-+ SET @y = 0;
1570-+ END IF;
1571-+UNTIL @x >= p1 END REPEAT;
1572-+END|
1573-+delimiter ;|
1574-+call insert_many(100000);
1575-+DROP PROCEDURE insert_many;
1576-+
1577-+# The bug is hangup at the following statement
1578-+ALTER TABLE test1 ENGINE=MyISAM;
1579-+
1580-+DROP TABLE test1;
1581-+SET GLOBAL innodb_file_format=@old_innodb_file_format;
1582-+SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table;
1583-+eval set global innodb_file_format_check=$innodb_file_format_check_orig;
1584 diff -ruN a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c
1585 --- a/storage/innodb_plugin/btr/btr0cur.c 2010-04-06 23:07:12.000000000 +0900
1586 +++ b/storage/innodb_plugin/btr/btr0cur.c 2010-04-29 16:59:36.000000000 +0900
1587
1588=== added directory 'mysql-test'
1589=== modified file 'mysql-test.diff'
1590--- mysql-test.diff 2010-05-05 04:17:12 +0000
1591+++ mysql-test.diff 2010-05-20 10:47:30 +0000
1592@@ -702,6 +702,44 @@
1593 @@ -1 +1 @@
1594 -innodb-index: InnoDB: Error: table `test`.`t1#1` already exists in InnoDB internal
1595 +#innodb-index: InnoDB: Error: table `test`.`t1#1` already exists in InnoDB internal
1596+diff -ruN a/mysql-test/t/innodb-autoinc-44030.test b/mysql-test/t/innodb-autoinc-44030.test
1597+--- a/mysql-test/t/innodb-autoinc-44030.test 2010-04-06 23:36:14.000000000 +0900
1598++++ b/mysql-test/t/innodb-autoinc-44030.test 2010-05-20 18:50:47.000000000 +0900
1599+@@ -2,6 +2,8 @@
1600+ # embedded server ignores 'delayed', so skip this
1601+ -- source include/not_embedded.inc
1602+
1603++let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
1604++
1605+ --disable_warnings
1606+ drop table if exists t1;
1607+ --enable_warnings
1608+@@ -32,3 +34,6 @@
1609+ INSERT INTO t1 VALUES(null);
1610+ SELECT * FROM t1;
1611+ DROP TABLE t1;
1612++
1613++-- disable_query_log
1614++eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
1615+diff -ruN a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test
1616+--- a/mysql-test/t/innodb-autoinc.test 2010-04-06 23:36:14.000000000 +0900
1617++++ b/mysql-test/t/innodb-autoinc.test 2010-05-20 18:50:06.000000000 +0900
1618+@@ -6,6 +6,8 @@
1619+ drop table if exists t1;
1620+ --enable_warnings
1621+
1622++let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
1623++
1624+ #
1625+ # Bug #34335
1626+ #
1627+@@ -662,3 +664,6 @@
1628+ SELECT * FROM t1;
1629+ SHOW CREATE TABLE t1;
1630+ DROP TABLE t1;
1631++
1632++-- disable_query_log
1633++eval SET GLOBAL innodb_file_format_check=$innodb_file_format_check_orig;
1634 diff -ruN a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
1635 --- a/mysql-test/t/innodb.test 2010-04-06 23:36:15.000000000 +0900
1636 +++ b/mysql-test/t/innodb.test 2010-04-30 17:53:06.000000000 +0900
1637
1638=== added file 'mysql-test/percona_innodb_doublewrite_path-master.opt'
1639--- mysql-test/percona_innodb_doublewrite_path-master.opt 1970-01-01 00:00:00 +0000
1640+++ mysql-test/percona_innodb_doublewrite_path-master.opt 2010-05-20 10:47:30 +0000
1641@@ -0,0 +1,1 @@
1642+--innodb_doublewrite_path=ib_doublewrite
1643
1644=== added file 'mysql-test/percona_innodb_doublewrite_path.result'
1645--- mysql-test/percona_innodb_doublewrite_path.result 1970-01-01 00:00:00 +0000
1646+++ mysql-test/percona_innodb_doublewrite_path.result 2010-05-20 10:47:30 +0000
1647@@ -0,0 +1,4 @@
1648+show variables like 'innodb_doublewrite%';
1649+Variable_name Value
1650+innodb_doublewrite ON
1651+innodb_doublewrite_path ib_doublewrite
1652
1653=== added file 'mysql-test/percona_innodb_doublewrite_path.test'
1654--- mysql-test/percona_innodb_doublewrite_path.test 1970-01-01 00:00:00 +0000
1655+++ mysql-test/percona_innodb_doublewrite_path.test 2010-05-20 10:47:30 +0000
1656@@ -0,0 +1,2 @@
1657+--source include/have_innodb.inc
1658+show variables like 'innodb_doublewrite%';
1659
1660=== added file 'mysql-test/percona_show_temp_tables.result'
1661--- mysql-test/percona_show_temp_tables.result 1970-01-01 00:00:00 +0000
1662+++ mysql-test/percona_show_temp_tables.result 2010-05-20 10:47:30 +0000
1663@@ -0,0 +1,58 @@
1664+drop table if exists t1,t2,t3;
1665+drop database if exists showtemp;
1666+create database if not exists showtemp;
1667+use test;
1668+create temporary table t1(id int);
1669+create temporary table t2(id int);
1670+create temporary table showtemp.t3(id int);
1671+insert into t1 values(10),(20),(30),(40);
1672+insert into showtemp.t3 values(999);
1673+show temporary tables;
1674+Temp_tables_in_test
1675+t2
1676+t1
1677+show temporary tables from test;
1678+Temp_tables_in_test
1679+t2
1680+t1
1681+show temporary tables in showtemp;
1682+Temp_tables_in_showtemp
1683+t3
1684+select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
1685+table_schema table_name engine table_rows
1686+showtemp t3 MyISAM 1
1687+test t2 MyISAM 0
1688+test t1 MyISAM 4
1689+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1690+table_schema table_name engine table_rows
1691+showtemp t3 MyISAM 1
1692+test t2 MyISAM 0
1693+test t1 MyISAM 4
1694+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
1695+table_schema table_name engine table_rows
1696+showtemp t3 MyISAM 1
1697+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
1698+table_schema table_name engine table_rows
1699+drop table if exists showtemp.t2;
1700+create temporary table t1(id int);
1701+create temporary table showtemp.t2(id int);
1702+show temporary tables;
1703+Temp_tables_in_test
1704+t1
1705+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1706+table_schema table_name engine table_rows
1707+showtemp t2 MyISAM 0
1708+test t1 MyISAM 0
1709+showtemp t3 MyISAM 1
1710+test t2 MyISAM 0
1711+test t1 MyISAM 4
1712+drop table showtemp.t2;
1713+drop table t1;
1714+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1715+table_schema table_name engine table_rows
1716+showtemp t3 MyISAM 1
1717+test t2 MyISAM 0
1718+test t1 MyISAM 4
1719+drop table t1, t2;
1720+drop table showtemp.t3;
1721+drop database showtemp;
1722
1723=== added file 'mysql-test/percona_show_temp_tables.test'
1724--- mysql-test/percona_show_temp_tables.test 1970-01-01 00:00:00 +0000
1725+++ mysql-test/percona_show_temp_tables.test 2010-05-20 10:47:30 +0000
1726@@ -0,0 +1,65 @@
1727+# Uses GRANT commands that usually disabled in embedded server
1728+-- source include/not_embedded.inc
1729+
1730+# Save the initial number of concurrent sessions
1731+--source include/count_sessions.inc
1732+
1733+#
1734+# Test of SHOW [GLOBAL] TEMPORARY TABLES [FROM/IN] DB and
1735+# Information_schema.temporary_tables and global_temporary_tables
1736+#
1737+
1738+connect(stcon1,localhost,root,,test);
1739+connect(stcon2,localhost,root,,test);
1740+
1741+connection stcon1;
1742+
1743+--disable_warnings
1744+drop table if exists t1,t2,t3;
1745+drop database if exists showtemp;
1746+create database if not exists showtemp;
1747+--enable_warnings
1748+
1749+use test;
1750+create temporary table t1(id int);
1751+create temporary table t2(id int);
1752+create temporary table showtemp.t3(id int);
1753+insert into t1 values(10),(20),(30),(40);
1754+insert into showtemp.t3 values(999);
1755+
1756+show temporary tables;
1757+# "Session" is not same value always. mysql-test cannot test it always.
1758+#show global temporary tables;
1759+show temporary tables from test;
1760+show temporary tables in showtemp;
1761+select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
1762+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1763+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
1764+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
1765+
1766+connection stcon2;
1767+
1768+--disable_warnings
1769+drop table if exists showtemp.t2;
1770+--enable_warnings
1771+create temporary table t1(id int);
1772+create temporary table showtemp.t2(id int);
1773+show temporary tables;
1774+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1775+drop table showtemp.t2;
1776+drop table t1;
1777+
1778+disconnect stcon2;
1779+
1780+connection stcon1;
1781+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1782+
1783+drop table t1, t2;
1784+drop table showtemp.t3;
1785+drop database showtemp;
1786+
1787+connection default;
1788+disconnect stcon1;
1789+
1790+# Wait till all disconnects are completed
1791+--source include/wait_until_count_sessions.inc
1792
1793=== added file 'mysql-test/percona_xtradb_admin_command.result'
1794--- mysql-test/percona_xtradb_admin_command.result 1970-01-01 00:00:00 +0000
1795+++ mysql-test/percona_xtradb_admin_command.result 2010-05-20 10:47:30 +0000
1796@@ -0,0 +1,6 @@
1797+select * from information_schema.XTRADB_ADMIN_COMMAND;
1798+result_message
1799+No XTRA_* command in the SQL statement. Please add /*!XTRA_xxxx*/ to the SQL.
1800+select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_HELLO*/;
1801+result_message
1802+Hello!
1803
1804=== added file 'mysql-test/percona_xtradb_admin_command.test'
1805--- mysql-test/percona_xtradb_admin_command.test 1970-01-01 00:00:00 +0000
1806+++ mysql-test/percona_xtradb_admin_command.test 2010-05-20 10:47:30 +0000
1807@@ -0,0 +1,3 @@
1808+--source include/have_innodb.inc
1809+select * from information_schema.XTRADB_ADMIN_COMMAND;
1810+select * from information_schema.XTRADB_ADMIN_COMMAND /*!XTRA_HELLO*/;
1811
1812=== added file 'mysql-test/percona_xtradb_bug317074.result'
1813--- mysql-test/percona_xtradb_bug317074.result 1970-01-01 00:00:00 +0000
1814+++ mysql-test/percona_xtradb_bug317074.result 2010-05-20 10:47:30 +0000
1815@@ -0,0 +1,4 @@
1816+SET @old_innodb_file_format=@@innodb_file_format;
1817+SET @old_innodb_file_per_table=@@innodb_file_per_table;
1818+SET GLOBAL innodb_file_format='Barracuda';
1819+SET GLOBAL innodb_file_per_table=ON;
1820
1821=== added file 'mysql-test/percona_xtradb_bug317074.test'
1822--- mysql-test/percona_xtradb_bug317074.test 1970-01-01 00:00:00 +0000
1823+++ mysql-test/percona_xtradb_bug317074.test 2010-05-20 10:47:30 +0000
1824@@ -0,0 +1,44 @@
1825+-- source include/have_innodb.inc
1826+
1827+SET @old_innodb_file_format=@@innodb_file_format;
1828+SET @old_innodb_file_per_table=@@innodb_file_per_table;
1829+let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
1830+SET GLOBAL innodb_file_format='Barracuda';
1831+SET GLOBAL innodb_file_per_table=ON;
1832+
1833+-- disable_query_log
1834+-- disable_result_log
1835+
1836+DROP TABLE IF EXISTS `test1`;
1837+CREATE TABLE IF NOT EXISTS `test1` (
1838+ `a` int primary key auto_increment,
1839+ `b` int default 0,
1840+ `c` char(100) default 'testtest'
1841+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
1842+
1843+delimiter |;
1844+CREATE PROCEDURE insert_many(p1 int)
1845+BEGIN
1846+SET @x = 0;
1847+SET @y = 0;
1848+REPEAT
1849+ insert into test1 set b=1;
1850+ SET @x = @x + 1;
1851+ SET @y = @y + 1;
1852+ IF @y >= 100 THEN
1853+ commit;
1854+ SET @y = 0;
1855+ END IF;
1856+UNTIL @x >= p1 END REPEAT;
1857+END|
1858+delimiter ;|
1859+call insert_many(100000);
1860+DROP PROCEDURE insert_many;
1861+
1862+# The bug is hangup at the following statement
1863+ALTER TABLE test1 ENGINE=MyISAM;
1864+
1865+DROP TABLE test1;
1866+SET GLOBAL innodb_file_format=@old_innodb_file_format;
1867+SET GLOBAL innodb_file_per_table=@old_innodb_file_per_table;
1868+eval set global innodb_file_format_check=$innodb_file_format_check_orig;
1869
1870=== modified file 'series'
1871--- series 2010-05-05 04:17:12 +0000
1872+++ series 2010-05-20 10:47:30 +0000
1873@@ -27,6 +27,7 @@
1874 innodb_extend_slow.patch
1875 innodb_relax_table_creation.patch
1876 innodb_lru_dump_restore.patch
1877+innodb_separate_doublewrite.patch
1878 innodb_pass_corrupt_table.patch
1879 innodb_fast_checksum.patch
1880 innodb_files_extend.patch
1881
1882=== modified file 'show_temp_51.patch'
1883--- show_temp_51.patch 2010-05-05 04:17:12 +0000
1884+++ show_temp_51.patch 2010-05-20 10:47:30 +0000
1885@@ -1,134 +1,3 @@
1886-diff -ruN a/mysql-test/r/show_temp_tables.result b/mysql-test/r/show_temp_tables.result
1887---- /dev/null 1970-01-01 09:00:00.000000000 +0900
1888-+++ b/mysql-test/r/show_temp_tables.result 2010-04-30 19:46:32.000000000 +0900
1889-@@ -0,0 +1,58 @@
1890-+drop table if exists t1,t2,t3;
1891-+drop database if exists showtemp;
1892-+create database if not exists showtemp;
1893-+use test;
1894-+create temporary table t1(id int);
1895-+create temporary table t2(id int);
1896-+create temporary table showtemp.t3(id int);
1897-+insert into t1 values(10),(20),(30),(40);
1898-+insert into showtemp.t3 values(999);
1899-+show temporary tables;
1900-+Temp_tables_in_test
1901-+t2
1902-+t1
1903-+show temporary tables from test;
1904-+Temp_tables_in_test
1905-+t2
1906-+t1
1907-+show temporary tables in showtemp;
1908-+Temp_tables_in_showtemp
1909-+t3
1910-+select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
1911-+table_schema table_name engine table_rows
1912-+showtemp t3 MyISAM 1
1913-+test t2 MyISAM 0
1914-+test t1 MyISAM 4
1915-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1916-+table_schema table_name engine table_rows
1917-+showtemp t3 MyISAM 1
1918-+test t2 MyISAM 0
1919-+test t1 MyISAM 4
1920-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
1921-+table_schema table_name engine table_rows
1922-+showtemp t3 MyISAM 1
1923-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
1924-+table_schema table_name engine table_rows
1925-+drop table if exists showtemp.t2;
1926-+create temporary table t1(id int);
1927-+create temporary table showtemp.t2(id int);
1928-+show temporary tables;
1929-+Temp_tables_in_test
1930-+t1
1931-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1932-+table_schema table_name engine table_rows
1933-+showtemp t2 MyISAM 0
1934-+test t1 MyISAM 0
1935-+showtemp t3 MyISAM 1
1936-+test t2 MyISAM 0
1937-+test t1 MyISAM 4
1938-+drop table showtemp.t2;
1939-+drop table t1;
1940-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1941-+table_schema table_name engine table_rows
1942-+showtemp t3 MyISAM 1
1943-+test t2 MyISAM 0
1944-+test t1 MyISAM 4
1945-+drop table t1, t2;
1946-+drop table showtemp.t3;
1947-+drop database showtemp;
1948-diff -ruN a/mysql-test/t/show_temp_tables.test b/mysql-test/t/show_temp_tables.test
1949---- /dev/null 1970-01-01 09:00:00.000000000 +0900
1950-+++ b/mysql-test/t/show_temp_tables.test 2010-04-30 19:46:32.000000000 +0900
1951-@@ -0,0 +1,65 @@
1952-+# Uses GRANT commands that usually disabled in embedded server
1953-+-- source include/not_embedded.inc
1954-+
1955-+# Save the initial number of concurrent sessions
1956-+--source include/count_sessions.inc
1957-+
1958-+#
1959-+# Test of SHOW [GLOBAL] TEMPORARY TABLES [FROM/IN] DB and
1960-+# Information_schema.temporary_tables and global_temporary_tables
1961-+#
1962-+
1963-+connect(stcon1,localhost,root,,test);
1964-+connect(stcon2,localhost,root,,test);
1965-+
1966-+connection stcon1;
1967-+
1968-+--disable_warnings
1969-+drop table if exists t1,t2,t3;
1970-+drop database if exists showtemp;
1971-+create database if not exists showtemp;
1972-+--enable_warnings
1973-+
1974-+use test;
1975-+create temporary table t1(id int);
1976-+create temporary table t2(id int);
1977-+create temporary table showtemp.t3(id int);
1978-+insert into t1 values(10),(20),(30),(40);
1979-+insert into showtemp.t3 values(999);
1980-+
1981-+show temporary tables;
1982-+# "Session" is not same value always. mysql-test cannot test it always.
1983-+#show global temporary tables;
1984-+show temporary tables from test;
1985-+show temporary tables in showtemp;
1986-+select table_schema, table_name, engine, table_rows from Information_schema.temporary_tables;
1987-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
1988-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='showtemp';
1989-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables where table_schema='temp';
1990-+
1991-+connection stcon2;
1992-+
1993-+--disable_warnings
1994-+drop table if exists showtemp.t2;
1995-+--enable_warnings
1996-+create temporary table t1(id int);
1997-+create temporary table showtemp.t2(id int);
1998-+show temporary tables;
1999-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
2000-+drop table showtemp.t2;
2001-+drop table t1;
2002-+
2003-+disconnect stcon2;
2004-+
2005-+connection stcon1;
2006-+select table_schema, table_name, engine, table_rows from Information_schema.global_temporary_tables;
2007-+
2008-+drop table t1, t2;
2009-+drop table showtemp.t3;
2010-+drop database showtemp;
2011-+
2012-+connection default;
2013-+disconnect stcon1;
2014-+
2015-+# Wait till all disconnects are completed
2016-+--source include/wait_until_count_sessions.inc
2017 diff -ruN a/sql/mysqld.cc b/sql/mysqld.cc
2018 --- a/sql/mysqld.cc 2010-04-30 19:37:14.000000000 +0900
2019 +++ b/sql/mysqld.cc 2010-04-30 19:46:32.000000000 +0900

Subscribers

No one subscribed via source and target branches