From cf2c8701b48417bde08dd6fdc58d9da735d53481 Mon Sep 17 00:00:00 2001 From: Jimmy Yang Date: Wed, 6 Oct 2010 03:41:26 -0700 Subject: Fix Bug #57255 Cascade Delete results in "Got error -1 from storage engine". rb://477 approved by Marko --- storage/innodb_plugin/row/row0mysql.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'storage/innodb_plugin/row') diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index 78b3b2afdbf..9cabea507fb 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -1593,6 +1593,9 @@ row_update_cascade_for_mysql( trx = thr_get_trx(thr); + /* Increment fk_cascade_depth to record the recursive call depth on + a single update/delete that affects multiple tables chained + together with foreign key relations. */ thr->fk_cascade_depth++; if (thr->fk_cascade_depth > FK_MAX_CASCADE_DEL) { @@ -1604,6 +1607,12 @@ run_again: row_upd_step(thr); + /* The recursive call for cascading update/delete happens + in above row_upd_step(), reset the counter once we come + out of the recursive call, so it does not accumulate for + different row deletes */ + thr->fk_cascade_depth = 0; + err = trx->error_state; /* Note that the cascade node is a subnode of another InnoDB -- cgit v1.2.1