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

« back to all changes in this revision

Viewing changes to innodb_pass_corrupt_table.patch

  • Committer: Ignacio Nin
  • Date: 2011-03-27 18:30:06 UTC
  • mfrom: (88.2.3 5.5.10)
  • Revision ID: ignacio.nin@percona.com-20110327183006-ij0o2pdyhzaerish
Merge 5.5.10 changes

Merge 5.5.10 changes to release-5.5.9-20.1 in order to create release-5.5.10-20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
77
77
--- a/storage/innobase/btr/btr0cur.c    2010-12-03 17:30:16.239038936 +0900
78
78
+++ b/storage/innobase/btr/btr0cur.c    2010-12-04 15:38:18.114551906 +0900
79
 
@@ -238,6 +238,11 @@
 
79
@@ -250,6 +250,11 @@
80
80
        case BTR_MODIFY_LEAF:
81
81
                mode = latch_mode == BTR_SEARCH_LEAF ? RW_S_LATCH : RW_X_LATCH;
82
82
                get_block = btr_block_get(space, zip_size, page_no, mode, mtr);
88
88
 #ifdef UNIV_BTR_DEBUG
89
89
                ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
90
90
 #endif /* UNIV_BTR_DEBUG */
91
 
@@ -251,6 +256,11 @@
 
91
@@ -263,6 +268,11 @@
92
92
                        get_block = btr_block_get(space, zip_size,
93
93
                                                  left_page_no,
94
94
                                                  RW_X_LATCH, mtr);
100
100
 #ifdef UNIV_BTR_DEBUG
101
101
                        ut_a(page_is_comp(get_block->frame)
102
102
                             == page_is_comp(page));
103
 
@@ -262,6 +272,11 @@
 
103
@@ -274,6 +284,11 @@
104
104
 
105
105
                get_block = btr_block_get(space, zip_size, page_no,
106
106
                                          RW_X_LATCH, mtr);
112
112
 #ifdef UNIV_BTR_DEBUG
113
113
                ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
114
114
 #endif /* UNIV_BTR_DEBUG */
115
 
@@ -273,6 +288,11 @@
 
115
@@ -285,6 +300,11 @@
116
116
                        get_block = btr_block_get(space, zip_size,
117
117
                                                  right_page_no,
118
118
                                                  RW_X_LATCH, mtr);
124
124
 #ifdef UNIV_BTR_DEBUG
125
125
                        ut_a(page_is_comp(get_block->frame)
126
126
                             == page_is_comp(page));
127
 
@@ -294,6 +314,11 @@
 
127
@@ -306,6 +326,11 @@
128
128
                        get_block = btr_block_get(space, zip_size,
129
129
                                                  left_page_no, mode, mtr);
130
130
                        cursor->left_block = get_block;
136
136
 #ifdef UNIV_BTR_DEBUG
137
137
                        ut_a(page_is_comp(get_block->frame)
138
138
                             == page_is_comp(page));
139
 
@@ -304,6 +329,11 @@
 
139
@@ -316,6 +341,11 @@
140
140
                }
141
141
 
142
142
                get_block = btr_block_get(space, zip_size, page_no, mode, mtr);
148
148
 #ifdef UNIV_BTR_DEBUG
149
149
                ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
150
150
 #endif /* UNIV_BTR_DEBUG */
151
 
@@ -576,6 +606,19 @@
 
151
@@ -588,6 +618,19 @@
152
152
                file, line, mtr);
153
153
 
154
154
        if (block == NULL) {
168
168
                /* This must be a search to perform an insert/delete
169
169
                mark/ delete; try using the insert/delete buffer */
170
170
 
171
 
@@ -650,6 +693,16 @@
 
171
@@ -662,6 +705,16 @@
172
172
        block->check_index_page_at_flush = TRUE;
173
173
        page = buf_block_get_frame(block);
174
174
 
185
185
        if (rw_latch != RW_NO_LATCH) {
186
186
 #ifdef UNIV_ZIP_DEBUG
187
187
                const page_zip_des_t*   page_zip
188
 
@@ -854,6 +907,17 @@
 
188
@@ -866,6 +919,17 @@
189
189
                                         RW_NO_LATCH, NULL, BUF_GET,
190
190
                                         file, line, mtr);
191
191
                page = buf_block_get_frame(block);
203
203
                ut_ad(index->id == btr_page_get_index_id(page));
204
204
 
205
205
                block->check_index_page_at_flush = TRUE;
206
 
@@ -974,6 +1038,14 @@
 
206
@@ -986,6 +1050,14 @@
207
207
                                         RW_NO_LATCH, NULL, BUF_GET,
208
208
                                         file, line, mtr);
209
209
                page = buf_block_get_frame(block);
