Bug #6957 Assertion failure in a multi-table delete on a left outer join
Submitted: 2 Dec 2004 18:05 Modified: 6 Dec 2004 2:10
Reporter: Abraham Echenique Carta Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:Windows (Win XP)
Assigned to: Assigned Account CPU Architecture:Any

[2 Dec 2004 18:05] Abraham Echenique Carta
Description:
Deleting with table reference the server fails and shut downs the instance.

How to repeat:
CREATE TABLE `tabla1` (
`t1_id` int(10) unsigned NOT NULL auto_increment,
`campo1` int(10) unsigned NOT NULL default '0',
`campo2` int(10) unsigned NOT NULL default '0',
PRIMARY KEY  (`t1_id`),
UNIQUE KEY `llave` (`campo1`,`campo2`)
) ENGINE=InnoDB;

CREATE TABLE `tabla2` (
`t2_id` int(10) unsigned NOT NULL auto_increment,
`campo1` int(10) unsigned NOT NULL default '0',
`campo2` int(10) unsigned NOT NULL default '0',
PRIMARY KEY  (`t2_id`),
KEY `llave` (`campo1`,`campo2`),
CONSTRAINT `fk_tabla1` FOREIGN KEY (`campo1`, `campo2`) REFERENCES `tabla1` (`campo1`, `campo2`)
) ENGINE=InnoDB;

INSERT INTO tabla1 SET campo1 = 1, campo2 = 1;

DELETE FROM tabla1, tabla2 
USING tabla1 LEFT OUTER JOIN tabla2 USING(campo1, campo2) 
WHERE tabla1.t1_id = 1;
[2 Dec 2004 18:44] Heikki Tuuri
Sergey,

this may be a duplicate of Bug #5837 where a multi-table delete asserts in a left join.

I was able to repeat this with the latest 4.1.8 tree on Linux.

You have a patch to #5837, but has it been pushed yet?

Regards,

Heikki

heikki@hundin:~/mysql-4.1/sql> ./mysqld
InnoDB: The first specified data file /home/heikki/data/ibdata1 did not exist:
InnoDB: a new database to be created!
041202 20:03:54  InnoDB: Setting file /home/heikki/data/ibdata1 size to 20 MB
InnoDB: Database physically writes the file full: wait...
041202 20:03:55  InnoDB: Log file /home/heikki/data/ib_logfile0 did not exist: n
ew to be created
InnoDB: Setting log file /home/heikki/data/ib_logfile0 size to 56 MB
InnoDB: Database physically writes the file full: wait...
041202 20:04:01  InnoDB: Log file /home/heikki/data/ib_logfile1 did not exist: n
ew to be created
InnoDB: Setting log file /home/heikki/data/ib_logfile1 size to 56 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
041202 20:04:09  InnoDB: Started; log sequence number 0 0
041202 20:04:09 [Warning] mysql.user table is not updated to new password format
; Disabling new password usage until mysql_fix_privilege_tables is run
./mysqld: ready for connections.
Version: '4.1.8-debug-log'  socket: '/home/heikki/bugsocket'  port: 3307  Source
 distribution
041202 20:04:56InnoDB: Assertion failure in thread 147466 in file row0mysql.c li
ne 1132
InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html
InnoDB: about forcing recovery.
mysqld got signal 11;
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.
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.

key_buffer_size=36700160
read_buffer_size=131072
max_used_connections=1
max_connections=100
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 253436
 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x8b74160
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...
Cannot determine thread, fp=0x4f25f038, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x8163dd9
0x4006896c
0x8271c82
0x8201491
0x81c8799
0x81b1f8b
0x81b0a10
0x81a62f3
0x81a6760
0x817c10a
0x817f107
0x81785e0
0x8177eff
0x81773fb
0x40062f60
0x401f5327
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow
instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8b71a78 = DELETE FROM tabla1, tabla2
USING tabla1 LEFT OUTER JOIN tabla2 USING(campo1, campo2)
WHERE tabla1.t1_id = 1
thd->thread_id=1
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
[2 Dec 2004 18:55] Abraham Echenique Carta
I thing that it's the same #5837... notice that I use a multicolumn index.
[3 Dec 2004 15:08] Sergey Petrunya
Verified that fix for BUG#5837 fixes this problem too.
[4 Dec 2004 16:08] Sergey Petrunya
ChangeSet@1.2006, 2004-12-04 18:45:08+03:00, sergefp@mysql.com
[6 Dec 2004 2:10] Sergey Petrunya
The same issue as in BUG#5837