mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
cleanup: key algorithm vs key flags
the information about index algorithm was stored in two places inconsistently split between both. BTREE index could have key->algorithm == HA_KEY_ALG_BTREE, if the user explicitly specified USING BTREE or HA_KEY_ALG_UNDEF, if not. RTREE index had key->algorithm == HA_KEY_ALG_RTREE and always had key->flags & HA_SPATIAL FULLTEXT index had key->algorithm == HA_KEY_ALG_FULLTEXT and always had key->flags & HA_FULLTEXT HASH index had key->algorithm == HA_KEY_ALG_HASH or HA_KEY_ALG_UNDEF long unique index always had key->algorithm == HA_KEY_ALG_LONG_HASH In this commit: All indexes except BTREE and HASH always have key->algorithm set, HA_SPATIAL and HA_FULLTEXT flags are not used anymore (except for storage to keep frms backward compatible). As a side effect ALTER TABLE now detects FULLTEXT index renames correctly
This commit is contained in:
@@ -2852,7 +2852,7 @@ SQL_SELECT::test_quick_select(THD *thd,
|
||||
add("cause", "not applicable");
|
||||
continue;
|
||||
}
|
||||
if (key_info->flags & HA_FULLTEXT)
|
||||
if (key_info->algorithm == HA_KEY_ALG_FULLTEXT)
|
||||
{
|
||||
trace_idx_details.add("usable", false).add("cause", "fulltext");
|
||||
continue; // ToDo: ft-keys in non-ft ranges, if possible SerG
|
||||
@@ -2872,8 +2872,7 @@ SQL_SELECT::test_quick_select(THD *thd,
|
||||
cur_key_len += key_part_info->store_length;
|
||||
key_parts->field= key_part_info->field;
|
||||
key_parts->null_bit= key_part_info->null_bit;
|
||||
key_parts->image_type =
|
||||
(key_info->flags & HA_SPATIAL) ? Field::itMBR : Field::itRAW;
|
||||
key_parts->image_type = Field::image_type(key_info->algorithm);
|
||||
/* Only HA_PART_KEY_SEG is used */
|
||||
key_parts->flag= (uint8) key_part_info->key_part_flag;
|
||||
trace_keypart.add(key_parts->field->field_name);
|
||||
@@ -12286,7 +12285,7 @@ get_quick_select(PARAM *param,uint idx,SEL_ARG *key_tree, uint mrr_flags,
|
||||
bool create_err= FALSE;
|
||||
DBUG_ENTER("get_quick_select");
|
||||
|
||||
if (param->table->key_info[param->real_keynr[idx]].flags & HA_SPATIAL)
|
||||
if (param->table->key_info[param->real_keynr[idx]].algorithm == HA_KEY_ALG_RTREE)
|
||||
quick=new QUICK_RANGE_SELECT_GEOM(param->thd, param->table,
|
||||
param->real_keynr[idx],
|
||||
MY_TEST(parent_alloc),
|
||||
@@ -14761,8 +14760,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
|
||||
bool has_min_max_fld= false, has_other_fld= false;
|
||||
if (join->conds && min_max_arg_item &&
|
||||
!check_group_min_max_predicates(join->conds, min_max_arg_item,
|
||||
(index_info->flags & HA_SPATIAL) ?
|
||||
Field::itMBR : Field::itRAW,
|
||||
Field::image_type(index_info->algorithm),
|
||||
&has_min_max_fld, &has_other_fld))
|
||||
{
|
||||
if (unlikely(trace_group.trace_started()))
|
||||
|
Reference in New Issue
Block a user