summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-03-18 17:05:31 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-03-18 17:05:31 +0200
commit4903031baa196dfc9a75638d141b515883cd254c (patch)
tree7cd0b364922e4a664dd019d3e838d9657460a3e8
parente0c3b5f9a5f46fa1a29a83393a50acc74d545981 (diff)
downloadmariadb-git-4903031baa196dfc9a75638d141b515883cd254c.tar.gz
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.
-rw-r--r--mysql-test/suite/innodb/r/default_row_format_compatibility.result2
-rw-r--r--storage/innobase/handler/ha_innodb.cc5
-rw-r--r--storage/innobase/handler/ha_innodb.h2
-rw-r--r--storage/innobase/handler/handler0alter.cc6
4 files changed, 10 insertions, 5 deletions
diff --git a/mysql-test/suite/innodb/r/default_row_format_compatibility.result b/mysql-test/suite/innodb/r/default_row_format_compatibility.result
index 2889e86f82e..a862881e005 100644
--- a/mysql-test/suite/innodb/r/default_row_format_compatibility.result
+++ b/mysql-test/suite/innodb/r/default_row_format_compatibility.result
@@ -96,8 +96,6 @@ SELECT * FROM tab;
a b
1 Check with max column size
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;
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
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 4727141ec7d..4701929b42d 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7251,7 +7251,7 @@ ha_innobase::innobase_set_max_autoinc(
}
/** @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));
@@ -7261,6 +7261,9 @@ bool ha_innobase::is_read_only() const
return true;
}
+ if (altering_to_supported)
+ return false;
+
if (!DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) ||
!innodb_read_only_compressed)
return false;
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 3d761691f3a..15d230b9ced 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -458,7 +458,7 @@ protected:
void reset_template();
/** @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);
void update_thd();
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index bbdb6a429c7..58e17cd3ead 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1988,7 +1988,11 @@ ha_innobase::check_if_supported_inplace_alter(
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 =
my_get_err_msg(ER_READ_ONLY_MODE);