Bug #32790 crash in trigger.test with InnoDB for a table
Submitted: 27 Nov 2007 20:17 Modified: 15 Apr 2008 1:24
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:5.0, 5.1, 6.0 OS:Any
Assigned to: Andrei Elkin CPU Architecture:Any
Triage: D3 (Medium)

[27 Nov 2007 20:17] Matthias Leich
Description:
./mysql-test-run.pl --mem --force \
   --mysqld="--default-storage-engine=innodb" \
   trigger
leads to server crash.
Note:
1. "standard" trigger.test execution uses
   MyISAM and does not crash.
2. It can be expected that we suffer from
   Bug#22510 mysql-test-run trigger.test fails when
             using InnoDB as the default engine
   when the crash does not occur.
3. It looks like this crash was introduced by code
   changes since November 2006.

Simplified test showing the bug:
-----------------------------------------
create table t1 (i int, bt int) engine=myisam;
create table t2 (i int) ENGINE = InnoDB;
insert into t1 values (1, 1);
insert into t2 values (1);

create trigger bd before delete on t1
for each row set @a:= old.bt;

alter table t1 drop column bt;

# I get here a crash.
--error ER_BAD_FIELD_ERROR
delete t2, t1 from t2 straight_join t1
where t1.i = t2.i;

My environment:
- mysql-5.0 ChangeSet@1.2586, 2007-11-21
- mysql-5.1-build ChangeSet@1.2615, 2007-11-26
- mysql-6.0-build ChangeSet@1.2691, 2007-11-23
- compile-pentium-debug-max
- Linux (OpenSuSE 10.3) 64 Bit
- Intel Core2Duo 6400 64 Bit

How to repeat:
Please run either
- the attached testcase or
- ./mysql-test-run.pl --mem --force \
   --mysqld="--default-storage-engine=innodb" \
   trigger

I also attached my stacktrace.
[27 Nov 2007 20:23] Matthias Leich
Simplified testcase

Attachment: ml_trigger.test (application/octet-stream, text), 1.02 KiB.

[27 Nov 2007 20:25] Matthias Leich
stacktrace

Attachment: stacktrace (application/octet-stream, text), 3.39 KiB.

[28 Nov 2007 9:55] Andrei Elkin
Taking to myself as symptoms are similar to earlier reported
Bug #31472 multi_update crashes at assert about trans_safe.
[4 Feb 2008 14:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/41649

ChangeSet@1.2568, 2008-02-04 16:35:41+02:00, aelkin@koti.dsl.inet.fi +1 -0
  Bug #32790 crash in trigger.test with InnoDB for a table
  
  the reason for the failure were incorrect asserts.
  
  Removing asserts altogether as there is no the implication does not hold
  (as explained in the comments for the file).
[12 Feb 2008 10:43] Andrei Elkin
Pushed to 5.1-rpl.
[12 Feb 2008 10:49] Andrei Elkin
Correction. Pushed to 5.0-rpl.
[25 Mar 2008 11:22] Bugs System
Pushed into 5.0.60
[25 Mar 2008 11:23] Bugs System
Pushed into 5.1.24-rc
[26 Mar 2008 19:00] Bugs System
Pushed into 6.0.5-alpha
[31 Mar 2008 19:49] Jon Stephens
Pushed into 5.1.23-ndb-6.3.11.
[15 Apr 2008 1:24] Paul Dubois
Noted in 5.0.60, 5.1.24, 6.0.5 changelogs.

Incorrect assertions could cause a server crash for DELETE triggers
for transactional tables.