218
218
                ut_ad(index->id == btr_page_get_index_id(page));
219
219
 
220
220
                if (height == ULINT_UNDEFINED) {
221
 
@@ -1288,6 +1360,12 @@
 
221
@@ -1199,6 +1271,12 @@
222
222
        *big_rec = NULL;
223
223
 
224
224
        block = btr_cur_get_block(cursor);
231
231
        page = buf_block_get_frame(block);
232
232
        index = cursor->index;
233
233
        zip_size = buf_block_get_zip_size(block);
234
 
@@ -3013,6 +3091,11 @@
 
234
@@ -2924,6 +3002,11 @@
235
235
 
236
236
        block = btr_cur_get_block(cursor);
237
237
 
243
243
        ut_ad(page_is_leaf(buf_block_get_frame(block)));
244
244
 
245
245
        rec = btr_cur_get_rec(cursor);
246
 
@@ -3817,6 +3900,11 @@
 
246
@@ -3627,6 +3710,11 @@
247
247
 
248
248
                page = btr_cur_get_page(&cursor);
249
249
 
252
252
+               }
253
253
+               ut_a(page);
254
254
+
255
 
                supremum = page_get_supremum_rec(page);
256
 
                if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS && is_first_page) {
257
 
                        /* the cursor should be the first record of the page. */
 
255
                rec = page_rec_get_next(page_get_infimum_rec(page));
 
256
 
 
257
                if (!page_rec_is_supremum(rec)) {
258
258
diff -ruN a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
259
259
--- a/storage/innobase/btr/btr0pcur.c   2010-11-03 07:01:13.000000000 +0900
260
260
+++ b/storage/innobase/btr/btr0pcur.c   2010-12-04 15:38:18.116563877 +0900
343
343
                        if (!ready) {
344
344
 
345
345
                                return(block);
346
 
@@ -2476,6 +2482,14 @@
 
346
@@ -2478,6 +2484,14 @@
347
347
                return(NULL);
348
348
        }
349
349
 
358
358
        block_mutex = buf_page_get_mutex_enter(bpage);
359
359
 
360
360
        rw_lock_s_unlock(&buf_pool->page_hash_latch);
361
 
@@ -3023,6 +3037,14 @@
 
361
@@ -3024,6 +3038,14 @@
362
362
                return(NULL);
363
363
        }
364
364
 
378
378
        bpage->oldest_modification = 0;
379
379
        HASH_INVALIDATE(bpage, hash);
380
380
+       bpage->is_corrupt = FALSE;
381
 
 #ifdef UNIV_DEBUG_FILE_ACCESSES
 
381
 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
382
382
        bpage->file_page_was_freed = FALSE;
383
 
 #endif /* UNIV_DEBUG_FILE_ACCESSES */
 
383
 #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
384
384
@@ -4200,7 +4223,8 @@
385
385
 void
386
386
 buf_page_io_complete(
492
492
                        goto next_loop;
493
493
 
494
494
                cached_foreign_tables = 0;
495
 
@@ -4327,6 +4328,12 @@
 
495
@@ -4333,6 +4334,12 @@
496
496
        heap = mem_heap_create(1000);
497
497
 
498
498
        while (index) {
505
505
                size = btr_get_size(index, BTR_TOTAL_SIZE);
506
506
 
507
507
                index->stat_index_size = size;
508
 
@@ -4446,6 +4453,12 @@
 
508
@@ -4452,6 +4459,12 @@
509
509
        heap = mem_heap_create(1000);
510
510
 
511
511
        while (index) {
518
518
 /*===========================================*/
519
519
 {
520
520
        dict_table_t*   sys_stats;
521
 
@@ -4611,6 +4624,12 @@
 
521
@@ -4617,6 +4630,12 @@
522
522
                     || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
523
523
                         && dict_index_is_clust(index)))) {
524
524
                        ulint   size;
531
531
                        size = btr_get_size(index, BTR_TOTAL_SIZE);
532
532
 
533
533
                        index->stat_index_size = size;
534
 
@@ -5331,4 +5350,42 @@
 
534
@@ -5341,4 +5360,42 @@
535
535
                rw_lock_free(&dict_table_stats_latches[i]);
536
536
        }
537
537
 }
808
808
diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
809
809
--- a/storage/innobase/handler/ha_innodb.cc     2010-12-04 15:37:50.578486593 +0900
810
810
+++ b/storage/innobase/handler/ha_innodb.cc     2010-12-04 15:38:18.137549396 +0900
811
 
@@ -3928,6 +3928,12 @@
 
811
@@ -3947,6 +3947,12 @@
812
812
                DBUG_RETURN(1);
813
813
        }
814
814
 
