[MDEV-22804] SIGSEGV in ha_partition::create_partitioning_metadata | ERROR 1507 (HY000): Error in list of partitions to DROP (optimized builds, 10.5 only) Created: 2020-06-05  Updated: 2023-11-27  Resolved: 2020-06-05

Status: Closed
Project: MariaDB Server
Component/s: Partitioning
Affects Version/s: 10.5.4
Fix Version/s: 10.5.4

Type: Bug Priority: Blocker
Reporter: Roel Van de Paar Assignee: Michael Widenius
Resolution: Duplicate Votes: 0
Labels: corruption, not-10.1, not-10.2, not-10.3, not-10.4, regression


 Description   

USE test;
CREATE TABLE t(a INT) PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (PARTITION p VALUES LESS THAN (5) (SUBPARTITION sp, SUBPARTITION sp1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2, SUBPARTITION sp3));
ALTER TABLE t DROP PARTITION p;

Leads to:

10.5.4 701efbb25b738f0c971798c5234d4d66b9235e47

Core was generated by `/test/MD030620-mariadb-10.5.4-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14dbe828f700 (LWP 2414969))]
(gdb) bt
(gdb) (gdb) #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000558657c1d647 in my_write_core (sig=sig@entry=11) at /test/10.5_opt/mysys/stacktrace.c:518
#2  0x00005586575dff4a in handle_fatal_signal (sig=11) at /test/10.5_opt/sql/signal_handler.cc:330
#3  <signal handler called>
#4  0x000055865783b589 in ha_partition::create_partitioning_metadata (this=0x14dbc346e230, path=0x14dbe8289930 "./test/#sql-shadow-4-t", old_path=0x0, action_flag=CHF_CREATE_FLAG) at /test/10.5_opt/sql/ha_partition.cc:689
#5  0x0000558657477ff1 in mysql_write_frm (lpt=lpt@entry=0x14dbe828a040, flags=flags@entry=1) at /test/10.5_opt/sql/sql_table.cc:1863
#6  0x000055865773cbbd in fast_alter_partition_table (thd=thd@entry=0x14dbc3412018, table=table@entry=0x14dbc3520e18, alter_info=alter_info@entry=0x14dbe828d530, create_info=create_info@entry=0x14dbe828d600, table_list=0x14dbc3447118, db=db@entry=0x14dbe828ca30, table_name=0x14dbe828ca40) at /test/10.5_opt/sql/sql_partition.cc:7200
#7  0x0000558657482937 in mysql_alter_table (thd=thd@entry=0x14dbc3412018, new_db=new_db@entry=0x14dbc3416718, new_name=new_name@entry=0x14dbc3416b20, create_info=create_info@entry=0x14dbe828d600, table_list=<optimized out>, table_list@entry=0x14dbc3447118, alter_info=alter_info@entry=0x14dbe828d530, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.5_opt/sql/sql_table.cc:10217
#8  0x00005586574de371 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x14dbc3412018) at /test/10.5_opt/sql/sql_alter.cc:532
#9  0x00005586573ea45f in mysql_execute_command (thd=thd@entry=0x14dbc3412018) at /test/10.5_opt/sql/sql_parse.cc:5950
#10 0x00005586573f0f1c in mysql_parse (thd=0x14dbc3412018, rawbuf=<optimized out>, length=30, parser_state=0x14dbe828e4b0, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /test/10.5_opt/sql/sql_parse.cc:7992
#11 0x00005586573e6235 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14dbc3412018, packet=packet@entry=0x14dbc343a019 "ALTER TABLE t DROP PARTITION p", packet_length=packet_length@entry=30, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_opt/sql/sql_parse.cc:1874
#12 0x00005586573e4644 in do_command (thd=0x14dbc3412018) at /test/10.5_opt/sql/sql_parse.cc:1355
#13 0x00005586574d97c1 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14dbe5c329b8, put_in_cache=put_in_cache@entry=true) at /test/10.5_opt/sql/sql_connect.cc:1411
#14 0x00005586574d9b24 in handle_one_connection (arg=arg@entry=0x14dbe5c329b8) at /test/10.5_opt/sql/sql_connect.cc:1313
#15 0x000055865784617a in pfs_spawn_thread (arg=0x14dbe5c4b018) at /test/10.5_opt/storage/perfschema/pfs.cc:2201
#16 0x000014dbe76b66db in start_thread (arg=0x14dbe828f700) at pthread_create.c:463
#17 0x000014dbe6ab488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.5.4 (opt)

Bug confirmed not present in:
MariaDB: 10.1.46 (dbg), 10.1.46 (opt), 10.2.33 (dbg), 10.2.33 (opt), 10.3.24 (dbg), 10.3.24 (opt), 10.4.14 (dbg), 10.4.14 (opt), 10.5.4 (dbg)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

MariaDB 10.4.14 (opt):

10.4.14 ed1434df88270ebe70ae412b5b723920b6b4e0e8

10.4.14>USE test;
Database changed
10.4.14>CREATE TABLE t(a INT) PARTITION BY RANGE(a) SUBPARTITION BY HASH(a) (PARTITION p VALUES LESS THAN (5) (SUBPARTITION sp, SUBPARTITION sp1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION sp2, SUBPARTITION sp3));
Query OK, 0 rows affected (0.085 sec)
10.4.14>ALTER TABLE t DROP PARTITION p;
Query OK, 0 rows affected (0.052 sec)
Records: 0  Duplicates: 0  Warnings: 0



 Comments   
Comment by Roel Van de Paar [ 2020-06-05 ]

Secondary testcase:

USE test;
CREATE TABLE t (c INT, d DATE) PARTITION BY RANGE(YEAR(d)) SUBPARTITION BY HASH(TO_DAYS(d)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0, SUBPARTITION s1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s4, SUBPARTITION s5));
ALTER TABLE t DROP PARTITION p2;

Leads to:

10.5.4 (opt) 701efbb25b738f0c971798c5234d4d66b9235e47

10.5.4>ALTER TABLE t DROP PARTITION p2;
ERROR 1507 (HY000): Error in list of partitions to DROP

Comment by Roel Van de Paar [ 2020-06-05 ]

Bit longer version of secondary testcase which also SIGSEGV's

USE test;
CREATE TABLE t (c1 MEDIUMINT,name VARCHAR(30), purchased DATE) PARTITION BY RANGE(YEAR(purchased)) SUBPARTITION BY HASH(TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0, SUBPARTITION s1), PARTITION p1 VALUES LESS THAN (2000) (SUBPARTITION s2, SUBPARTITION s3), PARTITION p2 VALUES LESS THAN MAXVALUE (SUBPARTITION s4, SUBPARTITION s5));
ALTER TABLE t drop partition p2;

Comment by Michael Widenius [ 2020-06-05 ]

Duplicate of MDEV-22649
This is already fixed in my bb-10.5-monty tree, to be pushed into 10.5 soon

Comment by Roel Van de Paar [ 2020-06-05 ]

Thank you monty As the stacks were different my filter tool did not pickup on it.

Note to self; unique bug id's

SIGSEGV|ha_partition::create_partitioning_metadata|cleanup_table_after_inplace_alter|mysql_alter_table|Sql_cmd_alter_table::execute  ## OPT |MDEV-22649
SIGSEGV|ha_partition::create_partitioning_metadata|handler::ha_create_partitioning_metadata|cleanup_table_after_inplace_alter|mysql_alter_table  ## OPT |MDEV-22649
SIGSEGV|ha_partition::create_partitioning_metadata|mysql_write_frm|fast_alter_partition_table|mysql_alter_table   ## OPT MDEV-22804

Comment by Michael Widenius [ 2020-06-15 ]

Fix pushed into 10.5

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