Skip to content

Commit a54df1d

Browse files
FooBarriormidenok
authored andcommitted
MDEV-15990 innodb: change DB_FOREIGN_DUPLICATE_KEY to DB_DUPLICATE_KEY
during row insert DB_FOREIGN_DUPLICATE_KEY in row_ins_duplicate_error_in_clust was motivated by handling the cascade changes during versioned operations. It was found though, that certain row_update_for_mysql calls could return DB_FOREIGN_DUPLICATE_KEY, even if there's no foreign relations. Change DB_FOREIGN_DUPLICATE_KEY to DB_DUPLICATE_KEY in row_ins_duplicate_error_in_clust. It will be later converted to DB_FOREIGN_DUPLICATE_KEY in row_ins_check_foreign_constraint if needed. Additionally, ha_delete_row should return neither. Ensure it by an assertion.
1 parent 2847235 commit a54df1d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8719,6 +8719,9 @@ ha_innobase::delete_row(
87198719
ut_ad(!trx->is_bulk_insert());
87208720
error = row_update_for_mysql(m_prebuilt);
87218721

8722+
ut_ad(error != DB_DUPLICATE_KEY);
8723+
ut_ad(error != DB_FOREIGN_DUPLICATE_KEY);
8724+
87228725
#ifdef WITH_WSREP
87238726
if (error == DB_SUCCESS && trx->is_wsrep()
87248727
&& wsrep_thd_is_local(m_user_thd)

storage/innobase/row/row0ins.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,7 @@ row_ins_duplicate_error_in_clust(
24092409
&trx_id_len);
24102410
ut_ad(trx_id_len == DATA_TRX_ID_LEN);
24112411
if (trx->id == trx_read_trx_id(trx_id)) {
2412-
err = DB_FOREIGN_DUPLICATE_KEY;
2412+
err = DB_DUPLICATE_KEY;
24132413
}
24142414
}
24152415
goto func_exit;

0 commit comments

Comments
 (0)