[MDEV-20120] Server crashes in extra_cb or in ha_partition::try_semi_consistent_read or in ha_partition::info Created: 2019-07-22  Updated: 2020-06-02  Resolved: 2020-05-23

Status: Closed
Project: MariaDB Server
Component/s: Partitioning, Versioned Tables
Affects Version/s: 10.4
Fix Version/s: 10.4.8

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

Issue Links:
Relates
relates to MDEV-19304 Segfault in ALTER TABLE after UPDATE ... Closed
relates to MDEV-20121 Server crashes in handler::ha_write_r... Closed

 Description   

Please note that SIMULTANEOUS_ASSIGNMENT doesn't just affect the outcome of the test case, but changes the behavior of the UPDATE statement (error vs success).

Test case 1

--source include/have_partition.inc
 
CREATE TABLE t1 (
    a INT,
    f DATE,
    t DATE,
    PERIOD FOR app(f,t),
    s TIMESTAMP(6) AS ROW START,
    e TIMESTAMP(6) AS ROW END,
    PERIOD FOR SYSTEM_TIME(s,e)
) WITH SYSTEM VERSIONING
  ENGINE=MyISAM
  PARTITION BY system_time ( PARTITION p1 HISTORY, PARTITION pn CURRENT );
 
INSERT INTO t1 (f,t) VALUES ('2012-12-12','2013-12-12');
SET SQL_MODE= 'SIMULTANEOUS_ASSIGNMENT';
--error 0,ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
UPDATE t1 SET e = '2014-12-12 00:00:00';
--error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1);
 
# Cleanup
DROP TABLE t1;

10.4 09e9f884

#3  <signal handler called>
#4  0x0000563d264692ea in extra_cb (h=0x420fffffff7f9148, operation=0x7f7ba03a4514) at /data/src/10.4/sql/ha_partition.cc:8482
#5  0x0000563d26469e88 in ha_partition::loop_partitions (this=0x7f7b90138128, callback=0x563d264692d6 <extra_cb(handler*, void*)>, param=0x7f7ba03a4514) at /data/src/10.4/sql/ha_partition.cc:9146
#6  0x0000563d26469802 in ha_partition::extra (this=0x7f7b90138128, operation=HA_EXTRA_DETACH_CHILDREN) at /data/src/10.4/sql/ha_partition.cc:8960
#7  0x0000563d258fe4bf in close_thread_tables (thd=0x7f7b90000b00) at /data/src/10.4/sql/sql_base.cc:914
#8  0x0000563d259a7b63 in mysql_execute_command (thd=0x7f7b90000b00) at /data/src/10.4/sql/sql_parse.cc:6164
#9  0x0000563d259ac7ed in mysql_parse (thd=0x7f7b90000b00, rawbuf=0x7f7b90013108 "INSERT INTO t1 (a) VALUES (1)", length=29, parser_state=0x7f7ba03a5180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7908
#10 0x0000563d25998a96 in dispatch_command (command=COM_QUERY, thd=0x7f7b90000b00, packet=0x7f7b90008311 "INSERT INTO t1 (a) VALUES (1)", packet_length=29, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
#11 0x0000563d259971dc in do_command (thd=0x7f7b90000b00) at /data/src/10.4/sql/sql_parse.cc:1360
#12 0x0000563d25b10716 in do_handle_one_connection (connect=0x563d28639cb0) at /data/src/10.4/sql/sql_connect.cc:1404
#13 0x0000563d25b10465 in handle_one_connection (arg=0x563d28639cb0) at /data/src/10.4/sql/sql_connect.cc:1306
#14 0x0000563d2643bb09 in pfs_spawn_thread (arg=0x563d2869d630) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#15 0x00007f7ba7d484a4 in start_thread (arg=0x7f7ba03a6700) at pthread_create.c:456
#16 0x00007f7ba6290d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Test case 2

--source include/have_partition.inc
--source include/have_innodb.inc
 
CREATE TABLE t1 (
    a INT,
    f DATE,
    t DATE,
    PERIOD FOR app(f,t),
    s TIMESTAMP(6) AS ROW START,
    e TIMESTAMP(6) AS ROW END,
    PERIOD FOR SYSTEM_TIME(s,e)
) WITH SYSTEM VERSIONING
  ENGINE=InnoDB
  PARTITION BY system_time ( PARTITION p1 HISTORY, PARTITION pn CURRENT );
 
INSERT INTO t1 (f,t) VALUES ('2012-12-12','2013-12-12');
SET SQL_MODE= 'SIMULTANEOUS_ASSIGNMENT';
--error 0,ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
UPDATE t1 SET e = '2014-12-12 00:00:00';
--error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1);
 
# Cleanup
DROP TABLE t1;

10.4 09e9f884