821
821
        /* Create buffers for packing the fields of a record. Why
822
822
        table->reclength did not work here? Obviously, because char
823
823
        fields when packed actually became 1 byte longer, when we also
824
 
@@ -3955,6 +3961,19 @@
 
824
@@ -3974,6 +3980,19 @@
825
825
        /* Get pointer to a table object in InnoDB dictionary cache */
826
826
        ib_table = dict_table_get(norm_name, TRUE);
827
827
        
841
841
        if (NULL == ib_table) {
842
842
                if (is_part && retries < 10) {
843
843
                        ++retries;
844
 
@@ -5119,6 +5138,10 @@
 
844
@@ -5138,6 +5157,10 @@
845
845
 
846
846
        ha_statistic_increment(&SSV::ha_write_count);
847
847
 
852
852
        if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
853
853
                table->timestamp_field->set_time();
854
854
 
855
 
@@ -5336,6 +5359,10 @@
 
855
@@ -5355,6 +5378,10 @@
856
856
 func_exit:
857
857
        innobase_active_small();
858
858
 
863
863
        DBUG_RETURN(error_result);
864
864
 }
865
865
 
866
 
@@ -5512,6 +5539,10 @@
 
866
@@ -5531,6 +5558,10 @@
867
867
 
868
868
        ha_statistic_increment(&SSV::ha_update_count);
869
869
 
874
874
        if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
875
875
                table->timestamp_field->set_time();
876
876
 
877
 
@@ -5601,6 +5632,10 @@
 
877
@@ -5620,6 +5651,10 @@
878
878
 
879
879
        innobase_active_small();
880
880
 
885
885
        DBUG_RETURN(error);
886
886
 }
887
887
 
888
 
@@ -5622,6 +5657,10 @@
 
888
@@ -5641,6 +5676,10 @@
889
889
 
890
890
        ha_statistic_increment(&SSV::ha_delete_count);
891
891
 
896
896
        if (!prebuilt->upd_node) {
897
897
                row_get_prebuilt_update_vector(prebuilt);
898
898
        }
899
 
@@ -5648,6 +5687,10 @@
 
899
@@ -5667,6 +5706,10 @@
900
900
 
901
901
        innobase_active_small();
902
902
 
907
907
        DBUG_RETURN(error);
908
908
 }
909
909
 
910
 
@@ -5887,6 +5930,10 @@
 
910
@@ -5906,6 +5949,10 @@
911
911
 
912
912
        ha_statistic_increment(&SSV::ha_read_key_count);
913
913
 
918
918
        index = prebuilt->index;
919
919
 
920
920
        if (UNIV_UNLIKELY(index == NULL)) {
921
 
@@ -5952,6 +5999,10 @@
 
921
@@ -5971,6 +6018,10 @@
922
922
                ret = DB_UNSUPPORTED;
923
923
        }
924
924
 
929
929
        switch (ret) {
930
930
        case DB_SUCCESS:
931
931
                error = 0;
932
 
@@ -6067,6 +6118,10 @@
 
932
@@ -6086,6 +6137,10 @@
933
933
 {
934
934
        DBUG_ENTER("change_active_index");
935
935
 
940
940
        ut_ad(user_thd == ha_thd());
941
941
        ut_a(prebuilt->trx == thd_to_trx(user_thd));
942
942
 
943
 
@@ -6157,6 +6212,10 @@
 
943
@@ -6176,6 +6231,10 @@
944
944
 
945
945
        DBUG_ENTER("general_fetch");
946
946
 
951
951
        ut_a(prebuilt->trx == thd_to_trx(user_thd));
952
952
 
953
953
        innodb_srv_conc_enter_innodb(prebuilt->trx);
954
 
@@ -6166,6 +6225,10 @@
 
954
@@ -6185,6 +6244,10 @@
955
955
 
956
956
        innodb_srv_conc_exit_innodb(prebuilt->trx);
957
957
 
962
962
        switch (ret) {
963
963
        case DB_SUCCESS:
964
964
                error = 0;
965
 
@@ -7436,10 +7499,18 @@
 
965
@@ -7455,10 +7518,18 @@
966
966
 
967
967
        update_thd(ha_thd());
968
968
 
981
981
        error = convert_error_code_to_mysql(error, prebuilt->table->flags,
982
982
                                            NULL);
983
983
 
984
 
@@ -7944,6 +8015,16 @@
 
984
@@ -7963,6 +8034,16 @@
985
985
        return(ranges + (double) rows / (double) total_rows * time_for_scan);
986
986
 }
987
987
 
998
998
 /*********************************************************************//**
999
999
 Calculates the key number used inside MySQL for an Innobase index. We will
1000
1000
 first check the "index translation table" for a match of the index to get
1001
 
@@ -8062,7 +8143,7 @@
 
1001
@@ -8140,7 +8221,7 @@
1002
1002
        ib_table = prebuilt->table;
1003
1003
 
1004
1004
        if (flag & HA_STATUS_TIME) {
1007
1007
                        /* In sql_show we call with this flag: update
1008
1008
                        then statistics so that they are up-to-date */
1009
1009
 
1010
 
@@ -8356,10 +8437,18 @@
 
1010
@@ -8429,10 +8510,18 @@
1011
1011
        THD*            thd,            /*!< in: connection thread handle */
1012
1012
        HA_CHECK_OPT*   check_opt)      /*!< in: currently ignored */
1013
1013
 {
1026
1026
        return(0);
1027
1027
 }
1028
1028
 
1029
 
@@ -8541,6 +8630,10 @@
 
1029
@@ -8614,6 +8703,10 @@
1030
1030
                my_error(ER_QUERY_INTERRUPTED, MYF(0));
1031
1031
        }
