Skip to content

Commit

Permalink
MW-402 cascading FK issues (5.5 version)
Browse files Browse the repository at this point in the history
copied the fix for MW-402 from mysql-wsrep-bugs/MW-402-5.6
(note, this is not git merge)
  • Loading branch information
sjaakola authored and Jan Lindström committed Oct 19, 2017
1 parent 0332acc commit e90249b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions storage/innobase/row/row0ins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,7 @@ row_ins_foreign_check_on_constraint(
foreign,
clust_rec,
clust_index,
FALSE,
(node) ? TRUE : FALSE);
FALSE, FALSE);
if (err != DB_SUCCESS) {
fprintf(stderr,
"WSREP: foreign key append failed: %lu\n", err);
Expand Down
10 changes: 5 additions & 5 deletions storage/innobase/row/row0upd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ row_upd_clust_rec_by_insert(
}
}
#ifdef WITH_WSREP
if (!referenced &&
if (wsrep_on(trx->mysql_thd) && !referenced &&
!(parent && que_node_get_type(parent) == QUE_NODE_UPDATE &&
((upd_node_t*)parent)->cascade_node == node) &&
foreign
Expand Down Expand Up @@ -2313,6 +2313,7 @@ row_upd_del_mark_clust_rec(
#ifdef WITH_WSREP
rec_t* rec;
que_node_t *parent = que_node_get_parent(node);
trx_t* trx = thr_get_trx(thr);
#endif /* WITH_WSREP */

ut_ad(node);
Expand Down Expand Up @@ -2348,11 +2349,10 @@ row_upd_del_mark_clust_rec(
node, pcur, index->table, index, offsets, thr, mtr);
}
#ifdef WITH_WSREP
if (err == DB_SUCCESS && !referenced &&
if (trx && wsrep_on(trx->mysql_thd) &&
err == DB_SUCCESS && !referenced && foreign &&
!(parent && que_node_get_type(parent) == QUE_NODE_UPDATE &&
((upd_node_t*)parent)->cascade_node == node) &&
thr_get_trx(thr) &&
foreign
((upd_node_t*)parent)->cascade_node == node)
) {
err = wsrep_row_upd_check_foreign_constraints(
node, pcur, index->table, index, offsets, thr, mtr);
Expand Down

0 comments on commit e90249b

Please sign in to comment.