mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
System versioning assertion fix. Since DROP SYSTEM VERSIONING does not change list of dropped keys we should handle a special case. Caused by MDEV-19751. This fix deprecates MDEV-17091.
This commit is contained in:
@ -65,3 +65,15 @@ partition by range columns (a, row_start) (
|
|||||||
partition p1 values less than (100, 100)
|
partition p1 values less than (100, 100)
|
||||||
);
|
);
|
||||||
ERROR HY000: Transaction-precise system versioned tables do not support partitioning by ROW START or ROW END
|
ERROR HY000: Transaction-precise system versioned tables do not support partitioning by ROW START or ROW END
|
||||||
|
#
|
||||||
|
# MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
|
||||||
|
#
|
||||||
|
create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i))
|
||||||
|
engine=innodb with system versioning partition by key() partitions 2;
|
||||||
|
insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b');
|
||||||
|
alter table t1 drop system versioning;
|
||||||
|
replace into t1 select * from t1;
|
||||||
|
select * from t1 where i > 0 or pk = 1000 limit 1;
|
||||||
|
pk i c
|
||||||
|
1 1 a
|
||||||
|
drop table t1;
|
||||||
|
@ -78,4 +78,15 @@ partition by range columns (a, row_start) (
|
|||||||
partition p1 values less than (100, 100)
|
partition p1 values less than (100, 100)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-18794 Assertion `!m_innodb' failed in ha_partition::cmp_ref upon SELECT from partitioned table
|
||||||
|
--echo #
|
||||||
|
create or replace table t1 (pk int auto_increment, i int, c char(1), primary key (pk), key(i))
|
||||||
|
engine=innodb with system versioning partition by key() partitions 2;
|
||||||
|
insert into t1 (i, c) values (1, 'a'), (2, 'b'), (null, 'c'), (null, 'b');
|
||||||
|
alter table t1 drop system versioning;
|
||||||
|
replace into t1 select * from t1;
|
||||||
|
select * from t1 where i > 0 or pk = 1000 limit 1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--source suite/versioning/common_finish.inc
|
--source suite/versioning/common_finish.inc
|
||||||
|
@ -5986,26 +5986,35 @@ the generated partition syntax in a correct manner.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Prohibit inplace when partitioned by primary key and the primary key is dropped.
|
Prohibit inplace when partitioned by primary key and the primary key is changed.
|
||||||
*/
|
*/
|
||||||
if (!*partition_changed &&
|
if (!*partition_changed &&
|
||||||
tab_part_info->part_field_array &&
|
tab_part_info->part_field_array &&
|
||||||
!tab_part_info->part_field_list.elements &&
|
!tab_part_info->part_field_list.elements &&
|
||||||
table->s->primary_key != MAX_KEY)
|
table->s->primary_key != MAX_KEY)
|
||||||
{
|
{
|
||||||
KEY *primary_key= table->key_info + table->s->primary_key;
|
|
||||||
List_iterator_fast<Alter_drop> drop_it(alter_info->drop_list);
|
if (alter_info->flags & (ALTER_DROP_SYSTEM_VERSIONING |
|
||||||
const char *primary_name= primary_key->name.str;
|
ALTER_ADD_SYSTEM_VERSIONING))
|
||||||
const Alter_drop *drop;
|
|
||||||
drop_it.rewind();
|
|
||||||
while ((drop= drop_it++))
|
|
||||||
{
|
{
|
||||||
if (drop->type == Alter_drop::KEY &&
|
*partition_changed= true;
|
||||||
0 == my_strcasecmp(system_charset_info, primary_name, drop->name))
|
}
|
||||||
break;
|
else
|
||||||
|
{
|
||||||
|
KEY *primary_key= table->key_info + table->s->primary_key;
|
||||||
|
List_iterator_fast<Alter_drop> drop_it(alter_info->drop_list);
|
||||||
|
const char *primary_name= primary_key->name.str;
|
||||||
|
const Alter_drop *drop;
|
||||||
|
drop_it.rewind();
|
||||||
|
while ((drop= drop_it++))
|
||||||
|
{
|
||||||
|
if (drop->type == Alter_drop::KEY &&
|
||||||
|
0 == my_strcasecmp(system_charset_info, primary_name, drop->name))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (drop)
|
||||||
|
*partition_changed= TRUE;
|
||||||
}
|
}
|
||||||
if (drop)
|
|
||||||
*partition_changed= TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (thd->work_part_info)
|
if (thd->work_part_info)
|
||||||
@ -6039,23 +6048,6 @@ the generated partition syntax in a correct manner.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of PARTITION BY KEY(), check if primary key has changed
|
|
||||||
// System versioning also implicitly adds/removes primary key parts
|
|
||||||
if (alter_info->partition_flags == 0 && part_info->list_of_part_fields
|
|
||||||
&& part_info->part_field_list.elements == 0)
|
|
||||||
{
|
|
||||||
if (alter_info->flags & (ALTER_DROP_SYSTEM_VERSIONING |
|
|
||||||
ALTER_ADD_SYSTEM_VERSIONING))
|
|
||||||
*partition_changed= true;
|
|
||||||
|
|
||||||
List_iterator<Key> it(alter_info->key_list);
|
|
||||||
Key *key;
|
|
||||||
while((key= it++) && !*partition_changed)
|
|
||||||
{
|
|
||||||
if (key->type == Key::PRIMARY)
|
|
||||||
*partition_changed= true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
Set up partition default_engine_type either from the create_info
|
Set up partition default_engine_type either from the create_info
|
||||||
or from the previus table
|
or from the previus table
|
||||||
|
Reference in New Issue
Block a user