Bug #30484 Partitions: crash with self-referencing trigger
Submitted: 17 Aug 2007 20:06 Modified: 22 Oct 2007 18:09
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1.22-beta-debug OS:Linux (SUSE 10 64-bit)
Assigned to: Mattias Jonsson CPU Architecture:Any
Tags: bfsm_2007_10_18

[17 Aug 2007 20:06] Peter Gulutzan
Description:
I create a partitioned table T.
I create a trigger on table T.
The trigger contains "INSERT INTO T".
Normally this 'self reference' would cause an error.
But with a partitioned table, it causes a crash.

How to repeat:
mysql> create table t (s1 int) engine=myisam partition by key (s1);
Query OK, 0 rows affected (0.04 sec)

mysql> create trigger t_ad after delete on t for each row insert into t values (old.s1);
Query OK, 0 rows affected (0.05 sec)

mysql> insert into t values (1);
ERROR 2013 (HY000): Lost connection to MySQL server during query
[17 Aug 2007 20:17] MySQL Verification Team
Thank you for the bug report.

[New Thread -1263010928 (LWP 4645)]
070817 17:13:44 [Note] Event Scheduler: Loaded 0 events
070817 17:13:44 [Note] /home/miguel/dbs/5.1/libexec/mysqld: ready for connections.
Version: '5.1.22-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread -1263211632 (LWP 4672)]
mysqld: ha_partition.cc:4829: virtual int ha_partition::extra(ha_extra_function): Assertion `0' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread -1263211632 (LWP 4672)]
0x00bbc402 in __kernel_vsyscall ()
(gdb) bt full
#0  0x00bbc402 in __kernel_vsyscall ()
No symbol table info available.
#1  0x0021ed40 in raise () from /lib/libc.so.6
No symbol table info available.
#2  0x00220591 in abort () from /lib/libc.so.6
No symbol table info available.
#3  0x0021838b in __assert_fail () from /lib/libc.so.6
No symbol table info available.
#4  0x08399724 in ha_partition::extra (this=0xa553bc8, operation=HA_EXTRA_DELETE_CANNOT_BATCH) at ha_partition.cc:4829
        _db_func_ = 0x87a7b9e "mysql_insert"
        _db_file_ = 0x87a72f8 "sql_insert.cc"
        _db_level_ = 5
        _db_framep_ = (char **) 0x0
        __PRETTY_FUNCTION__ = "virtual int ha_partition::extra(ha_extra_function)"
#5  0x0830f386 in prepare_triggers_for_insert_stmt (table=0xa552cc0) at sql_insert.cc:367
No locals.
#6  0x0831735e in mysql_insert (thd=0xa4f8a20, table_list=0xa545bf0, fields=@0xa4f9d8c, values_list=@0xa4f9db0, update_fields=@0xa4f9da4, update_values=@0xa4f9d98, 
    duplic=DUP_ERROR, ignore=false) at sql_insert.cc:727
        error = 0
        res = -1263217692
        transactional_table = 224
        joins_freed = false
        changed = 180
        was_insert_delayed = false
        value_count = 1
        counter = 1
<cut>
[4 Oct 2007 8:08] Ingo Strüwing
The 'extra' operation HA_EXTRA_DELETE_CANNOT_BATCH is not yet implemented for the partition handler.

This operation seems to be used in NDB only. So it should be safe to ignore it in ha_partition::extra() for now.
[4 Oct 2007 12:56] 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/34896

ChangeSet@1.2568, 2007-10-04 14:56:33+02:00, mattiasj@mattiasj-laptop.(none) +3 -0
  Bug #30484: Partitions: crash with self-referencing trigger
  
  Two cases in ha_partition::extra() was missing
  (HA_EXTRA_DELETE_CANNOT_BATCH and HA_EXTRA_UPDATE_CANNOT_BATCH)
  which only is currently used by NDB (which not uses ha_partition)
[8 Oct 2007 11:30] Sergey Vojtovich
Ok to push, but please consider Ingo's comments.
[22 Oct 2007 17:03] Bugs System
Pushed into 5.1.23-beta
[22 Oct 2007 18:09] Jon Stephens
Documented fix in 5.1.23 changelog.