]> git.pld-linux.org Git - packages/mysql.git/blobdiff - innodb_pass_corrupt_table.patch
- up to 5.5.18
[packages/mysql.git] / innodb_pass_corrupt_table.patch
index bf18308d23efd5cb2db9be946d475219b23775a9..c6b8e76ef66de8fe49ba31b64305beaf0fceb942 100644 (file)
@@ -5,13 +5,12 @@
 #!!! notice !!!
 # Any small change to this file in the main branch
 # should be done or reviewed by the maintainer!
-diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
---- a/storage/innobase/btr/btr0btr.c   2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/btr/btr0btr.c   2010-12-04 15:38:18.110513593 +0900
-@@ -137,6 +137,12 @@
-       root_page_no = dict_index_get_page(index);
+--- a/storage/innobase/btr/btr0btr.c
++++ b/storage/innobase/btr/btr0btr.c
+@@ -692,6 +692,12 @@
  
-       block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
+       block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH,
+                             index, mtr);
 +
 +      if (srv_pass_corrupt_table && !block) {
 +              return(0);
@@ -21,7 +20,7 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
        ut_a((ibool)!!page_is_comp(buf_block_get_frame(block))
             == dict_table_is_comp(index->table));
  #ifdef UNIV_BTR_DEBUG
-@@ -422,6 +428,12 @@
+@@ -978,6 +984,12 @@
  
        root = btr_root_get(index, &mtr);
  
@@ -34,24 +33,24 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
        if (flag == BTR_N_LEAF_PAGES) {
                seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
  
-@@ -869,6 +881,13 @@
-       mtr_start(&mtr);
+@@ -1437,6 +1449,13 @@
  
-       root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr);
+       root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH,
+                           NULL, &mtr);
 +
 +      if (srv_pass_corrupt_table && !root) {
 +              mtr_commit(&mtr);
 +              return;
 +      }
 +      ut_a(root);
-+      
++
  #ifdef UNIV_BTR_DEBUG
        ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
                                    + root, space));
-@@ -891,6 +910,12 @@
-       mtr_start(&mtr);
+@@ -1460,6 +1479,12 @@
  
-       root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr);
+       root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH,
+                           NULL, &mtr);
 +
 +      if (srv_pass_corrupt_table && !root) {
 +              mtr_commit(&mtr);
@@ -61,9 +60,9 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
  #ifdef UNIV_BTR_DEBUG
        ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
                                    + root, space));
