[MDEV-8282] crash in filesort() with simple ordered delete Created: 2015-06-07  Updated: 2015-06-20  Resolved: 2015-06-20

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Delete
Affects Version/s: 10.1.5
Fix Version/s: 10.1.6

Type: Bug Priority: Major
Reporter: sbester1 Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None
Environment:

Win x64



 Description   

Version: '10.1.5-MariaDB'  mariadb.org binary distribution
[ERROR] mysqld got exception 0xc0000005 ;
mysqld.exe!filesort()[filesort.cc:215]
mysqld.exe!mysql_delete()[sql_delete.cc:507]
mysqld.exe!mysql_execute_command()[sql_parse.cc:4041]
mysqld.exe!mysql_parse()[sql_parse.cc:7178]
mysqld.exe!dispatch_command()[sql_parse.cc:1473]
mysqld.exe!do_command()[sql_parse.cc:1093]
mysqld.exe!threadpool_process_request()[threadpool_common.cc:233]
mysqld.exe!io_completion_callback()[threadpool_win.cc:568]

How To Repeat:
---------------------
Start server: mysqld.exe --no-defaults --console

drop table if exists t1;
create table t1(a int) engine=innodb;
delete from t1 order by a;



 Comments   
Comment by Elena Stepanova [ 2015-06-07 ]

Thanks for the report and the test case.

The problem was introduced with the following revision:

commit 4938b822634b173c0d7ef882f721b553b223fadd
Author: Sergei Petrunia <psergey@askmonty.org>
Date:   Sun Apr 12 04:48:42 2015 +0300
 
    MDEV-7836: ANALYZE FORMAT=JSON should provide info about GROUP/ORDER BY
    
    Provide basic info about sorting/grouping done by the queries.

Comment by Sergei Petrunia [ 2015-06-19 ]

It crashes because of the following scenario:

  • DELETE code sees no WHERE clause and decides to call h->delete_all_rows().
  • We remember that in the query plan
  • ha_innobase::delete_all_rows() returns HA_ERR_NOT_IMPLEMENTED
  • execution proceeds to do regular row-by-row deletion. That includes doing filesort.
    However, we didn't set up the QEP to support sorting, so we crash.
Generated at Thu Feb 08 07:25:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.