~percona-dev/percona-xtrabackup/win_tests

« back to all changes in this revision

Viewing changes to patches/xtradb55.patch

MergeĀ fromĀ lp:~percona-dev/percona-xtrabackup/port-to-ps-5.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- a/storage/innobase/btr/btr0btr.c    2011-03-15 07:56:04.000000000 -0700
 
2
+++ b/storage/innobase/btr/btr0btr.c    2011-03-15 07:56:47.000000000 -0700
 
3
@@ -120,7 +120,7 @@
 
4
 /**************************************************************//**
 
5
 Gets the root node of a tree and x-latches it.
 
6
 @return        root page, x-latched */
 
7
-static
 
8
+//static
 
9
 buf_block_t*
 
10
 btr_root_block_get(
 
11
 /*===============*/
 
12
@@ -578,7 +578,7 @@
 
13
 /************************************************************//**
 
14
 Returns the child page of a node pointer and x-latches it.
 
15
 @return        child page, x-latched */
 
16
-static
 
17
+//static
 
18
 buf_block_t*
 
19
 btr_node_ptr_get_child(
 
20
 /*===================*/
 
21
--- a/storage/innobase/buf/buf0buf.c    2011-03-15 07:56:04.000000000 -0700
 
22
+++ b/storage/innobase/buf/buf0buf.c    2011-03-15 07:56:47.000000000 -0700
 
23
@@ -609,7 +609,7 @@
 
24
                return(TRUE);
 
25
        }
 
26
 
 
27
-#ifndef UNIV_HOTBACKUP
 
28
+#ifdef UNDEFINED
 
29
        if (recv_lsn_checks_on) {
 
30
                ib_uint64_t     current_lsn;
 
31
 
 
32
@@ -4901,7 +4901,7 @@
 
33
                        recv_recover_page(TRUE, (buf_block_t*) bpage);
 
34
                }
 
35
 
 
36
-               if (uncompressed && !recv_no_ibuf_operations) {
 
37
+               if (uncompressed && !recv_no_ibuf_operations && !srv_fake_write) {
 
38
                        ibuf_merge_or_delete_for_page(
 
39
                                /* Delete possible entries, if bpage is_corrupt */
 
40
                                (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL :
 
41
--- a/storage/innobase/fil/fil0fil.c    2011-03-15 07:56:04.000000000 -0700
 
42
+++ b/storage/innobase/fil/fil0fil.c    2011-03-15 07:56:47.000000000 -0700
 
43
@@ -305,7 +305,7 @@
 
44
 
 
45
 /** The tablespace memory cache. This variable is NULL before the module is
 
46
 initialized. */
 
47
-static fil_system_t*   fil_system      = NULL;
 
48
+fil_system_t*  fil_system      = NULL;
 
49
 
 
50
 #ifdef UNIV_DEBUG
 
51
 /** Try fil_validate() every this many times */
 
52
@@ -344,7 +344,7 @@
 
53
 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
 
54
 mutex. */
 
55
 static
 
56
-void
 
57
+ulint
 
58
 fil_node_prepare_for_io(
 
59
 /*====================*/
 
60
        fil_node_t*     node,   /*!< in: file node */
 
61
@@ -669,7 +669,7 @@
 
62
 Opens a the file of a node of a tablespace. The caller must own the fil_system
 
63
 mutex. */
 
64
 static
 
65
-void
 
66
+ulint
 
67
 fil_node_open_file(
 
68
 /*===============*/
 
69
        fil_node_t*     node,   /*!< in: file node */
 
70
@@ -704,7 +704,14 @@
 
71
                        OS_FILE_READ_ONLY, &success);
 
72
                if (!success) {
 
73
                        /* The following call prints an error message */
 
74
-                       os_file_get_last_error(TRUE);
 
75
+                       if (os_file_get_last_error(TRUE) == OS_FILE_NOT_FOUND)
 
76
+                       {
 
77
+                               ut_print_timestamp(stderr);
 
78
+                               fprintf(stderr,
 
79
+                                       " InnoDB: Warning: cannot open %s\n",
 
80
+                                       node->name);
 
81
+                               return(OS_FILE_NOT_FOUND);
 
82
+                       }
 
83
 
 
84
                        ut_print_timestamp(stderr);
 
85
 
 
86
@@ -794,8 +801,8 @@
 
87
                }
 
88
 
 
89
                if (size_bytes >= 1024 * 1024) {
 
90
-                       /* Truncate the size to whole megabytes. */
 
91
-                       size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);
 
92
+                       /* The size should be exact for after applying .delta */
 
93
+                       //size_bytes = ut_2pow_round(size_bytes, 1024 * 1024);
 
94
                }
 
95
 
 
96
                if (!(flags & DICT_TF_ZSSIZE_MASK)) {
 
97
@@ -846,6 +853,8 @@
 
98
                /* Put the node to the LRU list */
 
99
                UT_LIST_ADD_FIRST(LRU, system->LRU, node);
 
100
        }
 
101
+
 
102
+       return(0);
 
103
 }
 
104
 
 
105
 /**********************************************************************//**
 
106
@@ -1474,7 +1483,12 @@
 
107
                the file yet; the following calls will open it and update the
 
108
                size fields */
 
109
 
 
110
-               fil_node_prepare_for_io(node, fil_system, space);
 
111
+               if (fil_node_prepare_for_io(node, fil_system, space))
 
112
+               {
 
113
+                       mutex_exit(&fil_system->mutex);
 
114
+
 
115
+                       return(0);
 
116
+               }
 
117
                fil_node_complete_io(node, fil_system, OS_FILE_READ);
 
118
        }
 
119
 
 
120
@@ -1526,7 +1540,12 @@
 
121
                the file yet; the following calls will open it and update the
 
122
                size fields */
 
123
 
 
124
-               fil_node_prepare_for_io(node, fil_system, space);
 
125
+               if (fil_node_prepare_for_io(node, fil_system, space))
 
126
+               {
 
127
+                       mutex_exit(&fil_system->mutex);
 
128
+
 
129
+                       return(ULINT_UNDEFINED);
 
130
+               }
 
131
                fil_node_complete_io(node, fil_system, OS_FILE_READ);
 
132
        }
 
133
 
 
134
@@ -2202,7 +2221,7 @@
 
135
                        if (fil_create_new_single_table_tablespace(
 
136
                                    space_id, name, FALSE, flags,
 
137
                                    FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
 
138
-                               ut_error;
 
139
+                               //ut_error;
 
140
                        }
 
141
                }
 
142
 
 
143
@@ -2369,7 +2388,7 @@
 
144
        }
 
145
 
 
146
        if (success) {
 
147
-#ifndef UNIV_HOTBACKUP
 
148
+#ifdef UNDEFINED
 
149
                /* Write a log record about the deletion of the .ibd
 
150
                file, so that ibbackup can replay it in the
 
151
                --apply-log phase. We use a dummy mtr and the familiar
 
152
@@ -2670,7 +2689,7 @@
 
153
 
 
154
        mutex_exit(&fil_system->mutex);
 
155
 
 
156
-#ifndef UNIV_HOTBACKUP
 
157
+#ifdef UNDEFINED
 
158
        if (success) {
 
159
                mtr_t           mtr;
 
160
 
 
161
@@ -2861,7 +2880,7 @@
 
162
 
 
163
        fil_node_create(path, size, space_id, FALSE);
 
164
 
 
165
-#ifndef UNIV_HOTBACKUP
 
166
+#ifdef UNDEFINED
 
167
        {
 
168
                mtr_t           mtr;
 
169
 
 
170
@@ -3116,19 +3135,97 @@
 
171
                      "InnoDB: open the tablespace file ", stderr);
 
172
                ut_print_filename(stderr, filepath);
 
173
                fputs("!\n"
 
174
-                     "InnoDB: Have you moved InnoDB .ibd files around"
 
175
-                     " without using the\n"
 
176
-                     "InnoDB: commands DISCARD TABLESPACE and"
 
177
-                     " IMPORT TABLESPACE?\n"
 
178
-                     "InnoDB: It is also possible that this is"
 
179
-                     " a temporary table #sql...,\n"
 
180
-                     "InnoDB: and MySQL removed the .ibd file for this.\n"
 
181
-                     "InnoDB: Please refer to\n"
 
182
-                     "InnoDB: " REFMAN "innodb-troubleshooting-datadict.html\n"
 
183
-                     "InnoDB: for how to resolve the issue.\n", stderr);
 
184
+                     "InnoDB: It will be removed from data dictionary.\n"
 
185
+                     , stderr);
 
186
 
 
187
                mem_free(filepath);
 
188
 
 
189
+               /* removing from data dictionary */
 
190
+               {
 
191
+                       trx_t*          trx;
 
192
+                       pars_info_t*    info = NULL;
 
193
+
 
194
+                       trx = trx_allocate_for_mysql();
 
195
+
 
196
+                       trx->op_info = "removing invalid table from data dictionary";
 
197
+
 
198
+                       info = pars_info_create();
 
199
+
 
200
+                       pars_info_add_str_literal(info, "table_name", name);
 
201
+
 
202
+                       que_eval_sql(info,
 
203
+                          "PROCEDURE DROP_TABLE_PROC () IS\n"
 
204
+                          "sys_foreign_id CHAR;\n"
 
205
+                          "table_id CHAR;\n"
 
206
+                          "index_id CHAR;\n"
 
207
+                          "foreign_id CHAR;\n"
 
208
+                          "found INT;\n"
 
209
+                          "BEGIN\n"
 
210
+                          "SELECT ID INTO table_id\n"
 
211
+                          "FROM SYS_TABLES\n"
 
212
+                          "WHERE NAME = :table_name\n"
 
213
+                          "LOCK IN SHARE MODE;\n"
 
214
+                          "IF (SQL % NOTFOUND) THEN\n"
 
215
+                          "       RETURN;\n"
 
216
+                          "END IF;\n"
 
217
+                          "found := 1;\n"
 
218
+                          "SELECT ID INTO sys_foreign_id\n"
 
219
+                          "FROM SYS_TABLES\n"
 
220
+                          "WHERE NAME = 'SYS_FOREIGN'\n"
 
221
+                          "LOCK IN SHARE MODE;\n"
 
222
+                          "IF (SQL % NOTFOUND) THEN\n"
 
223
+                          "       found := 0;\n"
 
224
+                          "END IF;\n"
 
225
+                          "IF (:table_name = 'SYS_FOREIGN') THEN\n"
 
226
+                          "       found := 0;\n"
 
227
+                          "END IF;\n"
 
228
+                          "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n"
 
229
+                          "       found := 0;\n"
 
230
+                          "END IF;\n"
 
231
+                          "WHILE found = 1 LOOP\n"
 
232
+                          "       SELECT ID INTO foreign_id\n"
 
233
+                          "       FROM SYS_FOREIGN\n"
 
234
+                          "       WHERE FOR_NAME = :table_name\n"
 
235
+                          "               AND TO_BINARY(FOR_NAME)\n"
 
236
+                          "                 = TO_BINARY(:table_name)\n"
 
237
+                          "               LOCK IN SHARE MODE;\n"
 
238
+                          "       IF (SQL % NOTFOUND) THEN\n"
 
239
+                          "               found := 0;\n"
 
240
+                          "       ELSE\n"
 
241
+                          "               DELETE FROM SYS_FOREIGN_COLS\n"
 
242
+                          "               WHERE ID = foreign_id;\n"
 
243
+                          "               DELETE FROM SYS_FOREIGN\n"
 
244
+                          "               WHERE ID = foreign_id;\n"
 
245
+                          "       END IF;\n"
 
246
+                          "END LOOP;\n"
 
247
+                          "found := 1;\n"
 
248
+                          "WHILE found = 1 LOOP\n"
 
249
+                          "       SELECT ID INTO index_id\n"
 
250
+                          "       FROM SYS_INDEXES\n"
 
251
+                          "       WHERE TABLE_ID = table_id\n"
 
252
+                          "       LOCK IN SHARE MODE;\n"
 
253
+                          "       IF (SQL % NOTFOUND) THEN\n"
 
254
+                          "               found := 0;\n"
 
255
+                          "       ELSE\n"
 
256
+                          "               DELETE FROM SYS_FIELDS\n"
 
257
+                          "               WHERE INDEX_ID = index_id;\n"
 
258
+                          "               DELETE FROM SYS_INDEXES\n"
 
259
+                          "               WHERE ID = index_id\n"
 
260
+                          "               AND TABLE_ID = table_id;\n"
 
261
+                          "       END IF;\n"
 
262
+                          "END LOOP;\n"
 
263
+                          "DELETE FROM SYS_COLUMNS\n"
 
264
+                          "WHERE TABLE_ID = table_id;\n"
 
265
+                          "DELETE FROM SYS_TABLES\n"
 
266
+                          "WHERE ID = table_id;\n"
 
267
+                          "END;\n"
 
268
+                          , FALSE, trx);
 
269
+
 
270
+                       trx_commit_for_mysql(trx);
 
271
+
 
272
+                       trx_free_for_mysql(trx);
 
273
+               }
 
274
+
 
275
                return(FALSE);
 
276
        }
 
277
 
 
278
@@ -3836,7 +3933,7 @@
 
279
        cannot be ok. */
 
280
 
 
281
        size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
 
282
-#ifndef UNIV_HOTBACKUP
 
283
+#ifdef UNDEFINED
 
284
        if (size < FIL_IBD_FILE_INITIAL_SIZE * (lint)UNIV_PAGE_SIZE) {
 
285
                fprintf(stderr,
 
286
                        "InnoDB: Error: the size of single-table tablespace"
 
287
@@ -3977,7 +4074,7 @@
 
288
 idea is to read as much good data as we can and jump over bad data.
 
289
 @return 0 if ok, -1 if error even after the retries, 1 if at the end
 
290
 of the directory */
 
291
-static
 
292
+//static
 
293
 int
 
294
 fil_file_readdir_next_file(
 
295
 /*=======================*/
 
296
@@ -4276,15 +4373,97 @@
 
297
                                "InnoDB: in InnoDB data dictionary"
 
298
                                " has tablespace id %lu,\n"
 
299
                                "InnoDB: but tablespace with that id"
 
300
-                               " or name does not exist. Have\n"
 
301
-                               "InnoDB: you deleted or moved .ibd files?\n"
 
302
-                               "InnoDB: This may also be a table created with"
 
303
-                               " CREATE TEMPORARY TABLE\n"
 
304
-                               "InnoDB: whose .ibd and .frm files"
 
305
-                               " MySQL automatically removed, but the\n"
 
306
-                               "InnoDB: table still exists in the"
 
307
-                               " InnoDB internal data dictionary.\n",
 
308
+                               " or name does not exist. It will be removed from data dictionary.\n"
 
309
+                               ,
 
310
                                (ulong) id);
 
311
+                       mem_free(path);
 
312
+                       mutex_exit(&fil_system->mutex);
 
313
+                       /* removing from data dictionary */
 
314
+                       {
 
315
+                               trx_t*          trx;
 
316
+                               pars_info_t*    info = NULL;
 
317
+
 
318
+                               trx = trx_allocate_for_mysql();
 
319
+
 
320
+                               trx->op_info = "removing invalid table from data dictionary";
 
321
+
 
322
+                               info = pars_info_create();
 
323
+
 
324
+                               pars_info_add_str_literal(info, "table_name", name);
 
325
+
 
326
+                               que_eval_sql(info,
 
327
+                                  "PROCEDURE DROP_TABLE_PROC () IS\n"
 
328
+                                  "sys_foreign_id CHAR;\n"
 
329
+                                  "table_id CHAR;\n"
 
330
+                                  "index_id CHAR;\n"
 
331
+                                  "foreign_id CHAR;\n"
 
332
+                                  "found INT;\n"
 
333
+                                  "BEGIN\n"
 
334
+                                  "SELECT ID INTO table_id\n"
 
335
+                                  "FROM SYS_TABLES\n"
 
336
+                                  "WHERE NAME = :table_name\n"
 
337
+                                  "LOCK IN SHARE MODE;\n"
 
338
+                                  "IF (SQL % NOTFOUND) THEN\n"
 
339
+                                  "       RETURN;\n"
 
340
+                                  "END IF;\n"
 
341
+                                  "found := 1;\n"
 
342
+                                  "SELECT ID INTO sys_foreign_id\n"
 
343
+                                  "FROM SYS_TABLES\n"
 
344
+                                  "WHERE NAME = 'SYS_FOREIGN'\n"
 
345
+                                  "LOCK IN SHARE MODE;\n"
 
346
+                                  "IF (SQL % NOTFOUND) THEN\n"
 
347
+                                  "       found := 0;\n"
 
348
+                                  "END IF;\n"
 
349
+                                  "IF (:table_name = 'SYS_FOREIGN') THEN\n"
 
350
+                                  "       found := 0;\n"
 
351
+                                  "END IF;\n"
 
352
+                                  "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n"
 
353
+                                  "       found := 0;\n"
 
354
+                                  "END IF;\n"
 
355
+                                  "WHILE found = 1 LOOP\n"
 
356
+                                  "       SELECT ID INTO foreign_id\n"
 
357
+                                  "       FROM SYS_FOREIGN\n"
 
358
+                                  "       WHERE FOR_NAME = :table_name\n"
 
359
+                                  "               AND TO_BINARY(FOR_NAME)\n"
 
360
+                                  "                 = TO_BINARY(:table_name)\n"
 
361
+                                  "               LOCK IN SHARE MODE;\n"
 
362
+                                  "       IF (SQL % NOTFOUND) THEN\n"
 
363
+                                  "               found := 0;\n"
 
364
+                                  "       ELSE\n"
 
365
+                                  "               DELETE FROM SYS_FOREIGN_COLS\n"
 
366
+                                  "               WHERE ID = foreign_id;\n"
 
367
+                                  "               DELETE FROM SYS_FOREIGN\n"
 
368
+                                  "               WHERE ID = foreign_id;\n"
 
369
+                                  "       END IF;\n"
 
370
+                                  "END LOOP;\n"
 
371
+                                  "found := 1;\n"
 
372
+                                  "WHILE found = 1 LOOP\n"
 
373
+                                  "       SELECT ID INTO index_id\n"
 
374
+                                  "       FROM SYS_INDEXES\n"
 
375
+                                  "       WHERE TABLE_ID = table_id\n"
 
376
+                                  "       LOCK IN SHARE MODE;\n"
 
377
+                                  "       IF (SQL % NOTFOUND) THEN\n"
 
378
+                                  "               found := 0;\n"
 
379
+                                  "       ELSE\n"
 
380
+                                  "               DELETE FROM SYS_FIELDS\n"
 
381
+                                  "               WHERE INDEX_ID = index_id;\n"
 
382
+                                  "               DELETE FROM SYS_INDEXES\n"
 
383
+                                  "               WHERE ID = index_id\n"
 
384
+                                  "               AND TABLE_ID = table_id;\n"
 
385
+                                  "       END IF;\n"
 
386
+                                  "END LOOP;\n"
 
387
+                                  "DELETE FROM SYS_COLUMNS\n"
 
388
+                                  "WHERE TABLE_ID = table_id;\n"
 
389
+                                  "DELETE FROM SYS_TABLES\n"
 
390
+                                  "WHERE ID = table_id;\n"
 
391
+                                  "END;\n"
 
392
+                                  , FALSE, trx);
 
393
+
 
394
+                               trx_commit_for_mysql(trx);
 
395
+
 
396
+                               trx_free_for_mysql(trx);
 
397
+                       }
 
398
+                       return(FALSE);
 
399
                } else {
 
400
                        ut_print_timestamp(stderr);
 
401
                        fputs("  InnoDB: Error: table ", stderr);
 
402
@@ -4683,7 +4862,7 @@
 
403
 off the LRU list if it is in the LRU list. The caller must hold the fil_sys
 
404
 mutex. */
 
405
 static
 
406
-void
 
407
+ulint
 
408
 fil_node_prepare_for_io(
 
409
 /*====================*/
 
410
        fil_node_t*     node,   /*!< in: file node */
 
411
@@ -4703,10 +4882,13 @@
 
412
        }
 
413
 
 
414
        if (node->open == FALSE) {
 
415
+               ulint   err;
 
416
                /* File is closed: open it */
 
417
                ut_a(node->n_pending == 0);
 
418
 
 
419
-               fil_node_open_file(node, system, space);
 
420
+               err = fil_node_open_file(node, system, space);
 
421
+               if (err)
 
422
+                       return(err);
 
423
        }
 
424
 
 
425
        if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
 
426
@@ -4719,6 +4901,8 @@
 
427
        }
 
428
 
 
429
        node->n_pending++;
 
430
+
 
431
+       return(0);
 
432
 }
 
433
 
 
434
 /********************************************************************//**
 
435
@@ -4920,6 +5104,16 @@
 
436
 
 
437
        ut_ad((mode != OS_AIO_IBUF) || (space->purpose == FIL_TABLESPACE));
 
438
 
 
439
+       if (space->size <= block_offset) {
 
440
+               ulint   actual_size;
 
441
+
 
442
+               mutex_exit(&fil_system->mutex);
 
443
+               fil_extend_space_to_desired_size(&actual_size, space->id,
 
444
+                                                ((block_offset + 1) / 64 + 1) * 64);
 
445
+               mutex_enter(&fil_system->mutex);
 
446
+               /* should retry? but it may safe for xtrabackup for now. */
 
447
+       }
 
