Bug #34267 Server crash when droping a partition on a table with a trigger
Submitted: 4 Feb 2008 3:26 Modified: 7 Feb 2008 10:27
Reporter: Omer Barnir (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.23 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[4 Feb 2008 3:26] Omer Barnir
Description:
Dropping a partiton of a table that has a trigger defined on it, causes a server crash.

CREATE DATABASE IF NOT EXISTS part_db;
USE part_db;

CREATE TABLE trigger_result (
    entry VARCHAR(30)
);

CREATE TABLE part_range (i int) PARTITION BY RANGE (i) (
    PARTITION p0 VALUES LESS THAN (2),
    PARTITION p1 VALUES LESS THAN (8),
    PARTITION p2 VALUES LESS THAN (17),
    PARTITION p3 VALUES LESS THAN (64)
);

CREATE TRIGGER part_trigger BEFORE INSERT ON part_range
  FOR EACH ROW INSERT INTO trigger_result VALUES ('part2');

ALTER TABLE part_range DROP PARTITION p1;

>>> ERROR 2013 (HY000): Lost connection to MySQL server during query

Note: 1) The problem is not observed if the table does not have a trigger 
         defined on it.
      2) The problem is not observed in 5.1.22

Resolving the stack trace rep[orts the following:
0x81c68c1 handle_segfault + 437
0x81c2df0 _Z19mysql_unlock_tablesP3THDP13st_mysql_lock + 8
0x8137465 _Z26fast_alter_partition_tableP3THDP8st_tableP10Alter_infoP24st_ha_create_informationP10TABLE_LISTPcPKcj + 1889
0x829215e _Z17mysql_alter_tableP3THDPcS1_P24st_ha_create_informationP10TABLE_LISTP10Alter_infojP8st_orderb + 2518
0x81d24f9 _Z21mysql_execute_commandP3THD + 2477
0x81d7d3d _Z11mysql_parseP3THDPKcjPS2_ + 269
0x81d09bd _Z16dispatch_command19enum_server_commandP3THDPcj + 961
0x81d05b0 _Z10do_commandP3THD + 192
0x81cec51 handle_one_connection + 289
0x40031297 _end + 932987655
0x4017037e _end + 934294510

master.err file reports a signal 11 with the following stack:
0x81c68c1
0x81c2df0
0x8137465
0x829215e
0x81d24f9
0x81d7d3d
0x81d09bd
0x81d05b0
0x81cec51
0x40031297
0x4017037e

How to repeat:
Run the attached test case

Suggested fix:
Server should not crash
[4 Feb 2008 3:27] Omer Barnir
test case

Attachment: test05.test (application/octet-stream, text), 636 bytes.

[4 Feb 2008 3:28] Omer Barnir
expected result file

Attachment: test05.result (application/octet-stream, text), 382 bytes.

[7 Feb 2008 10:27] Mikael Ronström
Duplicate of BUG#32943