Commit 3e5c5818 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-35039 Number of indexes inside InnoDB differs from that defined in...

MDEV-35039 Number of indexes inside InnoDB differs from that defined in MariaDB after altering table with vector key

don't show table->s->total_keys to engine in inplace alter
parent 4bacde8c
......@@ -103,3 +103,17 @@ select pk,hex(v) from t;
pk hex(v)
1 B047263C9F87233FCFD27E3EAE493E3F0329F43E
drop table t;
#
# MDEV-35039 Number of indexes inside InnoDB differs from that defined in MariaDB after altering table with vector key
#
create table t (v blob not null, vector index (v)) row_format=compressed engine=innodb;
alter table t add f int;
insert into t values (x'00000000',1);
show create table t;
Table Create Table
t CREATE TABLE `t` (
`v` blob NOT NULL,
`f` int(11) DEFAULT NULL,
VECTOR KEY `v` (`v`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ROW_FORMAT=COMPRESSED
drop table t;
......@@ -87,3 +87,12 @@ create table t (pk int primary key, v varbinary(1024) not null, vector key(v)) e
insert into t values (1, x'B047263C9F87233fcfd27e3eae493e3f0329f43e');
select pk,hex(v) from t;
drop table t;
--echo #
--echo # MDEV-35039 Number of indexes inside InnoDB differs from that defined in MariaDB after altering table with vector key
--echo #
create table t (v blob not null, vector index (v)) row_format=compressed engine=innodb;
alter table t add f int;
insert into t values (x'00000000',1);
show create table t;
drop table t;
......@@ -7292,10 +7292,17 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table,
Adding/dropping any indexes in a table that already has high-level indexes
may shift high-level indexes numbers. And thus require high-level indexes
rename, which algorithm=inplace (storage engines) shouldn't do.
If we aren't adding/dropping indexes, ha_alter_info->key_count is
table->s->total_keys, but must be table->s->keys to not confuse the engine.
*/
if (table->s->keys < table->s->total_keys &&
(ha_alter_info->index_drop_count || ha_alter_info->index_add_count))
if (table->s->keys < table->s->total_keys)
{
if (ha_alter_info->index_drop_count || ha_alter_info->index_add_count)
ha_alter_info->inplace_supported= HA_ALTER_INPLACE_NOT_SUPPORTED;
else
ha_alter_info->key_count= table->s->keys;
}
DBUG_PRINT("exit", ("handler_flags: %llu", ha_alter_info->handler_flags));
DBUG_RETURN(false);
......
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