Commit 4903031b authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-23497 fixup: Do not warn for ALTER TABLE conversion

Our intention is to make users aware that the ROW_FORMAT=COMPRESSED
format is on its way to deprecation.  It is an unnecessary annoyance
to users if we issue a warning when the user is converting a
ROW_FORMAT=COMPRESSED table to a supported format
(such as ROW_FORMAT=DYNAMIC).

ha_innobase::is_read_only(): Add a parameter to specify that an
ALTER TABLE to a supported format has been requested.

ha_innobase::check_if_supported_inplace_alter(): Set the parameter
when ALTER_OPTIONS to something else than ROW_FORMAT=COMPRESSED
(and without KEY_BLOCK_SIZE) is being requested.

Thanks to Elena Stepanova for suggesting this.
parent e0c3b5f9
...@@ -96,8 +96,6 @@ SELECT * FROM tab; ...@@ -96,8 +96,6 @@ SELECT * FROM tab;
a b a b
1 Check with max column size 1 Check with max column size
ALTER TABLE tab ROW_FORMAT=Dynamic; ALTER TABLE tab ROW_FORMAT=Dynamic;
Warnings:
Warning 4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
SHOW TABLE STATUS LIKE 'tab'; SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
......
...@@ -7251,7 +7251,7 @@ ha_innobase::innobase_set_max_autoinc( ...@@ -7251,7 +7251,7 @@ ha_innobase::innobase_set_max_autoinc(
} }
/** @return whether the table is read-only */ /** @return whether the table is read-only */
bool ha_innobase::is_read_only() const bool ha_innobase::is_read_only(bool altering_to_supported) const
{ {
ut_ad(m_prebuilt->trx == thd_to_trx(m_user_thd)); ut_ad(m_prebuilt->trx == thd_to_trx(m_user_thd));
...@@ -7261,6 +7261,9 @@ bool ha_innobase::is_read_only() const ...@@ -7261,6 +7261,9 @@ bool ha_innobase::is_read_only() const
return true; return true;
} }
if (altering_to_supported)
return false;
if (!DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) || if (!DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) ||
!innodb_read_only_compressed) !innodb_read_only_compressed)
return false; return false;
......
...@@ -458,7 +458,7 @@ class ha_innobase final : public handler ...@@ -458,7 +458,7 @@ class ha_innobase final : public handler
void reset_template(); void reset_template();
/** @return whether the table is read-only */ /** @return whether the table is read-only */
bool is_read_only() const; bool is_read_only(bool altering_to_supported= false) const;
inline void update_thd(THD* thd); inline void update_thd(THD* thd);
void update_thd(); void update_thd();
......
...@@ -1988,7 +1988,11 @@ ha_innobase::check_if_supported_inplace_alter( ...@@ -1988,7 +1988,11 @@ ha_innobase::check_if_supported_inplace_alter(
update_thd(); update_thd();
if (is_read_only()) { if (is_read_only(!high_level_read_only
&& (ha_alter_info->handler_flags & ALTER_OPTIONS)
&& ha_alter_info->create_info->key_block_size == 0
&& ha_alter_info->create_info->row_type
!= ROW_TYPE_COMPRESSED)) {
ha_alter_info->unsupported_reason = ha_alter_info->unsupported_reason =
my_get_err_msg(ER_READ_ONLY_MODE); my_get_err_msg(ER_READ_ONLY_MODE);
......
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