diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-10 16:10:26 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-10 16:10:26 +0300 |
commit | fc34e4c067ff6c043ff15a2b7ddd4bb0e2c1ca13 (patch) | |
tree | 0f1ab7d1c7c005d0e7df91da86c996fe6d6b479a | |
parent | 75f8e86f57f66b68e4a3b36188e24ba294764e25 (diff) | |
download | mariadb-git-fc34e4c067ff6c043ff15a2b7ddd4bb0e2c1ca13.tar.gz |
MDEV-17161 TRUNCATE TABLE fails after upgrade from 10.1
With the TRUNCATE by rename, create, drop (MDEV-13564),
old tables with invalid ROW_FORMAT attribute could not be
truncated. Introduce a sloppy mode for allowing the TRUNCATE.
create_table_info_t::prepare_create_table(): Add the parameter
strict=true.
ha_innobase::create(): Pass strict=false if trx!=NULL
(the create is part of TRUNCATE).
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 8 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.h | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 725bbf86ca1..501bc04a275 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12478,9 +12478,7 @@ create_table_info_t::gcols_in_fulltext_or_spatial() /** Prepare to create a new table to an InnoDB database. @param[in] name Table name @return error number */ -int -create_table_info_t::prepare_create_table( - const char* name) +int create_table_info_t::prepare_create_table(const char* name, bool strict) { DBUG_ENTER("prepare_create_table"); @@ -12503,7 +12501,7 @@ create_table_info_t::prepare_create_table( because InnoDB might actually support the option, but not under the current conditions. The messages revealing the specific problems are reported inside this function. */ - if (create_options_are_invalid()) { + if (strict && create_options_are_invalid()) { DBUG_RETURN(HA_WRONG_CREATE_OPTION); } @@ -12851,7 +12849,7 @@ ha_innobase::create( file_per_table, trx); if ((error = info.initialize()) - || (error = info.prepare_create_table(name))) { + || (error = info.prepare_create_table(name, !trx))) { if (trx) { trx_rollback_for_mysql(trx); row_mysql_unlock_data_dictionary(trx); diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 427f05a9a5c..76db028a823 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -702,7 +702,7 @@ public: bool create_option_tablespace_is_valid(); /** Prepare to create a table. */ - int prepare_create_table(const char* name); + int prepare_create_table(const char* name, bool strict = true); void allocate_trx(); |