448
+
 
449
        node = UT_LIST_GET_FIRST(space->chain);
 
450
 
 
451
        for (;;) {
 
452
--- a/storage/innobase/handler/ha_innodb.cc     2011-03-15 07:53:56.000000000 -0700
 
453
+++ b/storage/innobase/handler/ha_innodb.cc     2011-03-15 07:59:54.000000000 -0700
 
454
@@ -460,13 +460,6 @@
 
455
   "Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
 
456
   NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
 
457
 
 
458
-static MYSQL_THDVAR_ULONG(flush_log_at_trx_commit, PLUGIN_VAR_OPCMDARG,
 
459
-  "Set to 0 (write and flush once per second),"
 
460
-  " 1 (write and flush at each commit)"
 
461
-  " or 2 (write at commit, flush once per second).",
 
462
-  NULL, NULL, 1, 0, 2, 0);
 
463
-
 
464
-
 
465
 static handler *innobase_create_handler(handlerton *hton,
 
466
                                         TABLE_SHARE *table,
 
467
                                         MEM_ROOT *mem_root)
 
468
@@ -958,17 +951,6 @@
 
469
        }
 
470
 }
 
471
 
 
472
-/******************************************************************//**
 
473
-*/
 
474
-extern "C" UNIV_INTERN
 
475
-ulong
 
