579
579
dict_table_t* table;
581
if (table_id <= DICT_FIELDS_ID
582
|| trx->dict_operation_lock_mode == RW_X_LATCH) {
581
if (trx->dict_operation_lock_mode == RW_X_LATCH) {
584
583
/* Note: An X latch implies that the transaction
585
584
already owns the dictionary mutex. */
4223
/* If we have set a high innodb_force_recovery level, do not calculate
4224
statistics, as a badly corrupted index can cause a crash in it. */
4226
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
4231
4221
/* Find out the sizes of the indexes and how many different values
4232
4222
for the key they approximately have */
4243
size = btr_get_size(index, BTR_TOTAL_SIZE);
4245
index->stat_index_size = size;
4247
sum_of_index_sizes += size;
4249
size = btr_get_size(index, BTR_N_LEAF_PAGES);
4252
/* The root node of the tree is a leaf */
4235
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
4236
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
4237
&& dict_index_is_clust(index)))) {
4239
size = btr_get_size(index, BTR_TOTAL_SIZE);
4241
index->stat_index_size = size;
4243
sum_of_index_sizes += size;
4245
size = btr_get_size(index, BTR_N_LEAF_PAGES);
4248
/* The root node of the tree is a leaf */
4252
index->stat_n_leaf_pages = size;
4254
btr_estimate_number_of_different_key_vals(index);
4256
/* If we have set a high innodb_force_recovery
4257
level, do not calculate statistics, as a badly
4258
corrupted index can cause a crash in it.
4259
Initialize some bogus index cardinality
4260
statistics, so that the data can be queried in
4261
various means, also via secondary indexes. */
4264
sum_of_index_sizes++;
4265
index->stat_index_size = index->stat_n_leaf_pages = 1;
4267
for (i = dict_index_get_n_unique(index); i; ) {
4268
index->stat_n_diff_key_vals[i--] = 1;
4256
index->stat_n_leaf_pages = size;
4258
btr_estimate_number_of_different_key_vals(index);
4260
4272
index = dict_table_get_next_index(index);
4263
4275
index = dict_table_get_first_index(table);
4457
4468
dict_index_stat_mutex_exit(index);
4459
if (dict_index_is_clust(index)) {
4460
type_string = "clustered index";
4461
} else if (dict_index_is_unique(index)) {
4462
type_string = "unique index";
4464
type_string = "secondary index";
4467
4470
fprintf(stderr,
4468
4471
" INDEX: name %s, id %llu, fields %lu/%lu,"
4469
4472
" uniq %lu, type %lu\n"