~sergei.glushchenko/percona-xtrabackup/2.1-xb-bug1326224

« back to all changes in this revision

Viewing changes to patches/innodb56.patch

  • Committer: Alexey Kopytov
  • Date: 2014-05-01 06:29:32 UTC
  • mfrom: (739.3.1 2.1)
  • Revision ID: akopytov@gmail.com-20140501062932-lg94fda1yy7d1ml3
MergedĀ lp:~akopytov/percona-xtrabackup/bug1291299-2.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
262
262
        if (success && !recv_recovery_on) {
263
263
                mtr_t           mtr;
264
264
 
265
 
@@ -3521,7 +3499,7 @@
 
265
@@ -3368,7 +3346,21 @@
 
266
        ibool           success;
 
267
        /* TRUE if a table is created with CREATE TEMPORARY TABLE */
 
268
        bool            is_temp = !!(flags2 & DICT_TF2_TEMPORARY);
 
269
+
 
270
+       /* For XtraBackup recovery we force remote tablespaces to be local,
 
271
+       i.e. never execute the code path corresponding to has_data_dir == true.
 
272
+       We don't create .isl files either, because we rely on innobackupex to
 
273
+       copy them under a global lock, and use them to copy remote tablespaces
 
274
+       to their proper locations on --copy-back.
 
275
+
 
276
+       See also MySQL bug #72022: dir_path is always NULL for remote
 
277
+       tablespaces when a MLOG_FILE_CREATE* log record is replayed (the remote
 
278
+       directory is not available from MLOG_FILE_CREATE*). */
 
279
+#if 0
 
280
        bool            has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags);
 
281
+#else
 
282
+       bool            has_data_dir = false;
 
283
+#endif
 
284
 
 
285
        ut_a(space_id > 0);
 
286
        ut_ad(!srv_read_only_mode);
 
287
@@ -3521,7 +3513,7 @@
266
288
                goto error_exit_1;
267
289
        }
268
290
 
271
293
        {
272
294
                mtr_t           mtr;
273
295
                ulint           mlog_file_flag = 0;
274
 
@@ -3599,6 +3577,97 @@
 
296
@@ -3599,6 +3591,97 @@
275
297
                (ulong) expected_id, (ulong) expected_flags);
276
298
 }
277
299
 
369
391
 /********************************************************************//**
370
392
 Tries to open a single-table tablespace and optionally checks that the
371
393
 space id in it is correct. If this does not succeed, print an error message
372
 
@@ -3664,6 +3733,9 @@
 
394
@@ -3664,6 +3747,9 @@
373
395
        in the default location. If it is remote, it should not be here. */
374
396
        def.filepath = fil_make_ibd_name(tablename, false);
375
397
 
379
401
        /* The path_in was read from SYS_DATAFILES. */
380
402
        if (path_in) {
381
403
                if (strcmp(def.filepath, path_in)) {
382
 
@@ -3711,6 +3783,7 @@
 
404
@@ -3711,6 +3797,7 @@
383
405
                        tablespaces_found++;
384
406
                }
385
407
        }
387
409
 
388
410
        /* Always look for a file at the default location. */
389
411
        ut_a(def.filepath);
390
 
@@ -3732,9 +3805,6 @@
 
