summaryrefslogtreecommitdiff
path: root/storage/innodb_plugin/row
diff options
context:
space:
mode:
authorJimmy Yang <jimmy.yang@oracle.com>2010-10-06 03:41:26 -0700
committerJimmy Yang <jimmy.yang@oracle.com>2010-10-06 03:41:26 -0700
commitcf2c8701b48417bde08dd6fdc58d9da735d53481 (patch)
treef80636de12fa39a12ba8df7f19f5349958bb3b0b /storage/innodb_plugin/row
parent6f9839d9658a8716bc2c994bfa6515e0adf170bf (diff)
downloadmariadb-git-cf2c8701b48417bde08dd6fdc58d9da735d53481.tar.gz
Fix Bug #57255 Cascade Delete results in "Got error -1 from storage engine".
rb://477 approved by Marko
Diffstat (limited to 'storage/innodb_plugin/row')
-rw-r--r--storage/innodb_plugin/row/row0mysql.c9
1 files changed, 9 insertions, 0 deletions
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