=== modified file 'storage/innobase/dict/dict0dict.c' --- storage/innobase/dict/dict0dict.c revid:marko.makela@oracle.com-20100630093847-7gkr1lh3bh2xksy0 +++ storage/innobase/dict/dict0dict.c 2010-08-11 11:48:31 +0000 @@ -3773,7 +3773,7 @@ dict_update_statistics_low( /* If we have set a high innodb_force_recovery level, do not calculate statistics, as a badly corrupted index can cause a crash in it. */ - if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + if (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO) { return; } @@ -3789,7 +3789,7 @@ dict_update_statistics_low( return; } - while (index) { + do { size = btr_get_size(index, BTR_TOTAL_SIZE); index->stat_index_size = size; @@ -3807,8 +3807,14 @@ dict_update_statistics_low( btr_estimate_number_of_different_key_vals(index); + if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + + /* Skip secondary indexes. */ + break; + } + index = dict_table_get_next_index(index); - } + } while (index); index = dict_table_get_first_index(table); === modified file 'storage/innobase/handler/ha_innodb.cc' --- storage/innobase/handler/ha_innodb.cc revid:marko.makela@oracle.com-20100630093847-7gkr1lh3bh2xksy0 +++ storage/innobase/handler/ha_innodb.cc 2010-08-11 11:35:46 +0000 @@ -6334,16 +6334,6 @@ ha_innobase::info( statistics calculation on tables, because that may crash the server if an index is badly corrupted. */ - if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { - - /* We return success (0) instead of HA_ERR_CRASHED, - because we want MySQL to process this query and not - stop, like it would do if it received the error code - HA_ERR_CRASHED. */ - - DBUG_RETURN(0); - } - /* We do not know if MySQL can call this function before calling external_lock(). To be safe, update the thd of the current table handle. */ @@ -6442,7 +6432,8 @@ ha_innobase::info( We do not update delete_length if no locking is requested so the "old" value can remain. delete_length is initialized to 0 in the ha_statistics' constructor. */ - if (!(flag & HA_STATUS_NO_LOCK)) { + if (!(flag & HA_STATUS_NO_LOCK) + && srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { /* lock the data dictionary to avoid races with ibd_file_missing and tablespace_discarded */ @@ -6491,7 +6482,7 @@ ha_innobase::info( index = dict_table_get_first_index_noninline(ib_table); if (prebuilt->clust_index_was_generated) { - index = dict_table_get_next_index_noninline(index); + goto next_index; } for (i = 0; i < table->s->keys; i++) { @@ -6547,10 +6538,21 @@ ha_innobase::info( (ulong) rec_per_key; } +next_index: + if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + + goto func_exit; + } + index = dict_table_get_next_index_noninline(index); } } + if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + + goto func_exit; + } + if (flag & HA_STATUS_ERRKEY) { ut_a(prebuilt->trx); ut_a(prebuilt->trx->magic_n == TRX_MAGIC_N); @@ -6563,6 +6565,7 @@ ha_innobase::info( stats.auto_increment_value = innobase_peek_autoinc(); } +func_exit: prebuilt->trx->op_info = (char*)""; DBUG_RETURN(0);