~stewart/percona-server/Percona-Server-5.1.54-12-bug814404

« back to all changes in this revision

Viewing changes to innodb_pass_corrupt_table.patch

  • Committer: kinoyasu
  • Date: 2010-12-16 11:35:26 UTC
  • Revision ID: kinoyasu@gauntlet4-20101216113526-62t7dahi1aeajp29
Yasufumi patches are ported to 5.1.54

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
        ut_ad(page_is_leaf(buf_block_get_frame(block)));
241
241
 
242
242
        rec = btr_cur_get_rec(cursor);
243
 
@@ -3551,6 +3631,11 @@
 
243
@@ -3549,6 +3629,11 @@
244
244
 
245
245
                page = btr_cur_get_page(&cursor);
246
246
 
471
471
 
472
472
 #include <ctype.h>
473
473
 
474
 
@@ -704,7 +705,7 @@
 
474
@@ -734,7 +735,7 @@
 
475
 
475
476
        mutex_exit(&(dict_sys->mutex));
476
477
 
477
 
        if (table != NULL) {
478
 
-               if (!table->stat_initialized) {
479
 
+               if (!table->stat_initialized && !table->is_corrupt) {
480
 
                        /* If table->ibd_file_missing == TRUE, this will
481
 
                        print an error message and return without doing
482
 
                        anything. */
483
 
@@ -1245,7 +1246,7 @@
 
478
-       if (table != NULL) {
 
479
+       if (table != NULL && !table->is_corrupt) {
 
480
                /* If table->ibd_file_missing == TRUE, this will
 
481
                print an error message and return without doing
 
482
                anything. */
 
483
@@ -1275,7 +1276,7 @@
484
484
                    + dict_sys->size) > srv_dict_size_limit ) {
485
485
                prev_table = UT_LIST_GET_PREV(table_LRU, table);
486
486
 
489
489
                        goto next_loop;
490
490
 
491
491
                cached_foreign_tables = 0;
492
 
@@ -4556,6 +4557,11 @@
493
 
 
 
492
@@ -4593,6 +4594,11 @@
 
493
        }
494
494
 
495
495
        do {
496
496
+               if (table->is_corrupt) {
501
501
                if (UNIV_LIKELY
502
502
                    (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
503
503
                     || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
504
 
@@ -5292,4 +5298,42 @@
505
 
                mutex_free(&dict_index_stat_mutex[i]);
 
504
@@ -5320,4 +5326,42 @@
 
505
                rw_lock_free(&dict_table_stats_latches[i]);
506
506
        }
507
507
 }
508
508
+
567
567
        UT_LIST_NODE_T(fil_space_t) space_list;
568
568
                                /*!< list of all spaces */
569
569
        ulint           magic_n;/*!< FIL_SPACE_MAGIC_N */
570
 
@@ -1243,6 +1244,8 @@
 
570
@@ -1246,6 +1247,8 @@
571
571
                    ut_fold_string(name), space);
572
572
        space->is_in_unflushed_spaces = FALSE;
573
573
 
576
576
        UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
577
577
 
578
578
        mutex_exit(&fil_system->mutex);
579
 
@@ -4847,6 +4850,22 @@
 
579
@@ -4893,6 +4896,22 @@
580
580
        ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
581
581
        ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
582
582
 
599
599
 #ifdef UNIV_HOTBACKUP
600
600
        /* In ibbackup do normal i/o, not aio */
601
601
        if (type == OS_FILE_READ) {
602
 
@@ -4861,6 +4880,8 @@
 
602
@@ -4907,6 +4926,8 @@
603
603
        ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
604
604
                     offset_low, offset_high, len, node, message, trx);
605
605
 #endif
608
608
        ut_a(ret);
609
609
 
610
610
        if (mode == OS_AIO_SYNC) {
611
 
@@ -5007,7 +5028,7 @@
 
611
@@ -5053,7 +5074,7 @@
612
612
 
613
613
        if (fil_node->space->purpose == FIL_TABLESPACE) {
614
614
                srv_set_io_thread_op_info(segment, "complete io for buf page");
617
617
        } else {
618
618
                srv_set_io_thread_op_info(segment, "complete io for log");
619
619
                log_io_complete(message);
620
 
@@ -5361,3 +5382,46 @@
 
620
@@ -5407,3 +5428,46 @@
621
621
                return 0;
622
622
        }
623
623
 }
738
738
        return(inode);
739
739
 }
740
740
 
741
 
@@ -3259,6 +3286,11 @@
 
741
@@ -3309,6 +3336,11 @@
742
742
 
743
743
        descr = xdes_get_descriptor(space, zip_size, page, mtr);
744
744
 
750
750
        ut_a(descr);
751
751
        if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
752
752
                fputs("InnoDB: Dump of the tablespace extent descriptor: ",
753
 
@@ -3511,6 +3543,11 @@
 
753
@@ -3561,6 +3593,11 @@
754
754
 
755
755
        descr = xdes_get_descriptor(space, zip_size, header_page, mtr);
756
756
 
762
762
        /* Check that the header resides on a page which has not been
763
763
        freed yet */
764
764
 
765
 
@@ -3595,6 +3632,12 @@
 
765
@@ -3645,6 +3682,12 @@
766
766
 
767
767
        inode = fseg_inode_get(header, space, zip_size, mtr);
768
768
 
932
932
        switch (ret) {
933
933
        case DB_SUCCESS:
934
934
                error = 0;
935
 
@@ -7212,6 +7275,10 @@
 
935
@@ -7201,6 +7264,10 @@
936
936
                DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND);
937
937
        }
938
938
 
943
943
        /* Truncate the table in InnoDB */
944
944
 
945
945
        error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
946
 
@@ -7220,6 +7287,10 @@
 
946
@@ -7209,6 +7276,10 @@
947
947
                goto fallback;
948
948
        }
949
949
 
954
954
        error = convert_error_code_to_mysql(error, prebuilt->table->flags,
955
955
                                            NULL);
956
956
 
957
 
@@ -7729,6 +7800,16 @@
 
957
@@ -7721,6 +7792,16 @@
958
958
        return(ranges + (double) rows / (double) total_rows * time_for_scan);
959
959
 }
960
960
 
971
971
 /*********************************************************************//**
972
972
 Calculates the key number used inside MySQL for an Innobase index. We will
973
973
 first check the "index translation table" for a match of the index to get
974
 
@@ -7850,7 +7931,7 @@
 
974
@@ -7842,7 +7923,7 @@
975
975
        ib_table = prebuilt->table;
976
976
 
977
977
        if (flag & HA_STATUS_TIME) {
980
980
                        /* In sql_show we call with this flag: update
981
981
                        then statistics so that they are up-to-date */
982
982
 
983
 
@@ -8141,10 +8222,18 @@
 
983
@@ -8133,10 +8214,18 @@
984
984
        THD*            thd,            /*!< in: connection thread handle */
985
985
        HA_CHECK_OPT*   check_opt)      /*!< in: currently ignored */