476
-thd_flush_log_at_trx_commit(
 
477
-/*================================*/
 
478
-       void*   thd)
 
479
-{
 
480
-       return(THDVAR((THD*) thd, flush_log_at_trx_commit));
 
481
-}
 
482
-
 
483
 /********************************************************************//**
 
484
 Obtain the InnoDB transaction of a MySQL thread.
 
485
 @return        reference to transaction pointer */
 
486
@@ -11595,18 +11577,12 @@
 
487
   innodb_file_format_max_validate,
 
488
   innodb_file_format_max_update, "Antelope");
 
489
 
 
490
-/* Changed to the THDVAR */
 
491
-//static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
 
492
-//  PLUGIN_VAR_OPCMDARG,
 
493
-//  "Set to 0 (write and flush once per second),"
 
494
-//  " 1 (write and flush at each commit)"
 
495
-//  " or 2 (write at commit, flush once per second).",
 
496
-//  NULL, NULL, 1, 0, 2, 0);
 
497
-
 
498
-static MYSQL_SYSVAR_BOOL(use_global_flush_log_at_trx_commit, srv_use_global_flush_log_at_trx_commit,
 
499
-  PLUGIN_VAR_NOCMDARG,
 
500
-  "Use global innodb_flush_log_at_trx_commit value. (default: ON).",
 
501
-  NULL, NULL, TRUE);
 
