Commit ca8fcc00 authored by unknown's avatar unknown

Take a shared record lock (LOCK_REC_NOT_GAP) for a matching record in the foreign

key check because we can allow inserts into gaps (Support Issue #4317).


innobase/row/row0ins.c:
  Take a shared record lock (LOCK_REC_NOT_GAP) for a matching record in the foreign
  key check because we can allow inserts into gaps.
parent d5a3f4a6
...@@ -1105,7 +1105,6 @@ row_ins_check_foreign_constraint( ...@@ -1105,7 +1105,6 @@ row_ins_check_foreign_constraint(
dict_table_t* check_table; dict_table_t* check_table;
dict_index_t* check_index; dict_index_t* check_index;
ulint n_fields_cmp; ulint n_fields_cmp;
ibool unique_search;
rec_t* rec; rec_t* rec;
btr_pcur_t pcur; btr_pcur_t pcur;
ibool moved; ibool moved;
...@@ -1223,14 +1222,6 @@ row_ins_check_foreign_constraint( ...@@ -1223,14 +1222,6 @@ row_ins_check_foreign_constraint(
dtuple_set_n_fields_cmp(entry, foreign->n_fields); dtuple_set_n_fields_cmp(entry, foreign->n_fields);
if (dict_index_get_n_unique(check_index) <= foreign->n_fields) {
/* We can just set a LOCK_REC_NOT_GAP type lock */
unique_search = TRUE;
} else {
unique_search = FALSE;
}
btr_pcur_open(check_index, entry, PAGE_CUR_GE, btr_pcur_open(check_index, entry, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr); BTR_SEARCH_LEAF, &pcur, &mtr);
...@@ -1268,17 +1259,13 @@ row_ins_check_foreign_constraint( ...@@ -1268,17 +1259,13 @@ row_ins_check_foreign_constraint(
break; break;
} }
} else { } else {
/* Found a matching record */ /* Found a matching record. Lock only
a record because we can allow inserts
into gaps */
if (unique_search) { err = row_ins_set_shared_rec_lock(
err = row_ins_set_shared_rec_lock( LOCK_REC_NOT_GAP,
LOCK_REC_NOT_GAP, rec, check_index, thr);
rec, check_index, thr);
} else {
err = row_ins_set_shared_rec_lock(
LOCK_ORDINARY,
rec, check_index, thr);
}
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
......
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