986
986
 {
999
999
        return(0);
1000
1000
 }
1001
1001
 
1002
 
@@ -8326,6 +8415,10 @@
 
1002
@@ -8318,6 +8407,10 @@
1003
1003
                my_error(ER_QUERY_INTERRUPTED, MYF(0));
1004
1004
        }
1005
1005
 
1010
1010
        DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
1011
1011
 }
1012
1012
 
1013
 
@@ -9051,6 +9144,10 @@
 
1013
@@ -9043,6 +9136,10 @@
1014
1014
 
1015
1015
        update_thd(thd);
1016
1016
 
1021
1021
        if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
1022
1022
                ut_print_timestamp(stderr);
1023
1023
                fprintf(stderr,
1024
 
@@ -11495,6 +11592,14 @@
 
1024
@@ -11487,6 +11584,14 @@
1025
1025
   "0 (the default) disables automatic dumps.",
1026
1026
   NULL, NULL, 0, 0, UINT_MAX32, 0);
1027
1027
 
1036
1036
 static struct st_mysql_sys_var* innobase_system_variables[]= {
1037
1037
   MYSQL_SYSVAR(additional_mem_pool_size),
1038
1038
   MYSQL_SYSVAR(autoextend_increment),
1039
 
@@ -11580,6 +11685,7 @@
 
1039
@@ -11572,6 +11677,7 @@
1040
1040
   MYSQL_SYSVAR(io_capacity),
1041
1041
   MYSQL_SYSVAR(auto_lru_dump),
1042
1042
   MYSQL_SYSVAR(use_purge_thread),
1085
1085
 #define BTR_MAX_NODE_LEVEL     50      /*!< Maximum B-tree page level
1086
1086
                                        (not really a hard limit).
1087
1087
                                        Used in debug assertions
1088
 
@@ -52,7 +52,9 @@
1089
 
 
1090
 
        block = buf_page_get(space, zip_size, page_no, mode, mtr);
 
1088
@@ -55,7 +55,9 @@
 
1089
        block = buf_page_get_gen(space, zip_size, page_no, mode,
 
1090
                                 NULL, BUF_GET, file, line, mtr);
1091
1091
 
1092
1092
-       if (mode != RW_NO_LATCH) {
1093
1093
+       ut_a(srv_pass_corrupt_table || block);
1154
1154
diff -ruN a/storage/innodb_plugin/include/dict0dict.h b/storage/innodb_plugin/include/dict0dict.h
1155
1155
--- a/storage/innodb_plugin/include/dict0dict.h 2010-08-27 16:22:04.264988090 +0900
1156
1156
+++ b/storage/innodb_plugin/include/dict0dict.h 2010-08-27 16:39:03.011025333 +0900
1157
 
@@ -1201,6 +1201,15 @@
 
1157
@@ -1199,6 +1199,15 @@
1158
1158
 dict_close(void);
1159
1159
 /*============*/
1160
1160
 
1184
1184
diff -ruN a/storage/innodb_plugin/include/fil0fil.h b/storage/innodb_plugin/include/fil0fil.h
1185
1185
--- a/storage/innodb_plugin/include/fil0fil.h   2010-08-27 16:36:03.499987483 +0900
1186
1186
+++ b/storage/innodb_plugin/include/fil0fil.h   2010-08-27 16:39:03.015021314 +0900
1187
 
@@ -747,6 +747,19 @@
 
1187
@@ -756,6 +756,19 @@
1188
1188
 fil_system_hash_nodes(void);
1189
1189
 /*========================*/
1190
1190
 
1326
1326
diff -ruN a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c
1327
1327
--- a/storage/innodb_plugin/row/row0sel.c       2010-08-04 02:24:20.000000000 +0900
1328
1328
+++ b/storage/innodb_plugin/row/row0sel.c       2010-08-27 16:39:03.045021567 +0900
1329
 
@@ -3844,6 +3844,13 @@
 
1329
@@ -3856,6 +3856,13 @@
1330
1330
        /* PHASE 4: Look for matching records in a loop */
1331
1331
 
1332
1332
        rec = btr_pcur_get_rec(pcur);
1354
1354
diff -ruN a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
1355
1355
--- a/storage/innodb_plugin/srv/srv0start.c     2010-08-27 16:38:38.290021700 +0900
1356
1356
+++ b/storage/innodb_plugin/srv/srv0start.c     2010-08-27 16:39:03.052021423 +0900
1357
 
@@ -1974,6 +1974,13 @@
 
1357
@@ -1994,6 +1994,13 @@
1358
1358
 
1359
1359
        os_fast_mutex_free(&srv_os_test_mutex);
1360
1360