502
+static MYSQL_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
 
503
+  PLUGIN_VAR_OPCMDARG,
 
504
+  "Set to 0 (write and flush once per second),"
 
505
+  " 1 (write and flush at each commit)"
 
506
+  " or 2 (write at commit, flush once per second).",
 
507
+  NULL, NULL, 1, 0, 2, 0);
 
508
 
 
509
 static MYSQL_SYSVAR_STR(flush_method, innobase_file_flush_method,
 
510
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
 
511
@@ -12073,7 +12049,6 @@
 
512
   MYSQL_SYSVAR(file_format_check),
 
513
   MYSQL_SYSVAR(file_format_max),
 
514
   MYSQL_SYSVAR(flush_log_at_trx_commit),
 
515
-  MYSQL_SYSVAR(use_global_flush_log_at_trx_commit),
 
516
   MYSQL_SYSVAR(flush_method),
 
517
   MYSQL_SYSVAR(force_recovery),
 
518
   MYSQL_SYSVAR(locks_unsafe_for_binlog),
 
519
--- a/storage/innobase/ibuf/ibuf0ibuf.c 2011-03-15 07:56:04.000000000 -0700
 
520
+++ b/storage/innobase/ibuf/ibuf0ibuf.c 2011-03-15 07:56:47.000000000 -0700
 
521
@@ -1202,6 +1202,9 @@
 
522
        ut_ad(!recv_no_ibuf_operations);
 
523
        ut_ad(x_latch || mtr == NULL);
 
524
 
 
525
+       if (srv_fake_write)
 
526
+               return(FALSE);
 
527
+
 
528
        if (ibuf_fixed_addr_page(space, zip_size, page_no)) {
 
529
 
 
530
                return(TRUE);
 
531
@@ -2733,6 +2736,9 @@
 
532
        ulint   n_bytes;
 
533
        ulint   n_pag2;
 
534
 
 
535
+       if (srv_fake_write)
 
536
+               return(0);
 
537
+
 
538
        while (sum_pages < n_pages) {
 
539
                n_bytes = ibuf_contract_ext(&n_pag2, sync);
 
540
 
 
541
--- a/storage/innobase/include/ha_prototypes.h  2011-03-15 07:56:04.000000000 -0700
 
542
+++ b/storage/innobase/include/ha_prototypes.h  2011-03-15 07:56:47.000000000 -0700
 
543
@@ -275,12 +275,5 @@
 
544
 /*===================*/
 
545
         void*   thd,   /*!< in: thread handle (THD*) */
 
546
         ulint   value);        /*!< in: time waited for the lock */
 
547
-/******************************************************************//**
 
548
-*/
 
549
-
 
550
-ulong
 
551
-thd_flush_log_at_trx_commit(
 
552
-/*================================*/
 
553
-       void*   thd);
 
554
 
 
555
 #endif
 
556
--- a/storage/innobase/include/srv0srv.h        2011-03-15 07:56:04.000000000 -0700
 
557
+++ b/storage/innobase/include/srv0srv.h        2011-03-15 07:56:47.000000000 -0700
 
558
@@ -148,8 +148,7 @@
 
559
 extern ulint   srv_n_log_files;
 
560
 extern ulint   srv_log_file_size;
 
561
 extern ulint   srv_log_buffer_size;
 
562
-//extern ulong srv_flush_log_at_trx_commit;
 
563
-extern char    srv_use_global_flush_log_at_trx_commit;
 
564
+extern ulong   srv_flush_log_at_trx_commit;
 
565
 extern char    srv_adaptive_flushing;
 
566
 
 
567
 
 
568
@@ -253,6 +252,10 @@
 
569
 extern ulint   srv_dict_size_limit;
 
570
 
 
571
 extern ulint   srv_lazy_drop_table;
 
572
+
 
573
+extern ibool   srv_read_only;
 
574
+extern ibool   srv_fake_write;
 
575
+extern ibool   srv_apply_log_only;
 
576
 /*-------------------------------------------*/
 
577
 
 
578
 extern ulint   srv_n_rows_inserted;
 
579
--- a/storage/innobase/include/srv0start.h      2011-03-15 07:56:04.000000000 -0700
 
580
+++ b/storage/innobase/include/srv0start.h      2011-03-15 07:56:47.000000000 -0700
 
581
@@ -91,6 +91,8 @@
 
582
 /** Log sequence number immediately after startup */
 
583
 extern ib_uint64_t     srv_start_lsn;
 
584
 
 
585
+extern ib_uint64_t     srv_oldest_lsn;
 
586
+
 
587
 #ifdef HAVE_DARWIN_THREADS
 
588
 /** TRUE if the F_FULLFSYNC option is available */
 
589
 extern ibool   srv_have_fullfsync;
 
590
--- a/storage/innobase/log/log0log.c    2011-03-15 07:56:04.000000000 -0700
 
591
+++ b/storage/innobase/log/log0log.c    2011-03-15 07:56:47.000000000 -0700
 
592
@@ -1154,7 +1154,7 @@
 
593
        if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
 
594
            && srv_unix_file_flush_method != SRV_UNIX_ALL_O_DIRECT
 
595
            && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
 
596
-           && thd_flush_log_at_trx_commit(NULL) != 2) {
 
597
+           && srv_flush_log_at_trx_commit != 2) {
 
598
 
 
599
                fil_flush(group->space_id);
 
600
        }
 
601
@@ -1389,7 +1389,7 @@
 
602
 #endif /* UNIV_DEBUG */
 
603
        ulint           unlock;
 
604
 
 
605
-       if (recv_no_ibuf_operations) {
 
606
+       if (recv_no_ibuf_operations || srv_fake_write) {
 
607
                /* Recovery is running and no operations on the log files are
 
608
                allowed yet (the variable name .._no_ibuf_.. is misleading) */
 
609
 
 
610
@@ -3151,6 +3151,7 @@
 
611
        for the 'very fast' shutdown, because the InnoDB layer may have
 
612
        committed or prepared transactions and we don't want to lose them. */
 
613
 
 
614
+       if (!srv_apply_log_only) {
 
615
        if (trx_n_mysql_transactions > 0
 
616
            || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
 
617
 
 
618
@@ -3158,6 +3159,7 @@
 
619
 
 
620
                goto loop;
 
621
        }
 
622
+       }
 
623
 
 
624
        if (srv_fast_shutdown == 2) {
 
625
                /* In this fastest shutdown we do not flush the buffer pool:
 
626
--- a/storage/innobase/log/log0recv.c   2011-03-15 07:56:04.000000000 -0700
 
627
+++ b/storage/innobase/log/log0recv.c   2011-03-15 07:56:47.000000000 -0700
 
628
@@ -42,27 +42,27 @@
 
629
 #include "trx0undo.h"
 
630
 #include "trx0rec.h"
 
631
 #include "fil0fil.h"
 
632
-#ifndef UNIV_HOTBACKUP
 
633
+//#ifndef UNIV_HOTBACKUP
 
634
 # include "buf0rea.h"
 
635
 # include "srv0srv.h"
 
636
 # include "srv0start.h"
 
637
 # include "trx0roll.h"
 
638
 # include "row0merge.h"
 
639
 # include "sync0sync.h"
 
640
-#else /* !UNIV_HOTBACKUP */
 
641
+//#else /* !UNIV_HOTBACKUP */
 
642
 
 
643
 /** This is set to FALSE if the backup was originally taken with the
 
644
 ibbackup --include regexp option: then we do not want to create tables in
 
645
 directories which were not included */
 
646
 UNIV_INTERN ibool      recv_replay_file_ops    = TRUE;
 
647
-#endif /* !UNIV_HOTBACKUP */
 
648
+//#endif /* !UNIV_HOTBACKUP */
 
649
 
 
650
 /** Log records are stored in the hash table in chunks at most of this size;
 
651
 this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
 
652
 #define RECV_DATA_BLOCK_SIZE   (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t))
 
653
 
 
654
 /** Read-ahead area in applying log records to file pages */
 
655
-#define RECV_READ_AHEAD_AREA   32
 
656
+#define RECV_READ_AHEAD_AREA   128
 
657
 
 
658
 /** The recovery system */
 
659
 UNIV_INTERN recv_sys_t*        recv_sys = NULL;
 
660
@@ -631,7 +631,7 @@
 
661
 /***********************************************************************//**
 
662
 Checks the consistency of the checkpoint info
 
663
 @return        TRUE if ok */
 
664
-static
 
665
+//static
 
666
 ibool
 
667
 recv_check_cp_is_consistent(
 
668
 /*========================*/
 
669
@@ -661,7 +661,7 @@
 
670
 /********************************************************//**
 
671
 Looks for the maximum consistent checkpoint from the log groups.
 
672
 @return        error code or DB_SUCCESS */
 
673
-static
 
674
+//static
 
675
 ulint
 
676
 recv_find_max_checkpoint(
 
677
 /*=====================*/
 
678
@@ -850,7 +850,7 @@
 
679
 InnoDB-3.23.52 where the checksum field contains the log block number.
 
680
 @return TRUE if ok, or if the log block may be in the format of InnoDB
 
681
 version predating 3.23.52 */
 
682
-static
 
683
+//static
 
684
 ibool
 
685
 log_block_checksum_is_ok_or_old_format(
 
686
 /*===================================*/
 
687
@@ -2380,7 +2380,7 @@
 
688
                           || type == MLOG_FILE_RENAME
 
689
                           || type == MLOG_FILE_DELETE) {
 
690
                        ut_a(space);
 
691
-#ifdef UNIV_HOTBACKUP
 
692
+//#ifdef UNIV_HOTBACKUP
 
693
                        if (recv_replay_file_ops) {
 
694
 
 
695
                                /* In ibbackup --apply-log, replay an .ibd file
 
696
@@ -2403,7 +2403,7 @@
 
697
                                        ut_error;
 
698
                                }
 
699
                        }
 
700
-#endif
 
701
+//#endif
 
702
                        /* In normal mysqld crash recovery we do not try to
 
703
                        replay file operations */
 
704
 #ifdef UNIV_LOG_LSN_DEBUG
 
705
@@ -2820,8 +2820,11 @@
 
706
 
 
707
                        fprintf(stderr,
 
708
                                "InnoDB: Doing recovery: scanned up to"
 
709
-                               " log sequence number %llu\n",
 
710
-                               *group_scanned_lsn);
 
711
+                               " log sequence number %llu (%lu %%)\n",
 
712
+                               *group_scanned_lsn,
 
713
+                               (ulong) (*group_scanned_lsn - srv_oldest_lsn)
 
714
+                               / (8 * log_group_get_capacity(UT_LIST_GET_FIRST(log_sys->log_groups))/900)
 
715
+                       );
 
716
                }
 
717
        }
 
718
 
 
719
@@ -2936,12 +2939,14 @@
 
720
 
 
721
        if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
 
722
 
 
723
+#ifdef UNDEFINED
 
724
                fprintf(stderr,
 
725
                        "InnoDB: Restoring possible"
 
726
                        " half-written data pages from"
 
727
                        " the doublewrite\n"
 
728
                        "InnoDB: buffer...\n");
 
729
-               trx_sys_doublewrite_init_or_restore_pages(TRUE);
 
730
+#endif
 
731
+               trx_sys_doublewrite_init_or_restore_pages(FALSE);
 
732
        }
 
733
 }
 
734
 
 
735
@@ -3110,6 +3115,7 @@
 
736
                recv_sys->recovered_lsn = checkpoint_lsn;
 
737
 
 
738
                srv_start_lsn = checkpoint_lsn;
 
739
+               srv_oldest_lsn = checkpoint_lsn;
 
740
        }
 
741
 
 
742
        contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn,
 
743
@@ -3475,6 +3481,7 @@
 
744
        that the data dictionary tables will be free of any locks.
 
745
        The data dictionary latch should guarantee that there is at
 
746
        most one data dictionary transaction active at a time. */
 
747
+       if (!srv_apply_log_only)
 
748
        trx_rollback_or_clean_recovered(FALSE);
 
749
 }
 
750
 
 
751
--- a/storage/innobase/os/os0file.c     2011-03-15 07:56:04.000000000 -0700
 
752
+++ b/storage/innobase/os/os0file.c     2011-03-15 07:56:47.000000000 -0700
 
753
@@ -660,7 +660,7 @@
 
754
 }
 