#3  <signal handler called>
#4  0x0000556188e6b7be in ha_partition::try_semi_consistent_read (this=0x7f740414e898, yes=false) at /data/src/10.4/sql/ha_partition.cc:4203
#5  0x00005561884b3b72 in mysql_update (thd=0x7f7404000b00, table_list=0x7f7404013200, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551614, ignore=false, found_return=0x7f745015c860, updated_return=0x7f745015c920) at /data/src/10.4/sql/sql_update.cc:1213
#6  0x00005561883ae196 in mysql_execute_command (thd=0x7f7404000b00) at /data/src/10.4/sql/sql_parse.cc:4376
#7  0x00005561883ba7ed in mysql_parse (thd=0x7f7404000b00, rawbuf=0x7f7404013108 "UPDATE t1 SET e = '2014-12-12 00:00:00'", length=39, parser_state=0x7f745015d180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7908
#8  0x00005561883a6a96 in dispatch_command (command=COM_QUERY, thd=0x7f7404000b00, packet=0x7f740419dca1 "UPDATE t1 SET e = '2014-12-12 00:00:00'", packet_length=39, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
#9  0x00005561883a51dc in do_command (thd=0x7f7404000b00) at /data/src/10.4/sql/sql_parse.cc:1360
#10 0x000055618851e716 in do_handle_one_connection (connect=0x55618c5cab30) at /data/src/10.4/sql/sql_connect.cc:1404
#11 0x000055618851e465 in handle_one_connection (arg=0x55618c5cab30) at /data/src/10.4/sql/sql_connect.cc:1306
#12 0x0000556188e49b09 in pfs_spawn_thread (arg=0x55618c5494c0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#13 0x00007f7456b5a4a4 in start_thread (arg=0x7f745015e700) at pthread_create.c:456
#14 0x00007f74550a2d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Test case 3

--source include/have_partition.inc
 
CREATE TABLE t1 (
    a INT,
    f DATE,
    t DATE,
    PERIOD FOR app(f,t),
    s TIMESTAMP(6) AS ROW START,
    e TIMESTAMP(6) AS ROW END,
    PERIOD FOR SYSTEM_TIME(s,e)
) WITH SYSTEM VERSIONING
  ENGINE=MyISAM
  PARTITION BY system_time ( PARTITION p1 HISTORY, PARTITION pn CURRENT );
 
INSERT INTO t1 (f,t) VALUES ('2012-12-12','2013-12-12');
SET SQL_MODE= 'SIMULTANEOUS_ASSIGNMENT';
--error 0,ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN
UPDATE t1 SET e = '2014-12-12 00:00:00';
SELECT * FROM t1;
 
# Cleanup
DROP TABLE t1;

10.4 09e9f884

#3  <signal handler called>
#4  0x000055b6bc65f694 in ha_partition::info (this=0x7f4754138128, flag=18) at /data/src/10.4/sql/ha_partition.cc:8209
#5  0x000055b6bbcc5089 in TABLE_LIST::fetch_number_of_rows (this=0x7f4754013750) at /data/src/10.4/sql/table.cc:8872
#6  0x000055b6bbbe6226 in make_join_statistics (join=0x7f4754014718, tables_list=..., keyuse_array=0x7f4754014a08) at /data/src/10.4/sql/sql_select.cc:4827
#7  0x000055b6bbbdcdf4 in JOIN::optimize_inner (this=0x7f4754014718) at /data/src/10.4/sql/sql_select.cc:2193
#8  0x000055b6bbbdaa64 in JOIN::optimize (this=0x7f4754014718) at /data/src/10.4/sql/sql_select.cc:1563
#9  0x000055b6bbbe585a in mysql_select (thd=0x7f4754000b00, tables=0x7f4754013750, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f47540146f0, unit=0x7f4754004a30, select_lex=0x7f4754013190) at /data/src/10.4/sql/sql_select.cc:4591
#10 0x000055b6bbbd5ee2 in handle_select (thd=0x7f4754000b00, lex=0x7f4754004968, result=0x7f47540146f0, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:425
#11 0x000055b6bbb9fa59 in execute_sqlcom_select (thd=0x7f4754000b00, all_tables=0x7f4754013750) at /data/src/10.4/sql/sql_parse.cc:6356
#12 0x000055b6bbb958a0 in mysql_execute_command (thd=0x7f4754000b00) at /data/src/10.4/sql/sql_parse.cc:3898
#13 0x000055b6bbba37ed in mysql_parse (thd=0x7f4754000b00, rawbuf=0x7f4754013108 "SELECT * FROM t1", length=16, parser_state=0x7f476461a180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7908
#14 0x000055b6bbb8fa96 in dispatch_command (command=COM_QUERY, thd=0x7f4754000b00, packet=0x7f4754008311 "SELECT * FROM t1", packet_length=16, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
#15 0x000055b6bbb8e1dc in do_command (thd=0x7f4754000b00) at /data/src/10.4/sql/sql_parse.cc:1360
#16 0x000055b6bbd07716 in do_handle_one_connection (connect=0x55b6beb6bcc0) at /data/src/10.4/sql/sql_connect.cc:1404
#17 0x000055b6bbd07465 in handle_one_connection (arg=0x55b6beb6bcc0) at /data/src/10.4/sql/sql_connect.cc:1306
#18 0x000055b6bc632b09 in pfs_spawn_thread (arg=0x55b6bebcf640) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#19 0x00007f476bfbd4a4 in start_thread (arg=0x7f476461b700) at pthread_create.c:456
#20 0x00007f476a505d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97



 Comments   
Comment by Elena Stepanova [ 2019-07-22 ]

Could be a duplicate of MDEV-19304

Comment by Elena Stepanova [ 2020-05-16 ]

Doesn't crash on the current 10.4 a4996f95 or 10.5 69077dea. Something has changed, INSERT in test cases 1-2 produces a different error.

Comment by Elena Stepanova [ 2020-05-23 ]

The failure stopped happening on 10.4 after this merge:

commit 1d15a28e52e41fae0847284089b2073ab33162a5
Merge: c4feef50cfa a20f6f9853e
Author: Marko Mäkelä
Date:   Wed Aug 14 18:06:51 2019 +0300
 
    Merge 10.3 into 10.4

It is not a precise explanation, but it was a long time ago, and the merge did contain changes in system versioning, which is a usual reason for failures of this type to disappear. So we'll consider it fixed.

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