@@ -2434,15 +2434,24 @@ row_upd_sec_index_entry(
2434
2434
row_ins_sec_index_entry() below */
2435
2435
if (!rec_get_deleted_flag (
2436
2436
rec, dict_table_is_comp (index->table ))) {
2437
+
2438
+ #ifdef WITH_WSREP
2439
+ que_node_t *parent = que_node_get_parent (node);
2440
+ #endif /* WITH_WSREP */
2441
+
2437
2442
err = btr_cur_del_mark_set_sec_rec (
2438
2443
flags, btr_cur, TRUE , thr, &mtr);
2444
+
2439
2445
if (err != DB_SUCCESS) {
2440
2446
break ;
2441
2447
}
2442
2448
#ifdef WITH_WSREP
2443
- if (!referenced && foreign
2444
- && wsrep_must_process_fk (node, trx)
2445
- && !wsrep_thd_is_BF (trx->mysql_thd , FALSE )) {
2449
+ if (!referenced && foreign &&
2450
+ wsrep_on (trx->mysql_thd ) &&
2451
+ !wsrep_thd_is_BF (trx->mysql_thd , FALSE ) &&
2452
+ (!parent || (que_node_get_type (parent) !=
2453
+ QUE_NODE_UPDATE) ||
2454
+ ((upd_node_t *)parent)->cascade_upd_nodes ->empty ())) {
2446
2455
ulint* offsets = rec_get_offsets (
2447
2456
rec, index, NULL , ULINT_UNDEFINED,
2448
2457
&heap);
@@ -2661,6 +2670,9 @@ row_upd_clust_rec_by_insert(
2661
2670
rec_t * rec;
2662
2671
ulint* offsets = NULL ;
2663
2672
2673
+ #ifdef WITH_WSREP
2674
+ que_node_t *parent = que_node_get_parent (node);
2675
+ #endif /* WITH_WSREP */
2664
2676
ut_ad (node);
2665
2677
ut_ad (dict_index_is_clust (index));
2666
2678
@@ -2748,7 +2760,13 @@ row_upd_clust_rec_by_insert(
2748
2760
goto err_exit;
2749
2761
}
2750
2762
#ifdef WITH_WSREP
2751
- } else if (foreign && wsrep_must_process_fk (node, trx)) {
2763
+ } else if (foreign && wsrep_on (trx->mysql_thd ) &&
2764
+ (!parent || (que_node_get_type (parent) != QUE_NODE_UPDATE) ||
2765
+ ((upd_node_t *)parent)->cascade_upd_nodes ->empty ())) {
2766
+
2767
+ err = wsrep_row_upd_check_foreign_constraints (
2768
+ node, pcur, table, index, offsets, thr, mtr);
2769
+
2752
2770
switch (err) {
2753
2771
case DB_SUCCESS:
2754
2772
case DB_NO_REFERENCED_ROW:
@@ -2956,10 +2974,15 @@ row_upd_del_mark_clust_rec(
2956
2974
dberr_t err;
2957
2975
rec_t * rec;
2958
2976
trx_t * trx = thr_get_trx (thr);
2977
+
2959
2978
ut_ad (node);
2960
2979
ut_ad (dict_index_is_clust (index));
2961
2980
ut_ad (node->is_delete );
2962
2981
2982
+ #ifdef WITH_WSREP
2983
+ que_node_t *parent = que_node_get_parent (node);
2984
+ #endif /* WITH_WSREP */
2985
+
2963
2986
pcur = node->pcur ;
2964
2987
btr_cur = btr_pcur_get_btr_cur (pcur);
2965
2988
@@ -2985,9 +3008,13 @@ row_upd_del_mark_clust_rec(
2985
3008
err = row_upd_check_references_constraints (
2986
3009
node, pcur, index->table , index, offsets, thr, mtr);
2987
3010
#ifdef WITH_WSREP
2988
- } else if (foreign && wsrep_must_process_fk (node, trx)) {
3011
+ } else if (trx && wsrep_on (trx->mysql_thd ) &&
3012
+ (!parent || (que_node_get_type (parent) != QUE_NODE_UPDATE) ||
3013
+ ((upd_node_t *)parent)->cascade_upd_nodes ->empty ())) {
3014
+
2989
3015
err = wsrep_row_upd_check_foreign_constraints (
2990
3016
node, pcur, index->table , index, offsets, thr, mtr);
3017
+
2991
3018
switch (err) {
2992
3019
case DB_SUCCESS:
2993
3020
case DB_NO_REFERENCED_ROW:
0 commit comments