[MDEV-29636] Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed in ha_partition::set_auto_increment_if_higher upon REPLACE with partition pruning Created: 2022-09-26  Updated: 2022-12-07  Resolved: 2022-12-07

Status: Closed
Project: MariaDB Server
Component/s: Partitioning
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.11.2, 10.3.38, 10.4.28, 10.5.19, 10.6.12, 10.7.8, 10.8.7, 10.9.5, 10.10.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Nayuta Yanagisawa (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-21027 Assertion `part_share->auto_inc_initi... Closed
relates to MDEV-21310 AUTO_INCREMENT column throws range er... Closed

 Description   

--source include/have_partition.inc
 
CREATE TABLE t (a INT AUTO_INCREMENT PRIMARY KEY)
PARTITION BY RANGE (a) (
  PARTITION p0 VALUES LESS THAN (10),
  PARTITION pn VALUES LESS THAN MAXVALUE
);
REPLACE INTO t PARTITION (p0) SELECT 1;
 
# Cleanup
DROP TABLE t;

10.3 66cd1c33

mysqld: /data/src/10.3/sql/ha_partition.h:1395: virtual void ha_partition::set_auto_increment_if_higher(Field*): Assertion `part_share->auto_inc_initialized || !can_use_for_auto_inc_init()' failed.
220926 16:59:46 [ERROR] mysqld got signal 6 ;
 
#7  0x00007fc2ac994662 in __GI___assert_fail (assertion=0x55a14064aa60 "part_share->auto_inc_initialized || !can_use_for_auto_inc_init()", file=0x55a14064a860 "/data/src/10.3/sql/ha_partition.h", line=1395, function=0x55a14064aae0 "virtual void ha_partition::set_auto_increment_if_higher(Field*)") at assert.c:101
#8  0x000055a13fb6bc05 in ha_partition::set_auto_increment_if_higher (this=0x61d0001964a8, field=0x619000083008) at /data/src/10.3/sql/ha_partition.h:1395
#9  0x000055a13fb2d875 in ha_partition::write_row (this=0x61d0001964a8, buf=0x619000082fd8 "\377\001") at /data/src/10.3/sql/ha_partition.cc:4406
#10 0x000055a13e8fefc4 in handler::ha_write_row (this=0x61d0001964a8, buf=0x619000082fd8 "\377\001") at /data/src/10.3/sql/handler.cc:6495
#11 0x000055a13e0ddef5 in write_record (thd=0x62a000060208, table=0x61f000043688, info=0x62b000000bb0) at /data/src/10.3/sql/sql_insert.cc:1727
#12 0x000055a13e0f0a6d in select_insert::send_data (this=0x62b000000b68, values=...) at /data/src/10.3/sql/sql_insert.cc:3953
#13 0x000055a13e23ed1f in JOIN::exec_inner (this=0x62b000000c20) at /data/src/10.3/sql/sql_select.cc:4046
#14 0x000055a13e23dad7 in JOIN::exec (this=0x62b000000c20) at /data/src/10.3/sql/sql_select.cc:3965
#15 0x000055a13e241439 in mysql_select (thd=0x62a000060208, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=3489925888, result=0x62b000000b68, unit=0x62a0000640b8, select_lex=0x62a000064850) at /data/src/10.3/sql/sql_select.cc:4374
#16 0x000055a13e217c6f in handle_select (thd=0x62a000060208, lex=0x62a000063ff8, result=0x62b000000b68, setup_tables_done_option=1073741824) at /data/src/10.3/sql/sql_select.cc:372
#17 0x000055a13e17f8fb in mysql_execute_command (thd=0x62a000060208) at /data/src/10.3/sql/sql_parse.cc:4621
#18 0x000055a13e1964dc in mysql_parse (thd=0x62a000060208, rawbuf=0x62b000000228 "REPLACE INTO t PARTITION (p0) SELECT 1", length=38, parser_state=0x7fc2a1fffa00, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7871
#19 0x000055a13e16da82 in dispatch_command (command=COM_QUERY, thd=0x62a000060208, packet=0x6290000eb209 "REPLACE INTO t PARTITION (p0) SELECT 1", packet_length=38, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#20 0x000055a13e16a65e in do_command (thd=0x62a000060208) at /data/src/10.3/sql/sql_parse.cc:1398
#21 0x000055a13e52c068 in do_handle_one_connection (connect=0x608000000ea8) at /data/src/10.3/sql/sql_connect.cc:1403
#22 0x000055a13e52b964 in handle_one_connection (arg=0x608000000ea8) at /data/src/10.3/sql/sql_connect.cc:1308
#23 0x000055a13fad6a67 in pfs_spawn_thread (arg=0x615000004408) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#24 0x00007fc2acb2dea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
#25 0x00007fc2aca5ddef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible on all 10.3+, including previous minor releases, with at least MyISAM, InnoDB, Aria.



 Comments   
Comment by Nayuta Yanagisawa (Inactive) [ 2022-09-27 ]

holyfoot Please review: https://github.com/MariaDB/server/commit/9401a0fc5738b179bcf53e683032d661dd2f816d

Comment by Alexey Botchkov [ 2022-12-05 ]

ok to push.

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