diff options
author | Michael Widenius <monty@mariadb.org> | 2018-05-11 14:14:33 +0300 |
---|---|---|
committer | Michael Widenius <monty@mariadb.org> | 2018-05-14 10:08:05 +0300 |
commit | 1cb4caa66d5fd2a9bc095d68988324b7b358d70f (patch) | |
tree | a5efe8d599217eb3b7bcdb75173634d3b0c5bf2e /sql/sql_truncate.cc | |
parent | be6ae0bb6baa8a014c244c8699a34f4ee193338e (diff) | |
download | mariadb-git-1cb4caa66d5fd2a9bc095d68988324b7b358d70f.tar.gz |
MDEV-15970 Crash when doing truncate on locked sequence
Problem was that we used table->s->db_type() for accessing
handlerton of opened file instead of table->file->ht
Other bug fixed:
- Ensure that we set error if reopen_tables() fails
(This was the cause of assert)
Diffstat (limited to 'sql/sql_truncate.cc')
-rw-r--r-- | sql/sql_truncate.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 13084b08e87..cf91d6d2189 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -302,7 +302,7 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref, table_ref->table_name.str, FALSE))) DBUG_RETURN(TRUE); - *hton_can_recreate= ha_check_storage_engine_flag(table->s->db_type(), + *hton_can_recreate= ha_check_storage_engine_flag(table->file->ht, HTON_CAN_RECREATE); table_ref->mdl_request.ticket= table->mdl_ticket; } @@ -428,7 +428,10 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref) error= dd_recreate_table(thd, table_ref->db.str, table_ref->table_name.str); if (thd->locked_tables_mode && thd->locked_tables_list.reopen_tables(thd, false)) - thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); + { + thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0); + error=1; + } /* No need to binlog a failed truncate-by-recreate. */ binlog_stmt= !error; |