Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL)
-
None
Description
--source include/have_partition.inc
|
CREATE OR REPLACE TABLE t1 (f BIGINT, s DATE, e DATE, PERIOD FOR app(s,e)) PARTITION BY KEY(f) PARTITIONS 8; |
REPLACE INTO t1 (s,e) VALUES ('2023-07-21','2024-06-07'); |
ALTER TABLE t1 MODIFY f SERIAL; |
DELETE FROM t1 FOR PORTION OF app FROM '2023-07-20' TO '2024-05-23'; |
|
# Cleanup
|
DROP TABLE t1; |
10.4 debug d2013e73 |
mysqld: /data/src/10.4/sql/ha_partition.cc:10493: virtual void ha_partition::get_auto_increment(ulonglong, ulonglong, ulonglong, ulonglong*, ulonglong*): Assertion `part_share->auto_inc_initialized' failed.
|
190405 17:50:08 [ERROR] mysqld got signal 6 ;
|
|
#7 0x00007f7d3e3a6ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
|
#8 0x0000560cfbf51b36 in ha_partition::get_auto_increment (this=0x7f7d28009a68, offset=1, increment=1, nb_desired_values=1, first_value=0x7f7d3851eb58, nb_reserved_values=0x7f7d3851eb60) at /data/src/10.4/sql/ha_partition.cc:10493
|
#9 0x0000560cfb7caa86 in handler::update_auto_increment (this=0x7f7d28009a68) at /data/src/10.4/sql/handler.cc:3533
|
#10 0x0000560cfb5ac96c in TABLE::update_generated_fields (this=0x7f7d2813b8a0) at /data/src/10.4/sql/table.cc:8310
|
#11 0x0000560cfb5acac1 in TABLE::period_make_insert (this=0x7f7d2813b8a0, src=0x7f7d28015ea0, dst=0x7f7d28132ca8) at /data/src/10.4/sql/table.cc:8330
|
#12 0x0000560cfb5acd77 in TABLE::insert_portion_of_time (this=0x7f7d2813b8a0, thd=0x7f7d28000b00, period_conds=..., rows_inserted=0x7f7d3851ed90) at /data/src/10.4/sql/table.cc:8367
|
#13 0x0000560cfb97a751 in mysql_delete (thd=0x7f7d28000b00, table_list=0x7f7d28015720, conds=0x7f7d28016c28, order_list=0x7f7d280054a0, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.4/sql/sql_delete.cc:842
|
#14 0x0000560cfb483308 in mysql_execute_command (thd=0x7f7d28000b00) at /data/src/10.4/sql/sql_parse.cc:4985
|
#15 0x0000560cfb48e055 in mysql_parse (thd=0x7f7d28000b00, rawbuf=0x7f7d280155e8 "DELETE FROM t1 FOR PORTION OF app FROM '2023-07-20' TO '2024-05-23'", length=67, parser_state=0x7f7d38520180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
|
#16 0x0000560cfb479aac in dispatch_command (command=COM_QUERY, thd=0x7f7d28000b00, packet=0x7f7d2800a8a1 "DELETE FROM t1 FOR PORTION OF app FROM '2023-07-20' TO '2024-05-23'", packet_length=67, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
|
#17 0x0000560cfb478292 in do_command (thd=0x7f7d28000b00) at /data/src/10.4/sql/sql_parse.cc:1365
|
#18 0x0000560cfb5f0689 in do_handle_one_connection (connect=0x560cfec477c0) at /data/src/10.4/sql/sql_connect.cc:1398
|
#19 0x0000560cfb5f03fa in handle_one_connection (arg=0x560cfec477c0) at /data/src/10.4/sql/sql_connect.cc:1301
|
#20 0x0000560cfbae480d in pfs_spawn_thread (arg=0x560cfed39b90) at /data/src/10.4/storage/perfschema/pfs.cc:1862
|
#21 0x00007f7d40295494 in start_thread (arg=0x7f7d38521700) at pthread_create.c:333
|
#22 0x00007f7d3e46393f in clone () from /lib/x86_64-linux-gnu/libc.so.6
|
Reproducible with MyISAM, InnoDB, Aria.
Non-debug build doesn't crash, but it produces a strange error:
10.4 non-debug d2013e73 |
mysqltest: At line 5: query 'DELETE FROM t1 FOR PORTION OF app FROM '2023-07-20' TO '2024-05-23'' failed: 167: Out of range value for column 'f' at row 1
|
I examined the successful processing of Single INSERT and UPDATE FOR PORTION OF in the following test case.
--source include/have_partition.inc
CREATE TABLE t1 (f INT, s DATE, e DATE, PERIOD FOR app(s,e)) PARTITION BY KEY(f) PARTITIONS 8;
INSERT INTO t1 (s,e) VALUES ('2023-07-21','2024-06-07');
ALTER TABLE t1 MODIFY f INT AUTO_INCREMENT KEY;
UPDATE t1 FOR PORTION OF app FROM '2023-07-20' TO '2024-05-23' SET f = 2;
DROP TABLE t1;
INSERT -> ALTER TABLE
auto_inc_initialized be true in ha_partition::info(HA_STATUS_AUTO) in ha_partition::update_next_auto_inc_val
#0 ha_partition::info (this=0x7fcc94196998, flag=32716) at /home/lrf141/server/sql/ha_partition.cc:8259
#1 0x000055908e13b845 in ha_partition::update_next_auto_inc_val (this=0x7fcc940624d8) at /home/lrf141/server/sql/ha_partition.cc:10528
#2 0x000055908e12a60c in ha_partition::write_row (this=0x7fcc940624d8, buf=0x7fcc94062090 "\377") at /home/lrf141/server/sql/ha_partition.cc:4281
#3 0x000055908de13148 in handler::ha_write_row (this=0x7fcc940624d8, buf=0x7fcc94062090 "\377") at /home/lrf141/server/sql/handler.cc:6774
#4 0x000055908dbba932 in copy_data_between_tables (thd=0x7fcc94000d90, from=0x7fcc94195290, to=0x7fcc94061210, create=..., ignore=false, order_num=0, order=0x0, copied=0x7fcca698cc38,
deleted=0x7fcca698cc40, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7fcca698e6b0) at /home/lrf141/server/sql/sql_table.cc:10985
#5 0x000055908dbb8792 in mysql_alter_table (thd=0x7fcc94000d90, new_db=0x7fcc94005568, new_name=0x7fcc94005990, create_info=0x7fcca698f2b0, table_list=0x7fcc94014878,
alter_info=0x7fcca698f1f0, order_num=0, order=0x0, ignore=false) at /home/lrf141/server/sql/sql_table.cc:10405
#6 0x000055908dc5353e in Sql_cmd_alter_table::execute (this=0x7fcc94015128, thd=0x7fcc94000d90) at /home/lrf141/server/sql/sql_alter.cc:520
#7 0x000055908dac6a0e in mysql_execute_command (thd=0x7fcc94000d90) at /home/lrf141/server/sql/sql_parse.cc:6192
#8 0x000055908dacbdfb in mysql_parse (thd=0x7fcc94000d90, rawbuf=0x7fcc94014798 "ALTER TABLE t1 MODIFY f SERIAL", length=30, parser_state=0x7fcca69904d0, is_com_multi=false,
is_next_command=false) at /home/lrf141/server/sql/sql_parse.cc:7995
#9 0x000055908dab80ff in dispatch_command (command=COM_QUERY, thd=0x7fcc94000d90, packet=0x7fcc9400abf1 "ALTER TABLE t1 MODIFY f SERIAL", packet_length=30, is_com_multi=false,
is_next_command=false) at /home/lrf141/server/sql/sql_parse.cc:1857
#10 0x000055908dab6965 in do_command (thd=0x7fcc94000d90) at /home/lrf141/server/sql/sql_parse.cc:1373
#11 0x000055908dc49cd0 in do_handle_one_connection (connect=0x559091cda570) at /home/lrf141/server/sql/sql_connect.cc:1420
#12 0x000055908dc49969 in handle_one_connection (arg=0x559091cda570) at /home/lrf141/server/sql/sql_connect.cc:1316
#13 0x000055908e17e31a in pfs_spawn_thread (arg=0x559091ca6c60) at /home/lrf141/server/storage/perfschema/pfs.cc:1869
#14 0x00007fccadd26609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#15 0x00007fccad8f9293 in clone () from /lib/x86_64-linux-gnu/libc.so.6
(rr) frame 1
#1 0x000055908e13b845 in ha_partition::update_next_auto_inc_val (this=0x7fcc940624d8) at /home/lrf141/server/sql/ha_partition.cc:10528
10528 info(HA_STATUS_AUTO);
ALTER TABLE -> UPDATE FOR PORTITON OF
auto_inc_initialized be true in ha_partition::info(HA_STATUS_AUTO) in ha_partition::update_next_auto_inc_val too.
(rr) bt
#0 ha_partition::info (this=0x55793f37e258 <_current_thd()+20>, flag=32703) at /home/lrf141/server/sql/ha_partition.cc:8259
#1 0x000055793f6bc845 in ha_partition::update_next_auto_inc_val (this=0x7fbf801a60a8) at /home/lrf141/server/sql/ha_partition.cc:10528
#2 0x000055793f6abf92 in ha_partition::update_row (this=0x7fbf801a60a8, old_data=0x7fbf8007dca8 "\377\001", new_data=0x7fbf8007dc98 "\377\002")
at /home/lrf141/server/sql/ha_partition.cc:4466
#3 0x000055793f39463c in handler::ha_update_row (this=0x7fbf801a60a8, old_data=0x7fbf8007dca8 "\377\001", new_data=0x7fbf8007dc98 "\377\002") at /home/lrf141/server/sql/handler.cc:6820
#4 0x000055793f158b95 in mysql_update (thd=0x7fbf80000d90, table_list=0x7fbf80014a48, fields=..., values=..., conds=0x7fbf80015fb8, order_num=0, order=0x0, limit=18446744073709551615,
ignore=false, found_return=0x7fbf9c0c7da0, updated_return=0x7fbf9c0c7e60) at /home/lrf141/server/sql/sql_update.cc:1081
#5 0x000055793f040e04 in mysql_execute_command (thd=0x7fbf80000d90) at /home/lrf141/server/sql/sql_parse.cc:4434
#6 0x000055793f04cdfb in mysql_parse (thd=0x7fbf80000d90, rawbuf=0x7fbf80014798 "UPDATE t1 FOR PORTION OF app FROM '2023-07-20' TO '2024-05-23' SET f = 2", length=72,
parser_state=0x7fbf9c0c84d0, is_com_multi=false, is_next_command=false) at /home/lrf141/server/sql/sql_parse.cc:7995
#7 0x000055793f0390ff in dispatch_command (command=COM_QUERY, thd=0x7fbf80000d90, packet=0x7fbf8000abf1 "UPDATE t1 FOR PORTION OF app FROM '2023-07-20' TO '2024-05-23' SET f = 2",
packet_length=72, is_com_multi=false, is_next_command=false) at /home/lrf141/server/sql/sql_parse.cc:1857
#8 0x000055793f037965 in do_command (thd=0x7fbf80000d90) at /home/lrf141/server/sql/sql_parse.cc:1373
#9 0x000055793f1cacd0 in do_handle_one_connection (connect=0x5579426ae570) at /home/lrf141/server/sql/sql_connect.cc:1420
#10 0x000055793f1ca969 in handle_one_connection (arg=0x5579426ae570) at /home/lrf141/server/sql/sql_connect.cc:1316
#11 0x000055793f6ff31a in pfs_spawn_thread (arg=0x55794267ac60) at /home/lrf141/server/storage/perfschema/pfs.cc:1869
#12 0x00007fbfa335e609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#13 0x00007fbfa2f31293 in clone () from /lib/x86_64-linux-gnu/libc.so.6
So, Maybe call ha_partition::update_auto_next_inc_val in DELETE FOR PORTION PORTION OF statement.