From fcd84da5f112b84bec05db5ea59660e59cd2204b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 12 Apr 2020 18:09:09 +0200 Subject: MDEV-22218 InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON upon LOAD DATA with NO_BACKSLASH_ESCAPES in SQL_MODE and unique blob in table `inited == NONE` at the initialization time does not always mean that it'll be `NONE` later, at the execution time. Use a more complex caller-specific logic to decide whether to create a cloned lookup handler. Besides LOAD (as in the original bug report) make sure that all prepare_for_insert() invocations are covered by tests. Add tests for CREATE ... SELECT, multi-UPDATE, and multi-DELETE. Don't enable write cache with long uniques. --- sql/sql_load.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sql/sql_load.cc') diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 3d1f0bf0958..3ce37170b48 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -651,12 +651,14 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list, thd->abort_on_warning= !ignore && thd->is_strict_mode(); + bool create_lookup_handler= handle_duplicates != DUP_ERROR; if ((table_list->table->file->ha_table_flags() & HA_DUPLICATE_POS)) { + create_lookup_handler= true; if ((error= table_list->table->file->ha_rnd_init_with_error(0))) goto err; } - table->file->prepare_for_insert(); + table->file->prepare_for_insert(create_lookup_handler); thd_progress_init(thd, 2); if (table_list->table->validate_default_values_of_unset_fields(thd)) { -- cgit v1.2.1