summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2016-02-10 03:49:11 +0200
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2016-02-10 04:00:08 +0200
commit3c5c04bd2bccbfeb62a86bdc5610b1dcea378dd3 (patch)
tree184f3fbd9a0302c8da3d4b0dda0a0ce55edc8f83
parent6b614c620ec32cd8d96be880bbc8ff7c45bac7ce (diff)
downloadmariadb-git-3c5c04bd2bccbfeb62a86bdc5610b1dcea378dd3.tar.gz
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.
-rw-r--r--sql/opt_subselect.cc3
-rw-r--r--sql/sql_select.cc13
-rw-r--r--sql/sql_select.h13
3 files changed, 15 insertions, 14 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 4c7925e3e71..5137d8a0986 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -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;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 061e367d725..b1e22537b37 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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);
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 4f807ff5b93..4650bc24c68 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -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