755
 
 
756
 #undef USE_FILE_LOCK
 
757
-#define USE_FILE_LOCK
 
758
+//#define USE_FILE_LOCK
 
759
 #if defined(UNIV_HOTBACKUP) || defined(__WIN__)
 
760
 /* InnoDB Hot Backup does not lock the data files.
 
761
  * On Windows, mandatory locking is used.
 
762
@@ -1428,7 +1428,7 @@
 
763
 #endif
 
764
 #ifdef UNIV_NON_BUFFERED_IO
 
765
 # ifndef UNIV_HOTBACKUP
 
766
-               if (type == OS_LOG_FILE && thd_flush_log_at_trx_commit(NULL) == 2) {
 
767
+               if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
 
768
                        /* Do not use unbuffered i/o to log files because
 
769
                        value 2 denotes that we do not flush the log at every
 
770
                        commit, but only once per second */
 
771
@@ -1444,7 +1444,7 @@
 
772
                attributes = 0;
 
773
 #ifdef UNIV_NON_BUFFERED_IO
 
774
 # ifndef UNIV_HOTBACKUP
 
775
-               if (type == OS_LOG_FILE && thd_flush_log_at_trx_commit(NULL) == 2) {
 
776
+               if (type == OS_LOG_FILE && srv_flush_log_at_trx_commit == 2) {
 
777
                        /* Do not use unbuffered i/o to log files because
 
778
                        value 2 denotes that we do not flush the log at every
 
779
                        commit, but only once per second */
 
780
@@ -1460,8 +1460,9 @@
 
781
                attributes = 0;
 
782
                ut_error;
 
783
        }
 
784
-
 
785
+       share_mode |= FILE_SHARE_WRITE; /* Why? */
 
786
        file = CreateFile((LPCTSTR) name,
 
787
+                         (srv_read_only && create_flag == OPEN_EXISTING) ? GENERIC_READ :
 
788
                          GENERIC_READ | GENERIC_WRITE, /* read and write
 
789
                                                        access */
 
790
                          share_mode,   /* File can be read also by other
 
791
@@ -1520,7 +1521,11 @@
 
792
        if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW
 
793
            || create_mode == OS_FILE_OPEN_RETRY) {
 
794
                mode_str = "OPEN";
 
795
-               create_flag = O_RDWR;
 
796
+               if (srv_read_only) {
 
797
+                       create_flag = O_RDONLY;
 
798
+               } else {
 
799
+                       create_flag = O_RDWR;
 
800
+               }
 
801
        } else if (create_mode == OS_FILE_CREATE) {
 
802
                mode_str = "CREATE";
 
803
                create_flag = O_RDWR | O_CREAT | O_EXCL;
 
804
@@ -2732,6 +2737,9 @@
 
805
        ut_a((offset & 0xFFFFFFFFUL) == offset);
 
806
        ut_a((n & 0xFFFFFFFFUL) == n);
 
807
 
 
808
+       if (srv_fake_write)
 
809
+               return(TRUE);
 
810
+
 
811
        os_n_file_writes++;
 
812
 
 
813
        ut_ad(file);
 
814
@@ -2856,6 +2864,9 @@
 
815
 #else
 
816
        ssize_t ret;
 
817
 
 
818
+       if (srv_fake_write)
 
819
+               return(TRUE);
 
820
+
 
821
        ret = os_file_pwrite(file, buf, n, offset, offset_high);
 
822
 
 
823
        if ((ulint)ret == n) {
 
824
--- a/storage/innobase/os/os0thread.c   2011-03-15 07:56:04.000000000 -0700
 
825
+++ b/storage/innobase/os/os0thread.c   2011-03-15 07:56:47.000000000 -0700
 
826
@@ -266,12 +266,17 @@
 
827
 #ifdef __WIN__
 
828
        Sleep((DWORD) tm / 1000);
 
829
 #else
 
830
+       /* select() simetimes hang up from xtrabackup */
 
831
+       /* change to use usleep() for now */
 
832
+       usleep(tm);
 
833
+/*
 
834
        struct timeval  t;
 
835
 
 
836
        t.tv_sec = tm / 1000000;
 
837
        t.tv_usec = tm % 1000000;
 
838
 
 
839
        select(0, NULL, NULL, NULL, &t);
 
840
+*/
 
841
 #endif
 
842
 }
 
843
 
 
844
--- a/storage/innobase/row/row0merge.c  2011-03-15 07:56:04.000000000 -0700
 
845
+++ b/storage/innobase/row/row0merge.c  2011-03-15 07:56:47.000000000 -0700
 
846
@@ -459,7 +459,9 @@
 
847
        rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext);
 