-@@ -924,6 +949,11 @@
-       block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
+@@ -1493,6 +1518,11 @@
+       block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH,
+                             NULL, mtr);
  
 +      if (srv_pass_corrupt_table && !block) {
 +              return;
@@ -73,13 +72,12 @@ diff -ruN a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
        btr_search_drop_page_hash_index(block);
  
        header = buf_block_get_frame(block) + PAGE_HEADER + PAGE_BTR_SEG_TOP;
-diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
---- a/storage/innobase/btr/btr0cur.c   2010-12-03 17:30:16.239038936 +0900
-+++ b/storage/innobase/btr/btr0cur.c   2010-12-04 15:38:18.114551906 +0900
-@@ -238,6 +238,11 @@
-       case BTR_MODIFY_LEAF:
+--- a/storage/innobase/btr/btr0cur.c
++++ b/storage/innobase/btr/btr0cur.c
+@@ -251,6 +251,11 @@
                mode = latch_mode == BTR_SEARCH_LEAF ? RW_S_LATCH : RW_X_LATCH;
-               get_block = btr_block_get(space, zip_size, page_no, mode, mtr);
+               get_block = btr_block_get(
+                       space, zip_size, page_no, mode, cursor->index, mtr);
 +
 +              if (srv_pass_corrupt_table && !get_block) {
 +                      return;
@@ -88,10 +86,10 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
  #ifdef UNIV_BTR_DEBUG
                ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
  #endif /* UNIV_BTR_DEBUG */
-@@ -251,6 +256,11 @@
-                       get_block = btr_block_get(space, zip_size,
-                                                 left_page_no,
-                                                 RW_X_LATCH, mtr);
+@@ -264,6 +269,11 @@
+                       get_block = btr_block_get(
+                               space, zip_size, left_page_no,
+                               RW_X_LATCH, cursor->index, mtr);
 +
 +                      if (srv_pass_corrupt_table && !get_block) {
 +                              return;
@@ -100,10 +98,10 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
  #ifdef UNIV_BTR_DEBUG
                        ut_a(page_is_comp(get_block->frame)
                             == page_is_comp(page));
-@@ -262,6 +272,11 @@
-               get_block = btr_block_get(space, zip_size, page_no,
-                                         RW_X_LATCH, mtr);
+@@ -276,6 +286,11 @@
+               get_block = btr_block_get(
+                       space, zip_size, page_no,
+                       RW_X_LATCH, cursor->index, mtr);
 +
 +              if (srv_pass_corrupt_table && !get_block) {
 +                      return;
@@ -112,10 +110,10 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
  #ifdef UNIV_BTR_DEBUG
                ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
  #endif /* UNIV_BTR_DEBUG */
-@@ -273,6 +288,11 @@
-                       get_block = btr_block_get(space, zip_size,
-                                                 right_page_no,
-                                                 RW_X_LATCH, mtr);
+@@ -287,6 +302,11 @@
+                       get_block = btr_block_get(
+                               space, zip_size, right_page_no,
+                               RW_X_LATCH, cursor->index, mtr);
 +
 +                      if (srv_pass_corrupt_table && !get_block) {
 +                              return;
@@ -124,9 +122,9 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
  #ifdef UNIV_BTR_DEBUG
                        ut_a(page_is_comp(get_block->frame)
                             == page_is_comp(page));
-@@ -294,6 +314,11 @@
-                       get_block = btr_block_get(space, zip_size,
-                                                 left_page_no, mode, mtr);
+@@ -309,6 +329,11 @@
+                               space, zip_size,
+                               left_page_no, mode, cursor->index, mtr);
                        cursor->left_block = get_block;
 +
 +                      if (srv_pass_corrupt_table && !get_block) {
@@ -136,10 +134,10 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
  #ifdef UNIV_BTR_DEBUG
                        ut_a(page_is_comp(get_block->frame)
                             == page_is_comp(page));
-@@ -304,6 +329,11 @@
-               }
+@@ -320,6 +345,11 @@
  
-               get_block = btr_block_get(space, zip_size, page_no, mode, mtr);
+               get_block = btr_block_get(
+                       space, zip_size, page_no, mode, cursor->index, mtr);
 +
 +              if (srv_pass_corrupt_table && !get_block) {
 +                      return;
@@ -148,7 +146,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
  #ifdef UNIV_BTR_DEBUG
                ut_a(page_is_comp(get_block->frame) == page_is_comp(page));
  #endif /* UNIV_BTR_DEBUG */
-@@ -576,6 +606,19 @@
+@@ -592,6 +622,19 @@
                file, line, mtr);
  
        if (block == NULL) {
@@ -168,7 +166,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
                /* This must be a search to perform an insert/delete
                mark/ delete; try using the insert/delete buffer */
  
-@@ -650,6 +693,16 @@
+@@ -666,6 +709,16 @@
        block->check_index_page_at_flush = TRUE;
        page = buf_block_get_frame(block);
  
@@ -185,7 +183,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
        if (rw_latch != RW_NO_LATCH) {
  #ifdef UNIV_ZIP_DEBUG
                const page_zip_des_t*   page_zip
-@@ -854,6 +907,17 @@
+@@ -872,6 +925,17 @@
                                         RW_NO_LATCH, NULL, BUF_GET,
                                         file, line, mtr);
                page = buf_block_get_frame(block);
@@ -203,7 +201,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
                ut_ad(index->id == btr_page_get_index_id(page));
  
                block->check_index_page_at_flush = TRUE;
-@@ -974,6 +1038,14 @@
+@@ -992,6 +1056,14 @@
                                         RW_NO_LATCH, NULL, BUF_GET,
                                         file, line, mtr);
                page = buf_block_get_frame(block);
@@ -218,7 +216,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
                ut_ad(index->id == btr_page_get_index_id(page));
  
                if (height == ULINT_UNDEFINED) {
-@@ -1288,6 +1360,12 @@
+@@ -1205,6 +1277,12 @@
        *big_rec = NULL;
  
        block = btr_cur_get_block(cursor);
@@ -231,7 +229,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
        page = buf_block_get_frame(block);
        index = cursor->index;
        zip_size = buf_block_get_zip_size(block);
-@@ -3013,6 +3091,11 @@
+@@ -2937,6 +3015,11 @@
  
        block = btr_cur_get_block(cursor);
  
@@ -243,7 +241,7 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
        ut_ad(page_is_leaf(buf_block_get_frame(block)));
  
        rec = btr_cur_get_rec(cursor);
-@@ -3817,6 +3900,11 @@
+@@ -3645,6 +3728,11 @@
  
                page = btr_cur_get_page(&cursor);
  
@@ -252,12 +250,11 @@ diff -ruN a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
 +              }
 +              ut_a(page);
 +
-               supremum = page_get_supremum_rec(page);
-               if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS && is_first_page) {
-                       /* the cursor should be the first record of the page. */
-diff -ruN a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
---- a/storage/innobase/btr/btr0pcur.c  2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/btr/btr0pcur.c  2010-12-04 15:38:18.116563877 +0900
+               rec = page_rec_get_next(page_get_infimum_rec(page));
+               if (!page_rec_is_supremum(rec)) {
+--- a/storage/innobase/btr/btr0pcur.c
++++ b/storage/innobase/btr/btr0pcur.c
 @@ -32,7 +32,7 @@
  #include "ut0byte.h"
  #include "rem0cmp.h"
@@ -280,9 +277,9 @@ diff -ruN a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
        index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
  
        page_cursor = btr_pcur_get_page_cur(cursor);
-@@ -419,6 +425,15 @@
-       next_block = btr_block_get(space, zip_size, next_page_no,
-                                  cursor->latch_mode, mtr);
+@@ -395,6 +401,15 @@
+                                  cursor->latch_mode,
+                                  btr_pcur_get_btr_cur(cursor)->index, mtr);
        next_page = buf_block_get_frame(next_block);
 +
 +      if (srv_pass_corrupt_table && !next_page) {
@@ -296,9 +293,8 @@ diff -ruN a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
  #ifdef UNIV_BTR_DEBUG
        ut_a(page_is_comp(next_page) == page_is_comp(page));
        ut_a(btr_page_get_prev(next_page, mtr)
-diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
---- a/storage/innobase/btr/btr0sea.c   2010-12-03 15:49:59.166193407 +0900
-+++ b/storage/innobase/btr/btr0sea.c   2010-12-04 15:38:18.118548961 +0900
+--- a/storage/innobase/btr/btr0sea.c
++++ b/storage/innobase/btr/btr0sea.c
 @@ -42,7 +42,7 @@
  #include "btr0pcur.h"
  #include "btr0btr.h"
@@ -306,9 +302,9 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
 -
 +#include "srv0srv.h"
  /** Flag: has the search system been enabled?
- Protected by btr_search_latch and btr_search_enabled_mutex. */
+ Protected by btr_search_latch. */
  UNIV_INTERN char              btr_search_enabled      = TRUE;
-@@ -607,6 +607,11 @@
+@@ -609,6 +609,11 @@
  
        block = btr_cur_get_block(cursor);
  
@@ -320,9 +316,8 @@ diff -ruN a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
        /* NOTE that the following two function calls do NOT protect
        info or block->n_fields etc. with any semaphore, to save CPU time!
        We cannot assume the fields are consistent when we return from
-diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
---- a/storage/innobase/buf/buf0buf.c   2010-12-04 15:37:50.554565654 +0900
-+++ b/storage/innobase/buf/buf0buf.c   2010-12-04 15:38:18.119548922 +0900
+--- a/storage/innobase/buf/buf0buf.c
++++ b/storage/innobase/buf/buf0buf.c
 @@ -52,6 +52,7 @@
  #include "log0recv.h"
  #include "page0zip.h"
@@ -331,7 +326,7 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
  
  /* prototypes for new functions added to ha_innodb.cc */
  trx_t* innobase_get_trx();
-@@ -1131,6 +1132,11 @@
+@@ -1134,6 +1135,11 @@
                        ready = buf_flush_ready_for_replace(&block->page);
                        mutex_exit(&block->mutex);
  
@@ -343,55 +338,43 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                        if (!ready) {
  
                                return(block);
-@@ -2476,6 +2482,14 @@
+@@ -1910,6 +1916,13 @@
                return(NULL);
        }
  
-+      if (srv_pass_corrupt_table) {
++      if (srv_pass_corrupt_table <= 1) {
 +              if (bpage->is_corrupt) {
 +                      rw_lock_s_unlock(&buf_pool->page_hash_latch);
 +                      return(NULL);
 +              }
 +      }
-+      ut_a(!(bpage->is_corrupt));
 +
        block_mutex = buf_page_get_mutex_enter(bpage);
  
        rw_lock_s_unlock(&buf_pool->page_hash_latch);
-@@ -3023,6 +3037,14 @@
+@@ -2489,6 +2502,13 @@
                return(NULL);
        }
  
-+      if (srv_pass_corrupt_table) {
++      if (srv_pass_corrupt_table <= 1) {
 +              if (block->page.is_corrupt) {
 +                      mutex_exit(block_mutex);
 +                      return(NULL);
 +              }
 +      }
-+      ut_a(!(block->page.is_corrupt));
 +
        switch (buf_block_get_state(block)) {
                buf_page_t*     bpage;
                ibool           success;
-@@ -3690,6 +3712,7 @@
+@@ -3163,6 +3183,7 @@
        bpage->newest_modification = 0;
        bpage->oldest_modification = 0;
        HASH_INVALIDATE(bpage, hash);
 +      bpage->is_corrupt = FALSE;
- #ifdef UNIV_DEBUG_FILE_ACCESSES
+ #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
        bpage->file_page_was_freed = FALSE;
- #endif /* UNIV_DEBUG_FILE_ACCESSES */
-@@ -4200,7 +4223,8 @@
- void
- buf_page_io_complete(
- /*=================*/
--      buf_page_t*     bpage)  /*!< in: pointer to the block in question */
-+      buf_page_t*     bpage,  /*!< in: pointer to the block in question */
-+      trx_t*          trx)
- {
-       enum buf_io_fix io_type;
-       buf_pool_t*     buf_pool = buf_pool_from_bpage(bpage);
-@@ -4279,6 +4303,7 @@
+ #endif /* UNIV_DEBUG_FILE_ACCESSES || UNIV_DEBUG */
+@@ -3801,6 +3822,7 @@
                                (ulong) bpage->offset);
                }
  
@@ -399,35 +382,39 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                /* From version 3.23.38 up we store the page checksum
                to the 4 first bytes of the page end lsn field */
  
-@@ -4320,6 +4345,19 @@
+@@ -3842,6 +3864,23 @@
                              REFMAN "forcing-innodb-recovery.html\n"
                              "InnoDB: about forcing recovery.\n", stderr);
  
 +                      if (srv_pass_corrupt_table && !trx_sys_sys_space(bpage->space)
 +                          && bpage->space < SRV_LOG_SPACE_FIRST_ID) {
++                              trx_t*  trx;
++
 +                              fprintf(stderr,
 +                                      "InnoDB: space %u will be treated as corrupt.\n",
 +                                      bpage->space);
 +                              fil_space_set_corrupt(bpage->space);
-+                              if (trx && trx->dict_operation_lock_mode == 0) {
-+                                      dict_table_set_corrupt_by_space(bpage->space, TRUE);
-+                              } else {
++
++                              trx = innobase_get_trx();
++                              if (trx && trx->dict_operation_lock_mode == RW_X_LATCH) {
 +                                      dict_table_set_corrupt_by_space(bpage->space, FALSE);
++                              } else {
++                                      dict_table_set_corrupt_by_space(bpage->space, TRUE);
 +                              }
 +                              bpage->is_corrupt = TRUE;
 +                      } else
                        if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
-                               fputs("InnoDB: Ending processing because of"
-                                     " a corrupt database page.\n",
-@@ -4327,6 +4365,7 @@
-                               exit(1);
+                               /* If page space id is larger than TRX_SYS_SPACE
+                               (0), we will attempt to mark the corresponding
+@@ -3858,6 +3897,7 @@
+                               }
                        }
                }
 +              } /**/
  
                if (recv_recovery_is_on()) {
                        /* Pages must be uncompressed for crash recovery. */
-@@ -4336,8 +4375,11 @@
+@@ -3867,8 +3907,11 @@
  
                if (uncompressed && !recv_no_ibuf_operations) {
                        ibuf_merge_or_delete_for_page(
@@ -439,10 +426,9 @@ diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
                                TRUE);
                }
        }
-diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
---- a/storage/innobase/buf/buf0rea.c   2010-12-04 15:37:50.557553380 +0900
-+++ b/storage/innobase/buf/buf0rea.c   2010-12-04 15:41:09.784467585 +0900
-@@ -193,12 +193,19 @@
+--- a/storage/innobase/buf/buf0rea.c
++++ b/storage/innobase/buf/buf0rea.c
+@@ -195,7 +195,14 @@
                              ((buf_block_t*) bpage)->frame, bpage, trx);
        }
        thd_wait_end(NULL);
@@ -457,24 +443,17 @@ diff -ruN a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
  
        if (sync) {
                /* The i/o is already completed when we arrive from
-               fil_read */
--              buf_page_io_complete(bpage);
-+              buf_page_io_complete(bpage, trx);
-       }
-       return(1);
-diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
---- a/storage/innobase/dict/dict0dict.c        2010-12-03 17:30:16.248987063 +0900
-+++ b/storage/innobase/dict/dict0dict.c        2010-12-04 15:45:23.808513973 +0900
+--- a/storage/innobase/dict/dict0dict.c
++++ b/storage/innobase/dict/dict0dict.c
 @@ -55,6 +55,7 @@
- #include "srv0srv.h" /* srv_lower_case_table_names */
  #include "m_ctype.h" /* my_isspace() */
  #include "ha_prototypes.h" /* innobase_strcasecmp(), innobase_casedn_str()*/
+ #include "row0upd.h"
 +#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */
  
  #include <ctype.h>
  
-@@ -751,7 +752,7 @@
+@@ -750,7 +751,7 @@
  
        mutex_exit(&(dict_sys->mutex));
  
@@ -483,7 +462,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
                /* If table->ibd_file_missing == TRUE, this will
                print an error message and return without doing
                anything. */
-@@ -1294,7 +1295,7 @@
+@@ -1293,7 +1294,7 @@
                    + dict_sys->size) > srv_dict_size_limit ) {
                prev_table = UT_LIST_GET_PREV(table_LRU, table);
  
@@ -492,7 +471,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
                        goto next_loop;
  
                cached_foreign_tables = 0;
-@@ -4327,6 +4328,12 @@
+@@ -4367,6 +4368,12 @@
        heap = mem_heap_create(1000);
  
        while (index) {
@@ -505,7 +484,7 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
                size = btr_get_size(index, BTR_TOTAL_SIZE);
  
                index->stat_index_size = size;
-@@ -4446,6 +4453,12 @@
+@@ -4514,6 +4521,12 @@
        heap = mem_heap_create(1000);
  
        while (index) {
@@ -518,22 +497,23 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
  /*===========================================*/
  {
        dict_table_t*   sys_stats;
-@@ -4611,6 +4624,12 @@
+@@ -4706,6 +4719,13 @@
                     || (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
                         && dict_index_is_clust(index)))) {
                        ulint   size;
 +
 +                      if (table->is_corrupt) {
 +                              ut_a(srv_pass_corrupt_table);
++                              dict_table_stats_unlock(table, RW_X_LATCH);
 +                              return;
 +                      }
 +
                        size = btr_get_size(index, BTR_TOTAL_SIZE);
  
                        index->stat_index_size = size;
-@@ -5331,4 +5350,42 @@
-               rw_lock_free(&dict_table_stats_latches[i]);
-       }
+@@ -5685,4 +5705,42 @@
+       index->type |= DICT_CORRUPT;
  }
 +
 +/*************************************************************************
@@ -574,10 +554,9 @@ diff -ruN a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.
 +      }
 +}
  #endif /* !UNIV_HOTBACKUP */
-diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c
---- a/storage/innobase/dict/dict0mem.c 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/dict/dict0mem.c 2010-12-04 15:38:18.126549463 +0900
-@@ -94,6 +94,8 @@
+--- a/storage/innobase/dict/dict0mem.c
++++ b/storage/innobase/dict/dict0mem.c
+@@ -96,6 +96,8 @@
        /* The number of transactions that are either waiting on the
        AUTOINC lock or have been granted the lock. */
        table->n_waiting_or_granted_auto_inc_locks = 0;
@@ -586,10 +565,9 @@ diff -ruN a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c
  #endif /* !UNIV_HOTBACKUP */
  
        ut_d(table->magic_n = DICT_TABLE_MAGIC_N);
-diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
---- a/storage/innobase/fil/fil0fil.c   2010-12-04 15:37:50.564551587 +0900
-+++ b/storage/innobase/fil/fil0fil.c   2010-12-04 15:38:18.128549252 +0900
-@@ -233,6 +233,7 @@
+--- a/storage/innobase/fil/fil0fil.c
++++ b/storage/innobase/fil/fil0fil.c
+@@ -235,6 +235,7 @@
                                file we have written to */
        ibool           is_in_unflushed_spaces; /*!< TRUE if this space is
                                currently in unflushed_spaces */
@@ -597,7 +575,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        UT_LIST_NODE_T(fil_space_t) space_list;
                                /*!< list of all spaces */
        ulint           magic_n;/*!< FIL_SPACE_MAGIC_N */
-@@ -1291,6 +1292,8 @@
+@@ -1294,6 +1295,8 @@
                    ut_fold_string(name), space);
        space->is_in_unflushed_spaces = FALSE;
  
@@ -606,18 +584,18 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
  
        mutex_exit(&fil_system->mutex);
-@@ -4945,6 +4948,22 @@
+@@ -5268,6 +5271,34 @@
        ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
        ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
  
-+      if (srv_pass_corrupt_table && space->is_corrupt) {
++      if (srv_pass_corrupt_table == 1 && space->is_corrupt) {
 +              /* should ignore i/o for the crashed space */
 +              mutex_enter(&fil_system->mutex);
 +              fil_node_complete_io(node, fil_system, type);
 +              mutex_exit(&fil_system->mutex);
 +              if (mode == OS_AIO_NORMAL) {
 +                      ut_a(space->purpose == FIL_TABLESPACE);
-+                      buf_page_io_complete(message, trx);
++                      buf_page_io_complete(message);
 +              }
 +              if (type == OS_FILE_READ) {
 +                      return(DB_TABLESPACE_DELETED);
@@ -625,11 +603,23 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +                      return(DB_SUCCESS);
 +              }
 +      } else {
-+              ut_a(!space->is_corrupt);
++              if (srv_pass_corrupt_table > 1 && space->is_corrupt) {
++                      /* should ignore write i/o for the crashed space */
++                      if (type == OS_FILE_WRITE) {
++                              mutex_enter(&fil_system->mutex);
++                              fil_node_complete_io(node, fil_system, type);
++                              mutex_exit(&fil_system->mutex);
++                              if (mode == OS_AIO_NORMAL) {
++                                      ut_a(space->purpose == FIL_TABLESPACE);
++                                      buf_page_io_complete(message);
++                              }
++                              return(DB_SUCCESS);
++                      }
++              }
  #ifdef UNIV_HOTBACKUP
        /* In ibbackup do normal i/o, not aio */
        if (type == OS_FILE_READ) {
-@@ -4959,6 +4978,8 @@
+@@ -5282,6 +5313,8 @@
        ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
                     offset_low, offset_high, len, node, message, trx);
  #endif
@@ -638,16 +628,7 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
        ut_a(ret);
  
        if (mode == OS_AIO_SYNC) {
-@@ -5100,7 +5121,7 @@
-       if (fil_node->space->purpose == FIL_TABLESPACE) {
-               srv_set_io_thread_op_info(segment, "complete io for buf page");
--              buf_page_io_complete(message);
-+              buf_page_io_complete(message, NULL);
-       } else {
-               srv_set_io_thread_op_info(segment, "complete io for log");
-               log_io_complete(message);
-@@ -5454,3 +5475,46 @@
+@@ -5782,3 +5815,46 @@
                 return 0;
         }
  }
@@ -694,9 +675,8 @@ diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
 +      mutex_exit(&fil_system->mutex);
 +}
 +
-diff -ruN a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
---- a/storage/innobase/fsp/fsp0fsp.c   2010-12-04 15:37:50.569480615 +0900
-+++ b/storage/innobase/fsp/fsp0fsp.c   2010-12-04 15:38:18.131550103 +0900
+--- a/storage/innobase/fsp/fsp0fsp.c
++++ b/storage/innobase/fsp/fsp0fsp.c
 @@ -369,6 +369,12 @@
        ut_ad(id || !zip_size);
  
@@ -805,14 +785,13 @@ diff -ruN a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
        descr = fseg_get_first_extent(inode, space, zip_size, mtr);
  
        if (descr != NULL) {
-diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
---- a/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:37:50.578486593 +0900
-+++ b/storage/innobase/handler/ha_innodb.cc    2010-12-04 15:38:18.137549396 +0900
-@@ -3928,6 +3928,12 @@
+--- a/storage/innobase/handler/ha_innodb.cc
++++ b/storage/innobase/handler/ha_innodb.cc
+@@ -4011,6 +4011,12 @@
                DBUG_RETURN(1);
        }
  
-+      if (share->ib_table && share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table && share->ib_table->is_corrupt) {
 +              free_share(share);
 +
 +              DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
@@ -821,27 +800,27 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        /* Create buffers for packing the fields of a record. Why
        table->reclength did not work here? Obviously, because char
        fields when packed actually became 1 byte longer, when we also
-@@ -3955,6 +3961,19 @@
+@@ -4038,6 +4044,19 @@
        /* Get pointer to a table object in InnoDB dictionary cache */
        ib_table = dict_table_get(norm_name, TRUE);
        
-+      if (ib_table && ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && ib_table && ib_table->is_corrupt) {
 +              free_share(share);
 +              my_free(upd_buff);
 +
 +              DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
 +      }
 +
-+      if (share->ib_table) {
-+              ut_a(share->ib_table == ib_table);
-+      } else {
-+              share->ib_table = ib_table;
-+      }
++      share->ib_table = ib_table;
++
++
++
++
 +
        if (NULL == ib_table) {
                if (is_part && retries < 10) {
                        ++retries;
-@@ -5119,6 +5138,10 @@
+@@ -5187,6 +5206,10 @@
  
        ha_statistic_increment(&SSV::ha_write_count);
  
@@ -852,7 +831,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
                table->timestamp_field->set_time();
  
-@@ -5336,6 +5359,10 @@
+@@ -5404,6 +5427,10 @@
  func_exit:
        innobase_active_small();
  
@@ -863,7 +842,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(error_result);
  }
  
-@@ -5512,6 +5539,10 @@
+@@ -5581,6 +5608,10 @@
  
        ha_statistic_increment(&SSV::ha_update_count);
  
@@ -874,7 +853,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
                table->timestamp_field->set_time();
  
-@@ -5601,6 +5632,10 @@
+@@ -5670,6 +5701,10 @@
  
        innobase_active_small();
  
@@ -885,7 +864,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(error);
  }
  
-@@ -5622,6 +5657,10 @@
+@@ -5691,6 +5726,10 @@
  
        ha_statistic_increment(&SSV::ha_delete_count);
  
@@ -896,7 +875,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (!prebuilt->upd_node) {
                row_get_prebuilt_update_vector(prebuilt);
        }
-@@ -5648,6 +5687,10 @@
+@@ -5717,6 +5756,10 @@
  
        innobase_active_small();
  
@@ -907,62 +886,62 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(error);
  }
  
-@@ -5887,6 +5930,10 @@
+@@ -5956,6 +5999,10 @@
  
        ha_statistic_increment(&SSV::ha_read_key_count);
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        index = prebuilt->index;
  
-       if (UNIV_UNLIKELY(index == NULL)) {
-@@ -5952,6 +5999,10 @@
+       if (UNIV_UNLIKELY(index == NULL) || dict_index_is_corrupted(index)) {
+@@ -6023,6 +6070,10 @@
                ret = DB_UNSUPPORTED;
        }
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        switch (ret) {
        case DB_SUCCESS:
                error = 0;
-@@ -6067,6 +6118,10 @@
+@@ -6138,6 +6189,10 @@
  {
        DBUG_ENTER("change_active_index");
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        ut_ad(user_thd == ha_thd());
        ut_a(prebuilt->trx == thd_to_trx(user_thd));
  
-@@ -6157,6 +6212,10 @@
+@@ -6251,6 +6306,10 @@
  
        DBUG_ENTER("general_fetch");
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        ut_a(prebuilt->trx == thd_to_trx(user_thd));
  
        innodb_srv_conc_enter_innodb(prebuilt->trx);
-@@ -6166,6 +6225,10 @@
+@@ -6260,6 +6319,10 @@
  
        innodb_srv_conc_exit_innodb(prebuilt->trx);
  
-+      if (share->ib_table->is_corrupt) {
++      if (srv_pass_corrupt_table <= 1 && share->ib_table->is_corrupt) {
 +              DBUG_RETURN(HA_ERR_CRASHED);
 +      }
 +
        switch (ret) {
        case DB_SUCCESS:
                error = 0;
-@@ -7436,10 +7499,18 @@
+@@ -7526,10 +7589,18 @@
  
        update_thd(ha_thd());
  
@@ -981,7 +960,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        error = convert_error_code_to_mysql(error, prebuilt->table->flags,
                                            NULL);
  
-@@ -7944,6 +8015,16 @@
+@@ -8034,6 +8105,16 @@
        return(ranges + (double) rows / (double) total_rows * time_for_scan);
  }
  
@@ -998,7 +977,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
  /*********************************************************************//**
  Calculates the key number used inside MySQL for an Innobase index. We will
  first check the "index translation table" for a match of the index to get
-@@ -8062,7 +8143,7 @@
+@@ -8211,7 +8292,7 @@
        ib_table = prebuilt->table;
  
        if (flag & HA_STATUS_TIME) {
@@ -1007,7 +986,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
                        /* In sql_show we call with this flag: update
                        then statistics so that they are up-to-date */
  
-@@ -8356,10 +8437,18 @@
+@@ -8511,10 +8592,18 @@
        THD*            thd,            /*!< in: connection thread handle */
        HA_CHECK_OPT*   check_opt)      /*!< in: currently ignored */
  {
@@ -1026,7 +1005,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        return(0);
  }
  
-@@ -8541,6 +8630,10 @@
+@@ -8747,6 +8836,10 @@
                my_error(ER_QUERY_INTERRUPTED, MYF(0));
        }
  
@@ -1037,7 +1016,7 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
  }
  
-@@ -9311,6 +9404,10 @@
+@@ -9517,6 +9610,10 @@
  
        update_thd(thd);
  
@@ -1048,32 +1027,43 @@ diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_
        if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) {
                ut_print_timestamp(stderr);
                fprintf(stderr,
-@@ -11720,6 +11817,14 @@
-   "0 (the default) disables automatic dumps.",
-   NULL, NULL, 0, 0, UINT_MAX32, 0);
+@@ -11941,6 +12038,26 @@
+   "dump file (if present). Disabled by default.",
+   NULL, NULL, FALSE);
  
-+static        MYSQL_SYSVAR_ULONG(pass_corrupt_table, srv_pass_corrupt_table,
++const char *corrupt_table_action_names[]=
++{
++  "assert", /* 0 */
++  "warn", /* 1 */
++  "salvage", /* 2 */
++  NullS
++};
++TYPELIB corrupt_table_action_typelib=
++{
++  array_elements(corrupt_table_action_names) - 1, "corrupt_table_action_typelib",
++  corrupt_table_action_names, NULL
++};
++static        MYSQL_SYSVAR_ENUM(corrupt_table_action, srv_pass_corrupt_table,
 +  PLUGIN_VAR_RQCMDARG,
-+  "Pass corruptions of user tables as 'corrupt table' instead of not crashing itself, "
++  "Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, "
 +  "when used with file_per_table. "
 +  "All file io for the datafile after detected as corrupt are disabled, "
 +  "except for the deletion.",
-+  NULL, NULL, 0, 0, 1, 0);
++  NULL, NULL, 0, &corrupt_table_action_typelib);
 +
  static struct st_mysql_sys_var* innobase_system_variables[]= {
    MYSQL_SYSVAR(additional_mem_pool_size),
    MYSQL_SYSVAR(autoextend_increment),
-@@ -11806,6 +11911,7 @@
-   MYSQL_SYSVAR(auto_lru_dump),
+@@ -12031,6 +12148,7 @@
    MYSQL_SYSVAR(purge_threads),
    MYSQL_SYSVAR(purge_batch_size),
-+  MYSQL_SYSVAR(pass_corrupt_table),
+   MYSQL_SYSVAR(rollback_segments),
++  MYSQL_SYSVAR(corrupt_table_action),
    NULL
  };
  
-diff -ruN a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
---- a/storage/innobase/handler/ha_innodb.h     2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/handler/ha_innodb.h     2010-12-04 15:38:18.159588579 +0900
+--- a/storage/innobase/handler/ha_innodb.h
++++ b/storage/innobase/handler/ha_innodb.h
 @@ -52,6 +52,7 @@
        innodb_idx_translate_t  idx_trans_tbl;  /*!< index translation
                                                table between MySQL and
@@ -1090,9 +1080,8 @@ diff -ruN a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_i
  
        int write_row(uchar * buf);
        int update_row(const uchar * old_data, uchar * new_data);
-diff -ruN a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
---- a/storage/innobase/include/btr0btr.ic      2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/btr0btr.ic      2010-12-04 15:38:18.162515035 +0900
+--- a/storage/innobase/include/btr0btr.ic
++++ b/storage/innobase/include/btr0btr.ic
 @@ -28,7 +28,7 @@
  #include "mtr0mtr.h"
  #include "mtr0log.h"
@@ -1102,7 +1091,7 @@ diff -ruN a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0b
  #define BTR_MAX_NODE_LEVEL    50      /*!< Maximum B-tree page level
                                        (not really a hard limit).
                                        Used in debug assertions
-@@ -55,7 +55,9 @@
+@@ -59,7 +59,9 @@
        block = buf_page_get_gen(space, zip_size, page_no, mode,
                                 NULL, BUF_GET, file, line, mtr);
  
@@ -1111,12 +1100,11 @@ diff -ruN a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0b
 +
 +      if (block && mode != RW_NO_LATCH) {
  
-               buf_block_dbg_add_level(block, SYNC_TREE_NODE);
-       }
-diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
---- a/storage/innobase/include/buf0buf.h       2010-12-03 15:49:59.218956083 +0900
-+++ b/storage/innobase/include/buf0buf.h       2010-12-04 15:38:18.164513667 +0900
-@@ -984,7 +984,7 @@
+               buf_block_dbg_add_level(
+                       block, index != NULL && dict_index_is_ibuf(index)
+--- a/storage/innobase/include/buf0buf.h
++++ b/storage/innobase/include/buf0buf.h
+@@ -1003,7 +1003,7 @@
        const buf_block_t*      block)  /*!< in: pointer to the control block */
        __attribute__((pure));
  #else /* UNIV_DEBUG */
@@ -1125,27 +1113,16 @@ diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0bu
  #endif /* UNIV_DEBUG */
  /*********************************************************************//**
  Gets the space id of a block.
-@@ -1116,7 +1116,8 @@
- void
- buf_page_io_complete(
- /*=================*/
--      buf_page_t*     bpage); /*!< in: pointer to the block in question */
-+      buf_page_t*     bpage,  /*!< in: pointer to the block in question */
-+      trx_t*          trx);
- /********************************************************************//**
- Calculates a folded value of a file page address to use in the page hash
- table.
-@@ -1431,6 +1432,7 @@
+@@ -1450,6 +1450,7 @@
                                        0 if the block was never accessed
                                        in the buffer pool */
        /* @} */
 +      ibool           is_corrupt;
- # ifdef UNIV_DEBUG_FILE_ACCESSES
+ # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
        ibool           file_page_was_freed;
                                        /*!< this is set to TRUE when fsp
-diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
---- a/storage/innobase/include/buf0buf.ic      2010-12-03 15:49:59.221956024 +0900
-+++ b/storage/innobase/include/buf0buf.ic      2010-12-04 15:38:18.167513925 +0900
+--- a/storage/innobase/include/buf0buf.ic
++++ b/storage/innobase/include/buf0buf.ic
 @@ -34,7 +34,7 @@
  #include "buf0flu.h"
  #include "buf0lru.h"
@@ -1155,7 +1132,7 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b
  /*********************************************************************//**
  Gets the current size of buffer buf_pool in bytes.
  @return size in bytes */
-@@ -617,6 +617,12 @@
+@@ -637,6 +637,12 @@
  /*================*/
        const buf_block_t*      block)  /*!< in: pointer to the control block */
  {
@@ -1168,12 +1145,11 @@ diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0b
        ut_ad(block);
  
        switch (buf_block_get_state(block)) {
-diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
---- a/storage/innobase/include/dict0dict.h     2010-12-03 17:30:16.306955940 +0900
-+++ b/storage/innobase/include/dict0dict.h     2010-12-04 15:38:18.169513750 +0900
-@@ -1226,6 +1226,15 @@
- dict_close(void);
- /*============*/
+--- a/storage/innobase/include/dict0dict.h
++++ b/storage/innobase/include/dict0dict.h
+@@ -1326,6 +1326,15 @@
+ /*========================*/
+       ulint           space_id);      /*!< in: space ID */
  
 +/*************************************************************************
 +set is_corrupt flag by space_id*/
@@ -1187,10 +1163,9 @@ diff -ruN a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict
  #ifndef UNIV_NONINL
  #include "dict0dict.ic"
  #endif
-diff -ruN a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
---- a/storage/innobase/include/dict0mem.h      2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/dict0mem.h      2010-12-04 15:38:18.171513956 +0900
-@@ -619,6 +619,7 @@
+--- a/storage/innobase/include/dict0mem.h
++++ b/storage/innobase/include/dict0mem.h
+@@ -670,6 +670,7 @@
                                the AUTOINC lock on this table. */
                                /* @} */
        /*----------------------*/
@@ -1198,10 +1173,9 @@ diff -ruN a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0
  #endif /* !UNIV_HOTBACKUP */
  
  #ifdef UNIV_DEBUG
-diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
---- a/storage/innobase/include/fil0fil.h       2010-12-04 15:35:29.175520016 +0900
-+++ b/storage/innobase/include/fil0fil.h       2010-12-04 15:38:18.172483391 +0900
-@@ -749,6 +749,19 @@
+--- a/storage/innobase/include/fil0fil.h
++++ b/storage/innobase/include/fil0fil.h
+@@ -750,6 +750,19 @@
  fil_system_hash_nodes(void);
  /*========================*/
  
@@ -1221,9 +1195,8 @@ diff -ruN a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fi
  typedef       struct fil_space_struct fil_space_t;
  
  #endif
-diff -ruN a/storage/innobase/include/fut0fut.ic b/storage/innobase/include/fut0fut.ic
---- a/storage/innobase/include/fut0fut.ic      2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/fut0fut.ic      2010-12-04 15:38:18.174481728 +0900
+--- a/storage/innobase/include/fut0fut.ic
++++ b/storage/innobase/include/fut0fut.ic
 @@ -23,6 +23,7 @@
  Created 12/13/1995 Heikki Tuuri
  ***********************************************************************/
@@ -1245,10 +1218,9 @@ diff -ruN a/storage/innobase/include/fut0fut.ic b/storage/innobase/include/fut0f
        ptr = buf_block_get_frame(block) + addr.boffset;
  
        buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
-diff -ruN a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
---- a/storage/innobase/include/page0page.h     2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/page0page.h     2010-12-04 15:38:18.175514037 +0900
-@@ -500,7 +500,7 @@
+--- a/storage/innobase/include/page0page.h
++++ b/storage/innobase/include/page0page.h
+@@ -497,7 +497,7 @@
  page_is_leaf(
  /*=========*/
        const page_t*   page)   /*!< in: page */
@@ -1257,9 +1229,8 @@ diff -ruN a/storage/innobase/include/page0page.h b/storage/innobase/include/page
  /************************************************************//**
  Gets the pointer to the next record on the page.
  @return       pointer to next record */
-diff -ruN a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
---- a/storage/innobase/include/page0page.ic    2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/page0page.ic    2010-12-04 15:38:18.177482672 +0900
+--- a/storage/innobase/include/page0page.ic
++++ b/storage/innobase/include/page0page.ic
 @@ -274,6 +274,9 @@
  /*=========*/
        const page_t*   page)   /*!< in: page */
@@ -1270,9 +1241,8 @@ diff -ruN a/storage/innobase/include/page0page.ic b/storage/innobase/include/pag
        return(!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL)));
  }
  