1032
1032
 
1037
1037
        DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
1038
1038
 }
1039
1039
 
1040
 
@@ -9311,6 +9404,10 @@
 
1040
@@ -9384,6 +9477,10 @@
1041
1041
 
1042
1042
        update_thd(thd);
1043
1043
 
1048
1048
        if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
1049
1049
                ut_print_timestamp(stderr);
1050
1050
                fprintf(stderr,
1051
 
@@ -11720,6 +11817,25 @@
 
1051
@@ -11781,6 +11878,25 @@
1052
1052
   "0 (the default) disables automatic dumps.",
1053
1053
   NULL, NULL, 0, 0, UINT_MAX32, 0);
1054
1054
 
1074
1074
 static struct st_mysql_sys_var* innobase_system_variables[]= {
1075
1075
   MYSQL_SYSVAR(additional_mem_pool_size),
1076
1076
   MYSQL_SYSVAR(autoextend_increment),
1077
 
@@ -11806,6 +11922,7 @@
 
1077
@@ -11867,6 +11983,7 @@
1078
1078
   MYSQL_SYSVAR(buffer_pool_restore_at_startup),
1079
1079
   MYSQL_SYSVAR(purge_threads),
1080
1080
   MYSQL_SYSVAR(purge_batch_size),
1151
1151
                                        in the buffer pool */
1152
1152
        /* @} */
1153
1153
+       ibool           is_corrupt;
1154
 
 # ifdef UNIV_DEBUG_FILE_ACCESSES
 
1154
 # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
1155
1155
        ibool           file_page_was_freed;
1156
1156
                                        /*!< this is set to TRUE when fsp
1157
1157
diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
1201
1201
diff -ruN a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
1202
1202
--- a/storage/innobase/include/dict0mem.h       2010-11-03 07:01:13.000000000 +0900
1203
1203
+++ b/storage/innobase/include/dict0mem.h       2010-12-04 15:38:18.171513956 +0900
1204
 
@@ -619,6 +619,7 @@
 
1204
@@ -625,6 +625,7 @@
1205
1205
                                the AUTOINC lock on this table. */
1206
1206
                                /* @} */
1207
1207
        /*----------------------*/
1296
1296
diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
1297
1297
--- a/storage/innobase/include/srv0srv.h        2010-12-04 15:37:50.591516341 +0900
1298
1298
+++ b/storage/innobase/include/srv0srv.h        2010-12-04 15:38:18.180563749 +0900
1299
 
@@ -242,6 +242,7 @@
 
1299
@@ -243,6 +243,7 @@
1300
1300
 extern ulint   srv_adaptive_flushing_method;
1301
1301
 
1302
1302
 extern ulint   srv_expand_import;
1371
1371
diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
1372
1372
--- a/storage/innobase/srv/srv0srv.c    2010-12-04 15:37:50.602481253 +0900
1373
1373
+++ b/storage/innobase/srv/srv0srv.c    2010-12-04 15:38:18.209513823 +0900
1374
 
@@ -430,6 +430,7 @@
 
1374
@@ -434,6 +434,7 @@
1375
1375
 UNIV_INTERN ulint      srv_adaptive_flushing_method = 0; /* 0: native  1: estimate  2: keep_average */
1376
1376
 
1377
1377
 UNIV_INTERN ulint      srv_expand_import = 0; /* 0:disable 1:enable */
1382
1382
diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
1383
1383
--- a/storage/innobase/srv/srv0start.c  2010-12-04 15:37:50.605491300 +0900
1384
1384
+++ b/storage/innobase/srv/srv0start.c  2010-12-04 15:38:18.212513722 +0900
1385
 
@@ -2141,6 +2141,13 @@
 
1385
@@ -2144,6 +2144,13 @@
1386
1386
 
1387
1387
        os_fast_mutex_free(&srv_os_test_mutex);
1388
1388