Browse Source

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).
pull/871/head
Marko Mäkelä 7 years ago
parent
commit
fc34e4c067
  1. 8
      storage/innobase/handler/ha_innodb.cc
  2. 2
      storage/innobase/handler/ha_innodb.h

8
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);

2
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();

Loading…
Cancel
Save