-diff -ruN a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
---- a/storage/innobase/include/page0zip.h      2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/include/page0zip.h      2010-12-04 15:38:18.179513974 +0900
+--- a/storage/innobase/include/page0zip.h
++++ b/storage/innobase/include/page0zip.h
 @@ -114,7 +114,7 @@
        const page_t*   page,   /*!< in: uncompressed page */
        dict_index_t*   index,  /*!< in: index of the B-tree node */
@@ -1282,21 +1252,19 @@ diff -ruN a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0
  
  /**********************************************************************//**
  Decompress a page.  This function should tolerate errors on the compressed
-diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
---- a/storage/innobase/include/srv0srv.h       2010-12-04 15:37:50.591516341 +0900
-+++ b/storage/innobase/include/srv0srv.h       2010-12-04 15:38:18.180563749 +0900
-@@ -242,6 +242,7 @@
+--- a/storage/innobase/include/srv0srv.h
++++ b/storage/innobase/include/srv0srv.h
+@@ -245,6 +245,7 @@
  extern ulint  srv_adaptive_flushing_method;
  
  extern ulint  srv_expand_import;
 +extern ulint  srv_pass_corrupt_table;
  
- extern ulint  srv_extra_rsegments;
  extern ulint  srv_dict_size_limit;
-diff -ruN a/storage/innobase/page/page0zip.c b/storage/innobase/page/page0zip.c
---- a/storage/innobase/page/page0zip.c 2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/page/page0zip.c 2010-12-04 15:38:18.195515935 +0900
-@@ -1153,6 +1153,10 @@
+ /*-------------------------------------------*/
+--- a/storage/innobase/page/page0zip.c
++++ b/storage/innobase/page/page0zip.c
+@@ -1195,6 +1195,10 @@
        FILE*           logfile = NULL;
  #endif
  
