[MDEV-22112] Assertion `tab_part_info->part_type == RANGE_PARTITION || tab_part_info->part_type == LIST_PARTITION' failed in prep_alter_part_table Created: 2020-04-01  Updated: 2020-06-04  Resolved: 2020-06-04

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Versioned Tables
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: 10.5.4, 10.3.24, 10.4.14

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-13788 Server crash when issuing bad SQL par... Closed
relates to MDEV-19903 Setup default partitions for system v... Closed

 Description   

--source include/have_partition.inc
 
create table t1 (a int) with system versioning partition by system_time;
alter table t1 add partition (partition p2);
 
# Cleanup
drop table t1;

10.5 244ff3e5

mysqld: /data/src/10.5/sql/sql_partition.cc:5044: uint prep_alter_part_table(THD*, TABLE*, Alter_info*, HA_CREATE_INFO*, bool*, bool*): Assertion `tab_part_info->part_type == RANGE_PARTITION || tab_part_info->part_type == LIST_PARTITION' failed.
200402  0:56:32 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fbab5a97f12 in __GI___assert_fail (assertion=0x561bfcd6afb0 "tab_part_info->part_type == RANGE_PARTITION || tab_part_info->part_type == LIST_PARTITION", file=0x561bfcd69f58 "/data/src/10.5/sql/sql_partition.cc", line=5044, function=0x561bfcd6d400 <prep_alter_part_table(THD*, TABLE*, Alter_info*, HA_CREATE_INFO*, bool*, bool*)::__PRETTY_FUNCTION__> "uint prep_alter_part_table(THD*, TABLE*, Alter_info*, HA_CREATE_INFO*, bool*, bool*)") at assert.c:101
#8  0x0000561bfc2cda8b in prep_alter_part_table (thd=0x7fbaa0000b18, table=0x7fbaa01f2038, alter_info=0x7fbab0632360, create_info=0x7fbab0632430, partition_changed=0x7fbab062fd78, fast_alter_table=0x7fbab062fd79) at /data/src/10.5/sql/sql_partition.cc:5043
#9  0x0000561bfbe8cc6d in mysql_alter_table (thd=0x7fbaa0000b18, new_db=0x7fbaa00053c8, new_name=0x7fbaa00057d0, create_info=0x7fbab0632430, table_list=0x7fbaa0013a38, alter_info=0x7fbab0632360, order_num=0, order=0x0, ignore=false, if_exists=false) at /data/src/10.5/sql/sql_table.cc:10084
#10 0x0000561bfbf31592 in Sql_cmd_alter_table::execute (this=0x7fbaa0014418, thd=0x7fbaa0000b18) at /data/src/10.5/sql/sql_alter.cc:528
#11 0x0000561bfbd93bd2 in mysql_execute_command (thd=0x7fbaa0000b18) at /data/src/10.5/sql/sql_parse.cc:5908
#12 0x0000561bfbd9a042 in mysql_parse (thd=0x7fbaa0000b18, rawbuf=0x7fbaa0013930 "alter table t1 add partition (partition p2)", length=43, parser_state=0x7fbab0633520, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7953
#13 0x0000561bfbd85893 in dispatch_command (command=COM_QUERY, thd=0x7fbaa0000b18, packet=0x7fbaa0008699 "alter table t1 add partition (partition p2)", packet_length=43, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1840
#14 0x0000561bfbd83fc9 in do_command (thd=0x7fbaa0000b18) at /data/src/10.5/sql/sql_parse.cc:1359
#15 0x0000561bfbf272a1 in do_handle_one_connection (connect=0x561bff7abfd8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
#16 0x0000561bfbf26fd0 in handle_one_connection (arg=0x561bff7abfd8) at /data/src/10.5/sql/sql_connect.cc:1319
#17 0x0000561bfc45bf4c in pfs_spawn_thread (arg=0x561bff7e22d8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#18 0x00007fbab7a204a4 in start_thread (arg=0x7fbab0634700) at pthread_create.c:456
#19 0x00007fbab5b54d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

No obvious effect on a non-debug build.

Not reproducible on 10.4, it throws ER_PARTITIONS_MUST_BE_DEFINED_ERROR instead, although with a non-perfect text:

mysqltest: At line 3: query 'create table t1 (a int) with system versioning partition by system_time' failed: 1492: For LIST partitions each partition must be defined



 Comments   
Comment by Aleksey Midenkov [ 2020-05-29 ]

Reproducible in 10.3:

--source include/have_partition.inc
 
create table t1 (a int) with system versioning partition by system_time
(partition p1 history, partition pn current);
alter table t1 add partition (partition p2);
 
# Cleanup
drop table t1;

Comment by Alexey Botchkov [ 2020-06-02 ]

ok to push.

Generated at Thu Feb 08 09:12:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.