Commit fc34e4c0 authored by Marko Mäkelä's avatar Marko Mäkelä

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).
parent 75f8e86f
...@@ -12478,9 +12478,7 @@ create_table_info_t::gcols_in_fulltext_or_spatial() ...@@ -12478,9 +12478,7 @@ create_table_info_t::gcols_in_fulltext_or_spatial()
/** Prepare to create a new table to an InnoDB database. /** Prepare to create a new table to an InnoDB database.
@param[in] name Table name @param[in] name Table name
@return error number */ @return error number */
int int create_table_info_t::prepare_create_table(const char* name, bool strict)
create_table_info_t::prepare_create_table(
const char* name)
{ {
DBUG_ENTER("prepare_create_table"); DBUG_ENTER("prepare_create_table");
...@@ -12503,7 +12501,7 @@ create_table_info_t::prepare_create_table( ...@@ -12503,7 +12501,7 @@ create_table_info_t::prepare_create_table(
because InnoDB might actually support the option, but not under because InnoDB might actually support the option, but not under
the current conditions. The messages revealing the specific the current conditions. The messages revealing the specific
problems are reported inside this function. */ problems are reported inside this function. */
if (create_options_are_invalid()) { if (strict && create_options_are_invalid()) {
DBUG_RETURN(HA_WRONG_CREATE_OPTION); DBUG_RETURN(HA_WRONG_CREATE_OPTION);
} }
...@@ -12851,7 +12849,7 @@ ha_innobase::create( ...@@ -12851,7 +12849,7 @@ ha_innobase::create(
file_per_table, trx); file_per_table, trx);
if ((error = info.initialize()) if ((error = info.initialize())
|| (error = info.prepare_create_table(name))) { || (error = info.prepare_create_table(name, !trx))) {
if (trx) { if (trx) {
trx_rollback_for_mysql(trx); trx_rollback_for_mysql(trx);
row_mysql_unlock_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
......
...@@ -702,7 +702,7 @@ class create_table_info_t ...@@ -702,7 +702,7 @@ class create_table_info_t
bool create_option_tablespace_is_valid(); bool create_option_tablespace_is_valid();
/** Prepare to create a table. */ /** 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(); void allocate_trx();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment