Fix a race between TRUNCATE and FOREIGN KEY check

This is a port of an Oracle fix.

No test case was provided by Oracle. It seems that to exploit this
bug, one would have to SET foreign_key_checks=0 before TRUNCATE,
and to concurrently run some DML statement that causes a foreign key
constraint to be checked.

commit 1f24c5aa2843fa548aa5c4b29c00f955e03e9f5b
Author: Aditya A <aditya.a@oracle.com>
Date:   Fri May 18 12:32:37 2018 +0530

    Bug #27208858 CONCURRENT DDL/DML ON FOREIGN KEYS CRASH IN
    PAGE_CUR_SEARCH_WITH_MATCH_BYTES
This commit is contained in:
Marko Mäkelä 2018-08-02 16:12:51 +03:00
parent de469a2f29
commit 62ee2cd461

View file

@ -1629,7 +1629,8 @@ row_ins_check_foreign_constraint(
if (check_table == NULL
|| !check_table->is_readable()
|| check_index == NULL) {
|| check_index == NULL
|| fil_space_get(check_table->space)->is_being_truncated) {
if (!srv_read_only_mode && check_ref) {
FILE* ef = dict_foreign_err_file;