848
        offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
 
849
 
 
850
-       innobase_rec_to_mysql(dup->table, rec, index, offsets);
 
851
+       //innobase_rec_to_mysql(dup->table, rec, index, offsets);
 
852
+       fprintf(stderr, "InnoDB: Error: row_merge_dup_report() is called.\n");
 
853
+       ut_error;
 
854
 
 
855
        mem_heap_free(heap);
 
856
 }
 
857
@@ -1485,8 +1487,10 @@
 
858
                case 0:
 
859
                        if (UNIV_UNLIKELY
 
860
                            (dict_index_is_unique(index) && !null_eq)) {
 
861
-                               innobase_rec_to_mysql(table, mrec0,
 
862
-                                                     index, offsets0);
 
863
+                               //innobase_rec_to_mysql(table, mrec0,
 
864
+                               //                    index, offsets0);
 
865
+                               fprintf(stderr, "InnoDB: Error: row_merge_blocks() is called.\n");
 
866
+                               ut_error;
 
867
                                mem_heap_free(heap);
 
868
                                return(DB_DUPLICATE_KEY);
 
869
                        }
 
870
@@ -2613,7 +2617,9 @@
 
871
 
 
872
        /* Reset the MySQL row buffer that is used when reporting
 
873
        duplicate keys. */
 
874
-       innobase_rec_reset(table);
 
875
+       //innobase_rec_reset(table);
 
876
+       fprintf(stderr, "InnoDB: Error: row_merge_build_indexes() is called.\n");
 
877
+       ut_error;
 
878
 
 
879
        /* Read clustered index of the table and create files for
 
880
        secondary index entries for merge sort */
 
881
--- a/storage/innobase/srv/srv0srv.c    2011-03-15 07:56:04.000000000 -0700
 
882
+++ b/storage/innobase/srv/srv0srv.c    2011-03-15 07:56:47.000000000 -0700
 
883
@@ -197,8 +197,7 @@
 
884
 UNIV_INTERN ulint      srv_log_file_size       = ULINT_MAX;
 
885
 /* size in database pages */
 
886
 UNIV_INTERN ulint      srv_log_buffer_size     = ULINT_MAX;
 
887
-//UNIV_INTERN ulong    srv_flush_log_at_trx_commit = 1;
 
888
-UNIV_INTERN char       srv_use_global_flush_log_at_trx_commit  = TRUE;
 
889
+UNIV_INTERN ulong      srv_flush_log_at_trx_commit = 1;
 
