Commit 9696ca9d authored by Vasil Dimov's avatar Vasil Dimov

Fix Bug#16907783 5.5 STILL CRASHES IN DICT_UPDATE_STATISTICS WITH CONCURRENT

DDL AND I_S QUERIES

Skip partially created indexes (ones whose name starts with TEMP_INDEX_PREFIX)
from stats gathering.

Because InnoDB reports HA_INPLACE_ADD_INDEX_NO_WRITE to MySQL, the latter
allows parallel execution of ha_innobase::add_index() and ha_innobase::info().

Reviewed by:	Inaam (rb:2613)
parent 27d831b9
......@@ -23,6 +23,8 @@ Data dictionary system
Created 1/8/1996 Heikki Tuuri
***********************************************************************/
#include <my_sys.h>
#include "dict0dict.h"
#ifdef UNIV_NONINL
......@@ -1832,6 +1834,11 @@ undo_size_ok:
dict_index_is_ibuf(index)
? SYNC_IBUF_INDEX_TREE : SYNC_INDEX_TREE);
DBUG_EXECUTE_IF(
"index_partially_created_should_kick",
DEBUG_SYNC_C("index_partially_created");
);
if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) {
new_index->stat_n_diff_key_vals = mem_heap_alloc(
......@@ -4499,7 +4506,13 @@ dict_update_statistics(
return;
}
do {
for (; index != NULL; index = dict_table_get_next_index(index)) {
/* Skip incomplete indexes. */
if (index->name[0] == TEMP_INDEX_PREFIX) {
continue;
}
if (UNIV_LIKELY
(srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE
|| (srv_force_recovery < SRV_FORCE_NO_LOG_REDO
......@@ -4553,9 +4566,7 @@ fake_statistics:
(1 + dict_index_get_n_unique(index))
* sizeof(*index->stat_n_non_null_key_vals));
}
index = dict_table_get_next_index(index);
} while (index);
}
index = dict_table_get_first_index(table);
......
......@@ -8130,6 +8130,8 @@ ha_innobase::info_low(
prebuilt->trx->op_info = "updating table statistics";
DEBUG_SYNC_C("info_before_stats_update");
dict_update_statistics(
ib_table,
FALSE, /* update even if initialized */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment