|
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.
|