890
 
 
891
 /* Try to flush dirty pages so as to avoid IO bursts at
 
892
 the checkpoints. */
 
893
@@ -449,6 +448,10 @@
 
894
 UNIV_INTERN ulint      srv_dict_size_limit = 0;
 
895
 
 
896
 UNIV_INTERN ulint      srv_lazy_drop_table = 0;
 
897
+
 
898
+UNIV_INTERN ibool      srv_read_only   = FALSE;
 
899
+UNIV_INTERN ibool      srv_fake_write  = FALSE;
 
900
+UNIV_INTERN ibool      srv_apply_log_only = FALSE;
 
901
 /*-------------------------------------------*/
 
902
 UNIV_INTERN ulong      srv_n_spin_wait_rounds  = 30;
 
903
 UNIV_INTERN ulong      srv_n_free_tickets_to_enter = 500;
 
904
@@ -1148,7 +1151,7 @@
 
905
        }
 
906
 
 
907
        /* Initialize some INFORMATION SCHEMA internal structures */
 
908
-       trx_i_s_cache_init(trx_i_s_cache);
 
909
+       //trx_i_s_cache_init(trx_i_s_cache);
 
910
 }
 
911
 
 
912
 /*********************************************************************//**
 
913
@@ -1159,6 +1162,7 @@
 
914
 /*==========*/
 
915
 {
 
916
        os_fast_mutex_free(&srv_conc_mutex);
 
917
+#ifdef UNDEFINED
 
918
        mem_free(srv_conc_slots);
 
919
        srv_conc_slots = NULL;
 
920
 
 
921
@@ -1172,6 +1176,7 @@
 
922
        srv_mysql_table = NULL;
 
923
 
 
924
        trx_i_s_cache_free(trx_i_s_cache);
 
925
+#endif
 
926
 }
 
927
 
 
928
 /*********************************************************************//**
 
929
@@ -1876,7 +1881,7 @@
 
930
                }
 
931
 
 
932
                /* Record the lock wait time for this thread */
 
933
-               thd_set_lock_wait_time(trx->mysql_thd, diff_time);
 
934
+               //thd_set_lock_wait_time(trx->mysql_thd, diff_time);
 
935
        }
 
936
 
 
937
        if (trx->was_chosen_as_deadlock_victim) {
 
938
--- a/storage/innobase/srv/srv0start.c  2011-03-15 07:56:04.000000000 -0700
 
939
+++ b/storage/innobase/srv/srv0start.c  2011-03-15 07:56:47.000000000 -0700
 
940
@@ -94,6 +94,8 @@
 
941
 /** Log sequence number at shutdown */
 
942
 UNIV_INTERN ib_uint64_t        srv_shutdown_lsn;
 
943
 
 
944
+UNIV_INTERN ib_uint64_t srv_oldest_lsn;
 
945
+
 
946
 #ifdef HAVE_DARWIN_THREADS
 
947
 # include <sys/utsname.h>
 
948
 /** TRUE if the F_FULLFSYNC option is available */
 
949
@@ -549,7 +551,7 @@
 
950
 /*********************************************************************//**
 
951
 Creates or opens the log files and closes them.
 
952
 @return        DB_SUCCESS or error code */
 
953
-static
 
954
+//static
 
955
 ulint
 
956
 open_or_create_log_file(
 
957
 /*====================*/
 
958
@@ -709,7 +711,7 @@
 
959
 /*********************************************************************//**
 
960
 Creates or opens database data files and closes them.
 
961
 @return        DB_SUCCESS or error code */
 
962
-static
 
963
+//static
 
964
 ulint
 
965
 open_or_create_data_files(
 
966
 /*======================*/
 
967
@@ -1868,6 +1870,10 @@
 
968
                are initialized in trx_sys_init_at_db_start(). */
 
969
 
 
970
                recv_recovery_from_checkpoint_finish();
 
971
+
 
972
+               if (srv_apply_log_only)
 
973
+                       goto skip_processes;
 
974
+
 
975
                if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) {
 
976
                        /* The following call is necessary for the insert
 
977
                        buffer to work with multiple tablespaces. We must
 
978
@@ -2042,6 +2048,17 @@
 
979
        if (!srv_auto_extend_last_data_file
 
980
            && sum_of_data_file_sizes != tablespace_size_in_header) {
 
981
 
 
982
+               /* extend table space size aligning with header */
 
983
+               ulint   actual_size;
 
984
+               fil_extend_space_to_desired_size(&actual_size, 0, tablespace_size_in_header);
 
985
+               if (actual_size < tablespace_size_in_header) {
 
986
+                       fprintf(stderr,
 
987
+"InnoDB: Warning: To extend tablespace size aligning with header seems to be failed.\n"
 
988
+"InnoDB: The acutual size %lu must be larger than %lu.\n",
 
989
+                               (ulong) actual_size,
 
990
+                               (ulong) tablespace_size_in_header);
 
991
+               }
 
992
+#ifdef UNDEFINED
 
993
                ut_print_timestamp(stderr);
 
994
                fprintf(stderr,
 
995
                        " InnoDB: Error: tablespace size"
 
996
@@ -2121,6 +2138,7 @@
 
997
 
 
998
                        return(DB_ERROR);
 
999
                }
 
1000
+#endif
 
1001
        }
 
1002
 
 
1003
        /* Check that os_fast_mutexes work as expected */
 
1004
@@ -2240,6 +2258,7 @@
 
1005
                ibuf_update_max_tablespace_id();
 
1006
        }
 
1007
 
 
1008
+skip_processes:
 
1009
        srv_file_per_table = srv_file_per_table_original_value;
 
1010
 
 
1011
        srv_was_started = TRUE;
 
1012
--- a/storage/innobase/trx/trx0purge.c  2011-03-15 07:56:04.000000000 -0700
 
1013
+++ b/storage/innobase/trx/trx0purge.c  2011-03-15 07:56:47.000000000 -0700
 
1014
@@ -1100,6 +1100,9 @@
 
1015
        /*      que_thr_t*      thr2; */
 
1016
        ulint           old_pages_handled;
 
1017
 
 
1018
+       if (srv_fake_write)
 
1019
+               return(0);
 
1020
+
 
1021
        mutex_enter(&(purge_sys->mutex));
 
1022
 
 
1023
        if (purge_sys->trx->n_active_thrs > 0) {
 
1024
--- a/storage/innobase/trx/trx0rseg.c   2011-03-15 07:56:04.000000000 -0700
 
1025
+++ b/storage/innobase/trx/trx0rseg.c   2011-03-15 07:56:47.000000000 -0700
 
1026
@@ -140,9 +140,11 @@
 
1027
 
 
1028
        mutex_free(&rseg->mutex);
 
1029
 
 
1030
+       if (!srv_apply_log_only) {
 
1031
        /* There can't be any active transactions. */
 
1032
        ut_a(UT_LIST_GET_LEN(rseg->update_undo_list) == 0);
 
1033
        ut_a(UT_LIST_GET_LEN(rseg->insert_undo_list) == 0);
 
1034
+       }
 
1035
 
 
1036
        undo = UT_LIST_GET_FIRST(rseg->update_undo_cached);
 
1037
 
 
1038
--- a/storage/innobase/trx/trx0sys.c    2011-03-15 07:56:04.000000000 -0700
 
1039
+++ b/storage/innobase/trx/trx0sys.c    2011-03-15 07:56:47.000000000 -0700
 
1040
@@ -1938,10 +1938,12 @@
 
1041
                UT_LIST_REMOVE(view_list, trx_sys->view_list, prev_view);
 
1042
        }
 
1043
 
 
1044
+       if (!srv_apply_log_only) {
 
1045
        ut_a(UT_LIST_GET_LEN(trx_sys->trx_list) == 0);
 
1046
        ut_a(UT_LIST_GET_LEN(trx_sys->rseg_list) == 0);
 
1047
        ut_a(UT_LIST_GET_LEN(trx_sys->view_list) == 0);
 
1048
        ut_a(UT_LIST_GET_LEN(trx_sys->mysql_trx_list) == 0);
 
1049
+       }
 
1050
 
 
1051
        mem_free(trx_sys);
 
1052
 
 
1053
--- a/storage/innobase/trx/trx0trx.c    2011-03-15 07:56:04.000000000 -0700
 
1054
+++ b/storage/innobase/trx/trx0trx.c    2011-03-15 07:56:47.000000000 -0700
 
1055
@@ -505,8 +505,8 @@
 
1056
                                                (ullint) trx->id);
 
