[MDEV-20910] INSERTs into specific partitions crashing server Created: 2019-10-28  Updated: 2019-12-24  Resolved: 2019-12-24

Status: Closed
Project: MariaDB Server
Component/s: Partitioning
Affects Version/s: 10.3.18, 10.4.8
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Chris Calender (Inactive) Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: need_feedback
Environment:

Affects Linux and Windows. Affects Community and Enterprise.


Issue Links:
Duplicate
is duplicated by MDEV-18244 Server crashes in ha_innobase::update... Closed

 Description   

The following insert into a specific partition leads to a crash in 10.3 and 10.4. This works in 10.2 and prior.

CREATE TABLE `t` (
`id` INT(5) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
PARTITION BY HASH (`id`)
(PARTITION `p1`, 
PARTITION `p2`);
 
INSERT INTO t PARTITION (p1) VALUES (1);

Command line output:

mysql> select version();
+--------------------+
| version()          |
+--------------------+
| 10.4.8-MariaDB-log |
+--------------------+
1 row in set (0.00 sec)
 
mysql> CREATE TABLE `t` (
    -> `id` INT(5) NOT NULL AUTO_INCREMENT,
    -> PRIMARY KEY (`id`)
    -> ) ENGINE=INNODB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
    -> PARTITION BY HASH (`id`)
    -> (PARTITION `p1`,
    -> PARTITION `p2`);
Query OK, 0 rows affected (1.58 sec)
 
mysql> INSERT INTO t PARTITION (p1) VALUES (1);
ERROR 2013 (HY000): Lost connection to MySQL server during query

Note the above would generate an error in 10.1 and 10.2:

ERROR 1748 (HY000): Found a row not matching the given partition set

However, if you change the partition to p2 (i.e., the "correct" partition), it still crashes in 10.3 and 10.4!

mysql> INSERT INTO t6 PARTITION (p2) VALUES (1);
ERROR 2013 (HY000): Lost connection to MySQL server during query

Whereas it inserts normally in 10.1 and 10.2:

mysql> INSERT INTO t6 PARTITION (p2) VALUES (1);
Query OK, 1 row affected (0.06 sec)

Error log stack trace from 10.4.8:

2019-10-28 17:50:38 0 [Note] C:\Program Files\MariaDB 10.4\bin\mysqld.exe: ready for connections.
Version: '10.4.8-MariaDB-log'  socket: ''  port: 3319  mariadb.org binary distribution
191028 17:52:58 [ERROR] mysqld got exception 0xc0000005 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
 
To report this bug, see https://mariadb.com/kb/en/reporting-bugs
 
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.
 
Server version: 10.4.8-MariaDB-log
key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=65537
thread_count=28
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 13503 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
 
Thread pointer: 0x9ea7558
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
mysqld.exe!parse_user()
mysqld.exe!strmov()
mysqld.exe!strmov()
mysqld.exe!?ha_write_row@handler@@QEAAHPEBE@Z()
mysqld.exe!?write_record@@YAHPEAVTHD@@PEAUTABLE@@PEAUst_copy_info@@@Z()
mysqld.exe!?mysql_insert@@YA_NPEAVTHD@@PEAUTABLE_LIST@@AEAV?$List@VItem@@@@AEAV?$List@V?$List@VItem@@@@@@22W4enum_duplicates@@_N@Z()
mysqld.exe!?mysql_execute_command@@YAHPEAVTHD@@@Z()
mysqld.exe!?mysql_parse@@YAXPEAVTHD@@PEADIPEAVParser_state@@_N3@Z()
mysqld.exe!?dispatch_command@@YA_NW4enum_server_command@@PEAVTHD@@PEADI_N3@Z()
mysqld.exe!?do_command@@YA_NPEAVTHD@@@Z()
mysqld.exe!?pool_of_threads_scheduler@@YAXPEAUscheduler_functions@@PEAKPEAI@Z()
mysqld.exe!?tp_callback@@YAXPEAUTP_connection@@@Z()
ntdll.dll!TpPostWork()
ntdll.dll!TpDisassociateCallback()
kernel32.dll!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()
 
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x9d6ca20): INSERT INTO t PARTITION (p1) VALUES (1)
Connection ID (thread ID): 30
Status: NOT_KILLED
 
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
 
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file at C:\Program Files\MariaDB 10.4\data\

This also occurs with RANGE partitioning too.



 Comments   
Comment by Elena Stepanova [ 2019-10-28 ]

It must be the same failure as MDEV-18244 , although your test case is better. Since MDEV-18244 is already in the works, and besides it has a long history, let's keep tracking it there, I'll add the test case and the link.

Comment by Chris Calender (Inactive) [ 2019-10-30 ]

To be clear, this also affects RANGE partitions too:

Test case:

CREATE TABLE `t1` (
`id1` BIGINT(20) NOT NULL AUTO_INCREMENT,
`id2` BIGINT(20) NOT NULL,
PRIMARY KEY (`id1`,`id2`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
PARTITION BY RANGE (`id2`)
(PARTITION `p1` VALUES LESS THAN (100),
PARTITION `p2` VALUES LESS THAN (200),
PARTITION `p3` VALUES LESS THAN MAXVALUE);
 
INSERT INTO t1 PARTITION (p1) VALUES (1,1);

Session Output:

mysql> CREATE TABLE `t1` (
    -> `id1` BIGINT(20) NOT NULL AUTO_INCREMENT,
    -> `id2` BIGINT(20) NOT NULL,
    -> PRIMARY KEY (`id1`,`id2`)
    -> ) ENGINE=INNODB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
    -> PARTITION BY RANGE (`id2`)
    -> (PARTITION `p1` VALUES LESS THAN (100),
    -> PARTITION `p2` VALUES LESS THAN (200),
    -> PARTITION `p3` VALUES LESS THAN MAXVALUE);
ERROR 1050 (42S01): Table 't1' already exists
mysql>
mysql> INSERT INTO t1 PARTITION (p1) VALUES (1,1);
ERROR 2013 (HY000): Lost connection to MySQL server during query

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