1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-09 22:24:09 +03:00

Merge fix for MDEV-10649 from 10.0 to 10.1

- storage/innobase/dict/dict0stats.cc
- storage/xtradb/dict/dict0stats.cc
This commit is contained in:
Sergei Petrunia
2016-09-28 16:19:05 +03:00
2 changed files with 38 additions and 20 deletions

View File

@@ -708,7 +708,10 @@ void
dict_stats_copy(
/*============*/
dict_table_t* dst, /*!< in/out: destination table */
const dict_table_t* src) /*!< in: source table */
const dict_table_t* src, /*!< in: source table */
bool reset_ignored_indexes) /*!< in: if true, set ignored indexes
to have the same statistics as if
the table was empty */
{
dst->stats_last_recalc = src->stats_last_recalc;
dst->stat_n_rows = src->stat_n_rows;
@@ -727,7 +730,16 @@ dict_stats_copy(
&& (src_idx = dict_table_get_next_index(src_idx)))) {
if (dict_stats_should_ignore_index(dst_idx)) {
continue;
if (reset_ignored_indexes) {
/* Reset index statistics for all ignored indexes,
unless they are FT indexes (these have no statistics)*/
if (dst_idx->type & DICT_FTS) {
continue;
}
dict_stats_empty_index(dst_idx);
} else {
continue;
}
}
ut_ad(!dict_index_is_univ(dst_idx));
@@ -827,7 +839,7 @@ dict_stats_snapshot_create(
t = dict_stats_table_clone_create(table);
dict_stats_copy(t, table);
dict_stats_copy(t, table, false);
t->stat_persistent = table->stat_persistent;
t->stats_auto_recalc = table->stats_auto_recalc;
@@ -3319,13 +3331,10 @@ dict_stats_update(
dict_table_stats_lock(table, RW_X_LATCH);
/* Initialize all stats to dummy values before
copying because dict_stats_table_clone_create() does
skip corrupted indexes so our dummy object 't' may
have less indexes than the real object 'table'. */
dict_stats_empty_table(table, true);
dict_stats_copy(table, t);
/* Pass reset_ignored_indexes=true as parameter
to dict_stats_copy. This will cause statictics
for corrupted indexes to be set to empty values */
dict_stats_copy(table, t, true);
dict_stats_assert_initialized(table);

View File

@@ -708,7 +708,10 @@ void
dict_stats_copy(
/*============*/
dict_table_t* dst, /*!< in/out: destination table */
const dict_table_t* src) /*!< in: source table */
const dict_table_t* src, /*!< in: source table */
bool reset_ignored_indexes) /*!< in: if true, set ignored indexes
to have the same statistics as if
the table was empty */
{
dst->stats_last_recalc = src->stats_last_recalc;
dst->stat_n_rows = src->stat_n_rows;
@@ -727,7 +730,16 @@ dict_stats_copy(
&& (src_idx = dict_table_get_next_index(src_idx)))) {
if (dict_stats_should_ignore_index(dst_idx)) {
continue;
if (reset_ignored_indexes) {
/* Reset index statistics for all ignored indexes,
unless they are FT indexes (these have no statistics)*/
if (dst_idx->type & DICT_FTS) {
continue;
}
dict_stats_empty_index(dst_idx);
} else {
continue;
}
}
ut_ad(!dict_index_is_univ(dst_idx));
@@ -827,7 +839,7 @@ dict_stats_snapshot_create(
t = dict_stats_table_clone_create(table);
dict_stats_copy(t, table);
dict_stats_copy(t, table, false);
t->stat_persistent = table->stat_persistent;
t->stats_auto_recalc = table->stats_auto_recalc;
@@ -3319,13 +3331,10 @@ dict_stats_update(
dict_table_stats_lock(table, RW_X_LATCH);
/* Initialize all stats to dummy values before
copying because dict_stats_table_clone_create() does
skip corrupted indexes so our dummy object 't' may
have less indexes than the real object 'table'. */
dict_stats_empty_table(table, true);
dict_stats_copy(table, t);
/* Pass reset_ignored_indexes=true as parameter
to dict_stats_copy. This will cause statictics
for corrupted indexes to be set to empty values */
dict_stats_copy(table, t, true);
dict_stats_assert_initialized(table);