412
@@ -3732,9 +3819,6 @@
391
413
        if (def.success) {
392
414
                def.check_msg = fil_read_first_page(
393
415
                        def.file, FALSE, &def.flags, &def.id,
397
419
                        &def.lsn, &def.lsn);
398
420
                def.valid = !def.check_msg;
399
421
 
400
 
@@ -3757,9 +3827,6 @@
 
422
@@ -3757,9 +3841,6 @@
401
423
        if (remote.success) {
402
424
                remote.check_msg = fil_read_first_page(
403
425
                        remote.file, FALSE, &remote.flags, &remote.id,
407
429
                        &remote.lsn, &remote.lsn);
408
430
                remote.valid = !remote.check_msg;
409
431
 
410
 
@@ -3783,9 +3850,6 @@
 
432
@@ -3783,9 +3864,6 @@
411
433
        if (dict.success) {
412
434
                dict.check_msg = fil_read_first_page(
413
435
                        dict.file, FALSE, &dict.flags, &dict.id,
417
439
                        &dict.lsn, &dict.lsn);
418
440
                dict.valid = !dict.check_msg;
419
441
 
420
 
@@ -3810,11 +3874,15 @@
 
442
@@ -3810,11 +3888,15 @@
421
443
                /* The following call prints an error message */
422
444
                os_file_get_last_error(true);
423
445
 
434
456
 
435
457
                err = DB_CORRUPTION;
436
458
 
437
 
@@ -4187,9 +4255,6 @@
 
459
@@ -4187,9 +4269,6 @@
438
460
        fsp->success = TRUE;
439
461
        if (const char* check_msg = fil_read_first_page(
440
462
                    fsp->file, FALSE, &fsp->flags, &fsp->id,
444
466
                    &fsp->lsn, &fsp->lsn)) {
445
467
                ib_logf(IB_LOG_LEVEL_ERROR,
446
468
                        "%s in tablespace %s (table %s)",
447
 
@@ -4266,6 +4331,9 @@
 
469
@@ -4266,6 +4345,9 @@
448
470
 #ifdef UNIV_HOTBACKUP
449
471
        fil_space_t*    space;
450
472
 #endif
454
476
 
455
477
        memset(&def, 0, sizeof(def));
456
478
        memset(&remote, 0, sizeof(remote));
457
 
@@ -4310,6 +4378,9 @@
 
479
@@ -4310,6 +4392,9 @@
458
480
 # endif /* !UNIV_HOTBACKUP */
459
481
 #endif
460
482
 
464
486
        /* Check for a link file which locates a remote tablespace. */
465
487
        remote.success = fil_open_linked_file(
466
488
                tablename, &remote.filepath, &remote.file);
467
 
@@ -4320,8 +4391,20 @@
 
489
@@ -4320,8 +4405,20 @@
468
490
                if (!remote.success) {
469
491
                        os_file_close(remote.file);
470
492
                        mem_free(remote.filepath);
485
507
 
486
508
 
487
509
        /* Try to open the tablespace in the datadir. */
488
 
@@ -4334,6 +4417,17 @@
 
510
@@ -4334,6 +4431,17 @@
489
511
                fil_validate_single_table_tablespace(tablename, &def);
490
512
                if (!def.success) {
491
513
                        os_file_close(def.file);
503
525
                }
504
526
        }
505
527
 
506
 
@@ -4418,7 +4512,7 @@
 
528
@@ -4418,7 +4526,7 @@
507
529
        /* At this point, only one tablespace is open */
508
530
        ut_a(def.success == !remote.success);
509
531
 
512
534
 
513
535
        /* Get and test the file size. */
514
536
        size = os_file_get_size(fsp->file);
515
 
@@ -4437,9 +4531,9 @@
 
537
@@ -4437,9 +4545,9 @@
516
538
 
517
539
        /* Every .ibd file is created >= 4 pages in size. Smaller files
518
540
        cannot be ok. */
524
546
                ib_logf(IB_LOG_LEVEL_ERROR,
525
547
                        "The size of single-table tablespace file %s "
526
548
                        "is only " UINT64PF ", should be at least %lu!",
527
 
@@ -4520,7 +4614,7 @@
 
549
@@ -4520,7 +4628,7 @@
528
550
        }
529
551
        mutex_exit(&fil_system->mutex);
530
552
 #endif /* UNIV_HOTBACKUP */
533
555
                tablename, fsp->id, fsp->flags, FIL_TABLESPACE);
534
556
 
535
557
        if (!file_space_create_success) {
536
 
@@ -4547,13 +4641,55 @@
 
558
@@ -4547,13 +4655,55 @@
537
559
        }
538
560
 
539
561
 func_exit:
593
615
        mem_free(tablename);
594
616
        if (remote.success) {
595
617
                mem_free(remote.filepath);
596
 
@@ -4567,7 +4703,7 @@
 
618
@@ -4567,7 +4717,7 @@
597
619
 idea is to read as much good data as we can and jump over bad data.
598
620
 @return 0 if ok, -1 if error even after the retries, 1 if at the end
599
621
 of the directory */
602
624
 int
603
625
 fil_file_readdir_next_file(
604
626
 /*=======================*/
605
 
@@ -4607,7 +4743,7 @@
 
627
@@ -4607,7 +4757,7 @@
606
628
 @return        DB_SUCCESS or error number */
607
629
 UNIV_INTERN
608
630
 dberr_t
611
633
 /*===================================*/
612
634
 {
613
635
        int             ret;
614
 
@@ -4663,7 +4799,9 @@
 
636
@@ -4663,7 +4813,9 @@
615
637
                            "%s/%s", fil_path_to_mysql_datadir, dbinfo.name);
616
638
                srv_normalize_path_for_win(dbpath);
617
639
 
622
644
 
623
645
                if (dbdir != NULL) {
624
646
 
625
 
@@ -4684,9 +4822,15 @@
 
647
@@ -4684,9 +4836,15 @@
626
648
                                    && (0 == strcmp(fileinfo.name
627
649
                                                   + strlen(fileinfo.name) - 4,
628
650
                                                   ".ibd")
640
662
                                        /* The name ends in .ibd or .isl;
641
663
                                        try opening the file */
642
664
                                        fil_load_single_table_tablespace(
643
 
@@ -4842,6 +4986,7 @@
 
665
@@ -4842,6 +5000,7 @@
644
666
 {
645
667
        fil_space_t*    fnamespace;
646
668
        fil_space_t*    space;
648
670
 
649
671
        ut_ad(fil_system);
650
672
 
651
 
@@ -4919,6 +5064,10 @@
 
673
@@ -4919,6 +5078,10 @@
652
674
                if (fnamespace == NULL) {
653
675
                        if (print_error_if_does_not_exist) {
654
676
                                fil_report_missing_tablespace(name, id);
659
681
                        }
660
682
                } else {
661
683
                        ut_print_timestamp(stderr);
662
 
@@ -4942,6 +5091,10 @@
 
684
@@ -4942,6 +5105,10 @@
663
685
 
664
686
                mutex_exit(&fil_system->mutex);
665
687
 
670
692
                return(FALSE);
671
693
        }
672
694
 
673
 
@@ -5575,6 +5728,16 @@
 
695
@@ -5575,6 +5742,16 @@
674
696
 
675
697
        ut_ad(mode != OS_AIO_IBUF || space->purpose == FIL_TABLESPACE);
676
698
 
687
709
        node = UT_LIST_GET_FIRST(space->chain);
688
710
 
689
711
        for (;;) {
690
 
@@ -6502,6 +6665,7 @@
 
712
@@ -6502,6 +6679,7 @@
691
713
        return(err);
692
714
 }
693
715
 
695
717
 /****************************************************************//**
696
718
 Generate redo logs for swapping two .ibd files */
697
719
 UNIV_INTERN
698
 
@@ -6528,3 +6692,4 @@
 
720
@@ -6528,3 +6706,4 @@
699
721
                                 0, 0, new_name, old_name, mtr);
700
722
        }
701
723
 }