Commit 3c5c04bd authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

MDEV-7122: Assertion `0' failed in subselect_hash_sj_engine::init

Fix test failure when using maria small-block size. We need to query
the max_key_length and max_key_parts based on the the tmp table engine.
parent 6b614c62
......@@ -873,7 +873,8 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
See MDEV-7122. This check is performed inside create_tmp_table also and
we must do it so that we know the table has keys created.
*/
if (total_key_length > HA_MAX_KEY_LENGTH || elements > HA_MAX_KEY_SEG)
if (total_key_length > tmp_table_max_key_length() ||
elements > tmp_table_max_key_parts())
DBUG_RETURN(FALSE);
in_subs->types_allow_materialization= TRUE;
......
......@@ -15307,13 +15307,6 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (!table->file)
goto err;
/*
Temporary table storage engines must allow keys of at least
HA_MAX_KEY_LENGT and at least HA_MAX_KEY_SEG key parts.
*/
DBUG_ASSERT(table->file->max_key_length() >= HA_MAX_KEY_LENGTH &&
table->file->max_key_parts() >= HA_MAX_KEY_SEG);
if (!using_unique_constraint)
reclength+= group_null_items; // null flag is stored separately
......@@ -16305,12 +16298,6 @@ create_internal_tmp_table_from_heap2(THD *thd, TABLE *table,
if (!(new_table.file= get_new_handler(&share, &new_table.mem_root,
new_table.s->db_type())))
DBUG_RETURN(1); // End of memory
/*
Temporary table storage engines must allow keys of at least
HA_MAX_KEY_LENGTH and at least HA_MAX_KEY_SEG key parts.
*/
DBUG_ASSERT(new_table.file->max_key_length() >= HA_MAX_KEY_LENGTH &&
new_table.file->max_key_parts() >= HA_MAX_KEY_SEG);
save_proc_info=thd->proc_info;
thd_proc_info(thd, proc_info);
......
......@@ -40,8 +40,21 @@
#endif
#if defined(USE_ARIA_FOR_TMP_TABLES)
#define TMP_ENGINE_HTON maria_hton
inline uint tmp_table_max_key_length() {
return maria_max_key_length();
}
inline uint tmp_table_max_key_parts() {
return maria_max_key_segments();
}
#else
#define TMP_ENGINE_HTON myisam_hton
inline uint tmp_table_max_key_length() {
return MI_MAX_KEY_LENGTH;
}
inline uint tmp_table_max_key_parts() {
return MI_MAX_KEY_SEG;
}
#endif
/* Values in optimize */
#define KEY_OPTIMIZE_EXISTS 1
......
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