summaryrefslogtreecommitdiff
path: root/storage/xtradb/row/row0upd.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2014-09-28 20:43:56 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2014-09-28 20:43:56 -0400
commitc916085e271cd049537b1e07b36cd060c44750bd (patch)
tree337ddfcd033174143cf9bd08e6ba50174459d7ff /storage/xtradb/row/row0upd.cc
parent023366e6eb68edca3858c32e7492788e047d927a (diff)
parentf1afc003eefe0aafd3e070c7453d9e029d8445a8 (diff)
downloadmariadb-git-c916085e271cd049537b1e07b36cd060c44750bd.tar.gz
bzr merge -rtag:mariadb-10.0.14 maria/10.0/
Diffstat (limited to 'storage/xtradb/row/row0upd.cc')
-rw-r--r--storage/xtradb/row/row0upd.cc71
1 files changed, 33 insertions, 38 deletions
diff --git a/storage/xtradb/row/row0upd.cc b/storage/xtradb/row/row0upd.cc
index bdd2a691368..53da8fea77e 100644
--- a/storage/xtradb/row/row0upd.cc
+++ b/storage/xtradb/row/row0upd.cc
@@ -53,11 +53,12 @@ Created 12/27/1996 Heikki Tuuri
#include "pars0sym.h"
#include "eval0eval.h"
#include "buf0lru.h"
+#include <algorithm>
+
#ifdef WITH_WSREP
extern my_bool wsrep_debug;
#endif
-
/* What kind of latch and lock can we assume when the control comes to
-------------------------------------------------------------------
an update node?
@@ -141,12 +142,10 @@ row_upd_index_is_referenced(
trx_t* trx) /*!< in: transaction */
{
dict_table_t* table = index->table;
- dict_foreign_t* foreign;
ibool froze_data_dict = FALSE;
ibool is_referenced = FALSE;
- if (!UT_LIST_GET_FIRST(table->referenced_list)) {
-
+ if (table->referenced_set.empty()) {
return(FALSE);
}
@@ -155,19 +154,13 @@ row_upd_index_is_referenced(
froze_data_dict = TRUE;
}
- foreign = UT_LIST_GET_FIRST(table->referenced_list);
+ dict_foreign_set::iterator it
+ = std::find_if(table->referenced_set.begin(),
+ table->referenced_set.end(),
+ dict_foreign_with_index(index));
- while (foreign) {
- if (foreign->referenced_index == index) {
+ is_referenced = (it != table->referenced_set.end());
- is_referenced = TRUE;
- goto func_exit;
- }
-
- foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
- }
-
-func_exit:
if (froze_data_dict) {
row_mysql_unfreeze_data_dictionary(trx);
}
@@ -188,8 +181,7 @@ wsrep_row_upd_index_is_foreign(
ibool froze_data_dict = FALSE;
ibool is_referenced = FALSE;
- if (!UT_LIST_GET_FIRST(table->foreign_list)) {
-
+ if (table->foreign_set.empty()) {
return(FALSE);
}
@@ -198,17 +190,18 @@ wsrep_row_upd_index_is_foreign(
froze_data_dict = TRUE;
}
- foreign = UT_LIST_GET_FIRST(table->foreign_list);
+ for (dict_foreign_set::iterator it= table->foreign_set.begin();
+ it != table->foreign_set.end();
+ ++ it)
+ {
+ foreign= *it;
- while (foreign) {
- if (foreign->foreign_index == index) {
-
- is_referenced = TRUE;
- goto func_exit;
- }
-
- foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
- }
+ if (foreign->foreign_index == index)
+ {
+ is_referenced= TRUE;
+ goto func_exit;
+ }
+ }
func_exit:
if (froze_data_dict) {
@@ -249,7 +242,7 @@ row_upd_check_references_constraints(
dberr_t err;
ibool got_s_lock = FALSE;
- if (UT_LIST_GET_FIRST(table->referenced_list) == NULL) {
+ if (table->referenced_set.empty()) {
return(DB_SUCCESS);
}
@@ -276,9 +269,13 @@ row_upd_check_references_constraints(
}
run_again:
- foreign = UT_LIST_GET_FIRST(table->referenced_list);
- while (foreign) {
+ for (dict_foreign_set::iterator it = table->referenced_set.begin();
+ it != table->referenced_set.end();
+ ++it) {
+
+ foreign = *it;
+
/* Note that we may have an update which updates the index
record, but does NOT update the first fields which are
referenced in a foreign key constraint. Then the update does
@@ -331,8 +328,6 @@ run_again:
goto func_exit;
}
}
-
- foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
}
err = DB_SUCCESS;
@@ -369,8 +364,7 @@ wsrep_row_upd_check_foreign_constraints(
ibool got_s_lock = FALSE;
ibool opened = FALSE;
- if (UT_LIST_GET_FIRST(table->foreign_list) == NULL) {
-
+ if (table->foreign_set.empty()) {
return(DB_SUCCESS);
}
@@ -396,9 +390,12 @@ wsrep_row_upd_check_foreign_constraints(
row_mysql_freeze_data_dictionary(trx);
}
- foreign = UT_LIST_GET_FIRST(table->foreign_list);
+ for (dict_foreign_set::iterator it= table->foreign_set.begin();
+ it != table->foreign_set.end();
+ ++ it)
+ {
+ foreign= *it;
- while (foreign) {
/* Note that we may have an update which updates the index
record, but does NOT update the first fields which are
referenced in a foreign key constraint. Then the update does
@@ -448,8 +445,6 @@ wsrep_row_upd_check_foreign_constraints(
goto func_exit;
}
}
-
- foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
}
err = DB_SUCCESS;