@@ -1307,10 +1275,9 @@ diff -ruN a/storage/innobase/page/page0zip.c b/storage/innobase/page/page0zip.c
        ut_a(page_is_comp(page));
        ut_a(fil_page_get_type(page) == FIL_PAGE_INDEX);
        ut_ad(page_simple_validate_new((page_t*) page));
-diff -ruN a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
---- a/storage/innobase/row/row0ins.c   2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/row/row0ins.c   2010-12-04 15:38:18.198514028 +0900
-@@ -1335,6 +1335,12 @@
+--- a/storage/innobase/row/row0ins.c
++++ b/storage/innobase/row/row0ins.c
+@@ -1341,6 +1341,12 @@
                const rec_t*            rec = btr_pcur_get_rec(&pcur);
                const buf_block_t*      block = btr_pcur_get_block(&pcur);
  
@@ -1323,9 +1290,8 @@ diff -ruN a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
                if (page_rec_is_infimum(rec)) {
  
                        continue;
-diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
---- a/storage/innobase/row/row0merge.c 2010-12-03 17:30:16.330986655 +0900
-+++ b/storage/innobase/row/row0merge.c 2010-12-04 15:38:18.201513966 +0900
+--- a/storage/innobase/row/row0merge.c
++++ b/storage/innobase/row/row0merge.c
 @@ -1245,6 +1245,13 @@
  
                if (UNIV_LIKELY(has_next)) {
@@ -1340,10 +1306,9 @@ diff -ruN a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c
                        offsets = rec_get_offsets(rec, clust_index, NULL,
                                                  ULINT_UNDEFINED, &row_heap);
  
-diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
---- a/storage/innobase/row/row0sel.c   2010-11-03 07:01:13.000000000 +0900
-+++ b/storage/innobase/row/row0sel.c   2010-12-04 15:38:18.205551115 +0900
-@@ -3848,6 +3848,13 @@
+--- a/storage/innobase/row/row0sel.c
++++ b/storage/innobase/row/row0sel.c
+@@ -3912,6 +3912,13 @@
        /* PHASE 4: Look for matching records in a loop */
  
        rec = btr_pcur_get_rec(pcur);
@@ -1357,21 +1322,44 @@ diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
        ut_ad(!!page_rec_is_comp(rec) == comp);
  #ifdef UNIV_SEARCH_DEBUG
        /*
-diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
---- a/storage/innobase/srv/srv0srv.c   2010-12-04 15:37:50.602481253 +0900
-+++ b/storage/innobase/srv/srv0srv.c   2010-12-04 15:38:18.209513823 +0900
-@@ -430,6 +430,7 @@
+@@ -3989,7 +3996,13 @@
+       if (UNIV_UNLIKELY(next_offs >= UNIV_PAGE_SIZE - PAGE_DIR)) {
+ wrong_offs:
+-              if (srv_force_recovery == 0 || moves_up == FALSE) {
++              if (srv_pass_corrupt_table && !trx_sys_sys_space(index->table->space)) {
++                      index->table->is_corrupt = TRUE;
++                      fil_space_set_corrupt(index->table->space);
++              }
++
++              if ((srv_force_recovery == 0 || moves_up == FALSE)
++                  && srv_pass_corrupt_table <= 1) {
+                       ut_print_timestamp(stderr);
+                       buf_page_print(page_align(rec), 0);
+                       fprintf(stderr,
+@@ -4040,7 +4053,8 @@
+       offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
+-      if (UNIV_UNLIKELY(srv_force_recovery > 0)) {
++      if (UNIV_UNLIKELY(srv_force_recovery > 0)
++          || (srv_pass_corrupt_table == 2 && index->table->is_corrupt)) {
+               if (!rec_validate(rec, offsets)
+                   || !btr_index_rec_validate(rec, index, FALSE)) {
+                       fprintf(stderr,
+--- a/storage/innobase/srv/srv0srv.c
++++ b/storage/innobase/srv/srv0srv.c
+@@ -435,6 +435,7 @@
  UNIV_INTERN ulint     srv_adaptive_flushing_method = 0; /* 0: native  1: estimate  2: keep_average */
  
  UNIV_INTERN ulint     srv_expand_import = 0; /* 0:disable 1:enable */
 +UNIV_INTERN ulint     srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
  
- UNIV_INTERN ulint     srv_extra_rsegments = 127; /* extra rseg for users */
  UNIV_INTERN ulint     srv_dict_size_limit = 0;
-diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
---- a/storage/innobase/srv/srv0start.c 2010-12-04 15:37:50.605491300 +0900
-+++ b/storage/innobase/srv/srv0start.c 2010-12-04 15:38:18.212513722 +0900
-@@ -2141,6 +2141,13 @@
+ /*-------------------------------------------*/
+--- a/storage/innobase/srv/srv0start.c
++++ b/storage/innobase/srv/srv0start.c
+@@ -2155,6 +2155,13 @@
  
        os_fast_mutex_free(&srv_os_test_mutex);
  
This page took 0.080158 seconds and 4 git commands to generate.