summaryrefslogtreecommitdiff
path: root/innobase/row/row0ins.c
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2004-12-27 17:19:27 +0200
committerunknown <heikki@hundin.mysql.fi>2004-12-27 17:19:27 +0200
commit5f6d8e65262227a8e6431a57fe832fd335c6b2e4 (patch)
tree6280cd0f7c0198262f4b03a419500cfb451e9012 /innobase/row/row0ins.c
parent47efc5f335d117cd0fbe3d1e633936ae70442933 (diff)
parenta7b984d2336135100c09998d653f331d3b9df996 (diff)
downloadmariadb-git-5f6d8e65262227a8e6431a57fe832fd335c6b2e4.tar.gz
Merge hundin.mysql.fi:/home/heikki/mysql-4.0
into hundin.mysql.fi:/home/heikki/mysql-4.1 innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged
Diffstat (limited to 'innobase/row/row0ins.c')
-rw-r--r--innobase/row/row0ins.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index c82231ef5f6..f8a98f74c09 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -1415,8 +1415,34 @@ row_ins_check_foreign_constraints(
row_mysql_freeze_data_dictionary(trx);
}
+ if (foreign->referenced_table) {
+ mutex_enter(&(dict_sys->mutex));
+
+ (foreign->referenced_table
+ ->n_foreign_key_checks_running)++;
+
+ mutex_exit(&(dict_sys->mutex));
+ }
+
+ /* NOTE that if the thread ends up waiting for a lock
+ we will release dict_operation_lock temporarily!
+ But the counter on the table protects the referenced
+ table from being dropped while the check is running. */
+
err = row_ins_check_foreign_constraint(TRUE, foreign,
table, entry, thr);
+
+ if (foreign->referenced_table) {
+ mutex_enter(&(dict_sys->mutex));
+
+ ut_a(foreign->referenced_table
+ ->n_foreign_key_checks_running > 0);
+ (foreign->referenced_table
+ ->n_foreign_key_checks_running)--;
+
+ mutex_exit(&(dict_sys->mutex));
+ }
+
if (got_s_lock) {
row_mysql_unfreeze_data_dictionary(trx);
}