Commit d186b992 authored by sjaakola's avatar sjaakola Committed by Jan Lindström

MW-402 cascading FK issue (5.7 version)

Optimizing cascade node list traversal, which could turn out as
performance bottleneck
Even this current cascade node check could be skipped, but a dedicated
mtr test is needed to confirm that
parent 16b374b9
...@@ -2430,6 +2430,10 @@ row_upd_sec_index_entry( ...@@ -2430,6 +2430,10 @@ row_upd_sec_index_entry(
if (!rec_get_deleted_flag( if (!rec_get_deleted_flag(
rec, dict_table_is_comp(index->table))) { rec, dict_table_is_comp(index->table))) {
#ifdef WITH_WSREP
que_node_t *parent = que_node_get_parent(node);
#endif /* WITH_WSREP */
err = btr_cur_del_mark_set_sec_rec( err = btr_cur_del_mark_set_sec_rec(
flags, btr_cur, TRUE, thr, &mtr); flags, btr_cur, TRUE, thr, &mtr);
...@@ -2437,10 +2441,9 @@ row_upd_sec_index_entry( ...@@ -2437,10 +2441,9 @@ row_upd_sec_index_entry(
break; break;
} }
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (!referenced && foreign && if (!referenced && foreign
wsrep_on(trx->mysql_thd) && && wsrep_must_process_fk(node, trx)
!wsrep_thd_is_BF(trx->mysql_thd, FALSE) && && !wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
wsrep_must_process_fk(node, trx)) {
ulint* offsets = rec_get_offsets( ulint* offsets = rec_get_offsets(
rec, index, NULL, ULINT_UNDEFINED, rec, index, NULL, ULINT_UNDEFINED,
&heap); &heap);
...@@ -2659,6 +2662,9 @@ row_upd_clust_rec_by_insert( ...@@ -2659,6 +2662,9 @@ row_upd_clust_rec_by_insert(
rec_t* rec; rec_t* rec;
ulint* offsets = NULL; ulint* offsets = NULL;
#ifdef WITH_WSREP
que_node_t *parent = que_node_get_parent(node);
#endif /* WITH_WSREP */
ut_ad(node); ut_ad(node);
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
...@@ -2752,6 +2758,7 @@ row_upd_clust_rec_by_insert( ...@@ -2752,6 +2758,7 @@ row_upd_clust_rec_by_insert(
err = wsrep_row_upd_check_foreign_constraints( err = wsrep_row_upd_check_foreign_constraints(
node, pcur, table, index, offsets, thr, mtr); node, pcur, table, index, offsets, thr, mtr);
switch (err) { switch (err) {
case DB_SUCCESS: case DB_SUCCESS:
case DB_NO_REFERENCED_ROW: case DB_NO_REFERENCED_ROW:
...@@ -2964,6 +2971,10 @@ row_upd_del_mark_clust_rec( ...@@ -2964,6 +2971,10 @@ row_upd_del_mark_clust_rec(
ut_ad(dict_index_is_clust(index)); ut_ad(dict_index_is_clust(index));
ut_ad(node->is_delete); ut_ad(node->is_delete);
#ifdef WITH_WSREP
que_node_t *parent = que_node_get_parent(node);
#endif /* WITH_WSREP */
pcur = node->pcur; pcur = node->pcur;
btr_cur = btr_pcur_get_btr_cur(pcur); btr_cur = btr_pcur_get_btr_cur(pcur);
...@@ -2992,6 +3003,7 @@ row_upd_del_mark_clust_rec( ...@@ -2992,6 +3003,7 @@ row_upd_del_mark_clust_rec(
} else if (trx && wsrep_on(trx->mysql_thd) && } else if (trx && wsrep_on(trx->mysql_thd) &&
wsrep_must_process_fk(node, trx)) { wsrep_must_process_fk(node, trx)) {
err = wsrep_row_upd_check_foreign_constraints( err = wsrep_row_upd_check_foreign_constraints(
node, pcur, index->table, index, offsets, thr, mtr); node, pcur, index->table, index, offsets, thr, mtr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment