bug#24820 CREATE INDEX ....USING HASH on NDB table creates ordered index, not...

bug#24820  CREATE INDEX ....USING HASH on NDB table creates ordered index, not HASH index: Added error checking
parent 4ddf45b1
......@@ -835,3 +835,12 @@ a
3
delete from t1;
drop table t1;
create table nationaldish (DishID int(10) unsigned NOT NULL AUTO_INCREMENT,
CountryCode char(3) NOT NULL,
DishTitle varchar(64) NOT NULL,
calories smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (DishID)
) ENGINE=ndbcluster;
create index i on nationaldish(countrycode,calories) using hash;
ERROR 42000: Table 'nationaldish' uses an extension that doesn't exist in this MySQL version
drop table nationaldish;
......@@ -455,3 +455,17 @@ rollback;
select * from t1 order by a;
delete from t1;
drop table t1;
# bug#24820 CREATE INDEX ....USING HASH on NDB table creates ordered index, not HASH index
create table nationaldish (DishID int(10) unsigned NOT NULL AUTO_INCREMENT,
CountryCode char(3) NOT NULL,
DishTitle varchar(64) NOT NULL,
calories smallint(5) unsigned DEFAULT NULL,
PRIMARY KEY (DishID)
) ENGINE=ndbcluster;
--error ER_UNSUPPORTED_EXTENSION
create index i on nationaldish(countrycode,calories) using hash;
drop table nationaldish;
......@@ -5153,6 +5153,17 @@ int ha_ndbcluster::create_index(const char *name, KEY *key_info,
error= create_unique_index(unique_name, key_info);
break;
case ORDERED_INDEX:
if (key_info->algorithm == HA_KEY_ALG_HASH)
{
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_ILLEGAL_HA_CREATE_OPTION,
ER(ER_ILLEGAL_HA_CREATE_OPTION),
ndbcluster_hton_name,
"Ndb does not support non-unique "
"hash based indexes");
error= HA_ERR_UNSUPPORTED;
break;
}
error= create_ordered_index(name, key_info);
break;
default:
......@@ -5247,7 +5258,7 @@ int ha_ndbcluster::add_index(TABLE *table_arg,
KEY *key= key_info + idx;
KEY_PART_INFO *key_part= key->key_part;
KEY_PART_INFO *end= key_part + key->key_parts;
NDB_INDEX_TYPE idx_type= get_index_type_from_key(idx, key, false);
NDB_INDEX_TYPE idx_type= get_index_type_from_key(idx, key_info, false);
DBUG_PRINT("info", ("Adding index: '%s'", key_info[idx].name));
// Add fields to key_part struct
for (; key_part != end; key_part++)
......
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