1057
 
 
1058
                                        if (srv_force_recovery == 0) {
 
1059
-
 
1060
-                                               trx->conc_state = TRX_PREPARED;
 
1061
+                                               /* xtrabackup should rollback it */
 
1062
+                                               trx->conc_state = TRX_ACTIVE;
 
1063
                                        } else {
 
1064
                                                fprintf(stderr,
 
1065
                                                        "InnoDB: Since"
 
1066
@@ -580,9 +580,9 @@
 
1067
                                                        (ullint) trx->id);
 
1068
 
 
1069
                                                if (srv_force_recovery == 0) {
 
1070
-
 
1071
+                                                       /* xtrabackup should rollback it */
 
1072
                                                        trx->conc_state
 
1073
-                                                               = TRX_PREPARED;
 
1074
+                                                               = TRX_ACTIVE;
 
1075
                                                } else {
 
1076
                                                        fprintf(stderr,
 
1077
                                                                "InnoDB: Since"
 
1078
@@ -925,7 +925,6 @@
 
1079
        trx->read_view = NULL;
 
1080
 
 
1081
        if (lsn) {
 
1082
-               ulint   flush_log_at_trx_commit;
 
1083
 
 
1084
                mutex_exit(&kernel_mutex);
 
1085
 
 
1086
@@ -934,12 +933,6 @@
 
1087
                        trx_undo_insert_cleanup(trx);
 
1088
                }
 
1089
 
 
1090
-               if (srv_use_global_flush_log_at_trx_commit) {
 
1091
-                       flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL);
 
1092
-               } else {
 
1093
-                       flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd);
 
1094
-               }
 
1095
-
 
1096
                /* NOTE that we could possibly make a group commit more
 
1097
                efficient here: call os_thread_yield here to allow also other
 
1098
                trxs to come to commit! */
 
1099
@@ -971,9 +964,9 @@
 
1100
                if (trx->flush_log_later) {
 
1101
                        /* Do nothing yet */
 
1102
                        trx->must_flush_log_later = TRUE;
 
1103
-               } else if (flush_log_at_trx_commit == 0) {
 
1104
+               } else if (srv_flush_log_at_trx_commit == 0) {
 
1105
                        /* Do nothing */
 
1106
-               } else if (flush_log_at_trx_commit == 1) {
 
1107
+               } else if (srv_flush_log_at_trx_commit == 1) {
 
1108
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
 
1109
                                /* Write the log but do not flush it to disk */
 
1110
 
 
1111
@@ -985,7 +978,7 @@
 
1112
 
 
1113
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
 
1114
                        }
 
1115
-               } else if (flush_log_at_trx_commit == 2) {
 
1116
+               } else if (srv_flush_log_at_trx_commit == 2) {
 
1117
 
 
1118
                        /* Write the log but do not flush it to disk */
 
1119
 
 
1120
@@ -1665,23 +1658,16 @@
 
1121
        trx_t*  trx)    /*!< in: trx handle */
 
1122
 {
 
1123
        ib_uint64_t     lsn     = trx->commit_lsn;
 
1124
-       ulint           flush_log_at_trx_commit;
 
1125
 
 
1126
        ut_a(trx);
 
1127
 
 
1128
        trx->op_info = "flushing log";
 
1129
 
 
1130
-       if (srv_use_global_flush_log_at_trx_commit) {
 
1131
-               flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL);
 
1132
-       } else {
 
1133
-               flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd);
 
1134
-       }
 
1135
-
 
1136
        if (!trx->must_flush_log_later) {
 
1137
                /* Do nothing */
 
1138
-       } else if (flush_log_at_trx_commit == 0) {
 
1139
+       } else if (srv_flush_log_at_trx_commit == 0) {
 
1140
                /* Do nothing */
 
1141
-       } else if (flush_log_at_trx_commit == 1) {
 
1142
+       } else if (srv_flush_log_at_trx_commit == 1) {
 
1143
                if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
 
1144
                        /* Write the log but do not flush it to disk */
 
1145
 
 
1146
@@ -1692,7 +1678,7 @@
 
1147
 
 
1148
                        log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
 
1149
                }
 
1150
-       } else if (flush_log_at_trx_commit == 2) {
 
1151
+       } else if (srv_flush_log_at_trx_commit == 2) {
 
1152
 
 
1153
                /* Write the log but do not flush it to disk */
 
1154
 
 
1155
@@ -1945,7 +1931,6 @@
 
1156
        /*--------------------------------------*/
 
1157
 
 
1158
        if (lsn) {
 
1159
-               ulint   flush_log_at_trx_commit;
 
1160
 
 
1161
                /* Depending on the my.cnf options, we may now write the log
 
1162
                buffer to the log files, making the prepared state of the
 
1163
@@ -1966,15 +1951,9 @@
 
1164
 
 
1165
                mutex_exit(&kernel_mutex);
 
1166
 
 
1167
-               if (srv_use_global_flush_log_at_trx_commit) {
 
1168
-                       flush_log_at_trx_commit = thd_flush_log_at_trx_commit(NULL);
 
1169
-               } else {
 
1170
-                       flush_log_at_trx_commit = thd_flush_log_at_trx_commit(trx->mysql_thd);
 
1171
-               }
 
1172
-
 
1173
-               if (flush_log_at_trx_commit == 0) {
 
1174
+               if (srv_flush_log_at_trx_commit == 0) {
 
1175
                        /* Do nothing */
 
1176
-               } else if (flush_log_at_trx_commit == 1) {
 
1177
+               } else if (srv_flush_log_at_trx_commit == 1) {
 
1178
                        if (srv_unix_file_flush_method == SRV_UNIX_NOSYNC) {
 
1179
                                /* Write the log but do not flush it to disk */
 
1180
 
 
1181
@@ -1986,7 +1965,7 @@
 
1182
 
 
1183
                                log_write_up_to(lsn, LOG_WAIT_ONE_GROUP, TRUE);
 
1184
                        }
 
1185
-               } else if (flush_log_at_trx_commit == 2) {
 
1186
+               } else if (srv_flush_log_at_trx_commit == 2) {
 
1187
 
 
1188
                        /* Write the log but do not flush it to disk */
 
1189