diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-11-17 15:15:20 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-11-17 15:15:20 +0200 |
commit | 03ddc19ab21d585f4aac16ad91e5cba39687cd31 (patch) | |
tree | 410ef1bbc1b8290389921c8ca5a92247b97c23c1 /storage/xtradb | |
parent | 42a398b59b5c2d08a9cc8c03d6d082a095a2cd77 (diff) | |
download | mariadb-git-03ddc19ab21d585f4aac16ad91e5cba39687cd31.tar.gz |
MDEV-6424: MariaDB server crashes with assertion failure in file ha_innodb.c line 11652
This is not a fix, this is instrumentation to find out is MySQL frm dictionary
and InnoDB data dictionary really out-of-sync when this assertion is fired,
or is there some other reason (bug).
Diffstat (limited to 'storage/xtradb')
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 76 |
1 files changed, 70 insertions, 6 deletions
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index e95fc365be8..705913d4962 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -2355,11 +2355,16 @@ innobase_get_stmt( THD* thd, /*!< in: MySQL thread handle */ size_t* length) /*!< out: length of the SQL statement */ { - LEX_STRING* stmt; - - stmt = thd_query_string(thd); - *length = stmt->length; - return(stmt->str); + const char* query = NULL; + LEX_STRING *stmt = NULL; + if (thd) { + stmt = thd_query_string(thd); + if (stmt) { + *length = stmt->length; + query = stmt->str; + } + } + return (query); } /**********************************************************************//** @@ -7517,7 +7522,66 @@ build_template_field( UNIV_MEM_INVALID(templ, sizeof *templ); templ->col_no = i; templ->clust_rec_field_no = dict_col_get_clust_pos(col, clust_index); - ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED); + + /* If clustered index record field is not found, lets print out + field names and all the rest to understand why field is not found. */ + if (templ->clust_rec_field_no == ULINT_UNDEFINED) { + const char* tb_col_name = dict_table_get_col_name(clust_index->table, i); + dict_field_t* field=NULL; + size_t size = 0; + + for(ulint j=0; j < clust_index->n_user_defined_cols; j++) { + dict_field_t* ifield = &(clust_index->fields[j]); + if (ifield && !memcmp(tb_col_name, ifield->name, + strlen(tb_col_name))) { + field = ifield; + break; + } + } + + ib_logf(IB_LOG_LEVEL_INFO, + "Looking for field %lu name %s from table %s", + i, + (tb_col_name ? tb_col_name : "NULL"), + clust_index->table->name); + + + for(ulint j=0; j < clust_index->n_user_defined_cols; j++) { + dict_field_t* ifield = &(clust_index->fields[j]); + ib_logf(IB_LOG_LEVEL_INFO, + "InnoDB Table %s field %lu name %s", + clust_index->table->name, + j, + (ifield ? ifield->name : "NULL")); + } + + for(ulint j=0; j < table->s->stored_fields; j++) { + ib_logf(IB_LOG_LEVEL_INFO, + "MySQL table %s field %lu name %s", + table->s->table_name.str, + j, + table->field[j]->field_name); + } + + ib_logf(IB_LOG_LEVEL_ERROR, + "Clustered record field for column %lu" + " not found table n_user_defined %d" + " index n_user_defined %d" + " InnoDB table %s field name %s" + " MySQL table %s field name %s n_fields %d" + " query %s", + i, + clust_index->n_user_defined_cols, + clust_index->table->n_cols - DATA_N_SYS_COLS, + clust_index->table->name, + (field ? field->name : "NULL"), + table->s->table_name.str, + (tb_col_name ? tb_col_name : "NULL"), + table->s->stored_fields, + innobase_get_stmt(current_thd, &size)); + + ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED); + } if (dict_index_is_clust(index)) { templ->rec_field_no = templ->clust_rec_field_no; |