[Commits] 1579140: MDEV-11005: Incorrect error message when using ONLINE alter table with GIS

Jan Lindström jan.lindstrom at mariadb.com
Mon Oct 10 12:35:38 EEST 2016


revision-id: 157914055446d43f50d4ba08512cdffcf2e72aba (mariadb-10.2.2-38-g1579140)
parent(s): a6f032af5778018051d41fc8ba7e9c983b4b7fbf
author: Jan Lindström
committer: Jan Lindström
timestamp: 2016-10-10 12:34:06 +0300
message:

MDEV-11005: Incorrect error message when using ONLINE alter table with GIS

Fix incorrect error message on ONLINE alter table with GIS indexes and
add rtree page type to page type check.

---
 .../suite/innodb/r/innodb-online-alter-gis.result  | 23 ++++++++++++++++++++++
 .../suite/innodb/t/innodb-online-alter-gis.test    | 13 ++++++++++++
 sql/share/errmsg-utf8.txt                          |  3 +++
 storage/innobase/handler/handler0alter.cc          |  7 ++-----
 storage/innobase/include/fil0fil.ic                |  4 ++++
 5 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
new file mode 100644
index 0000000..83c21c4
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
@@ -0,0 +1,23 @@
+create table t1(a int not null primary key, b geometry not null) engine=innodb;
+ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b);
+ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
+show warnings;
+Level	Code	Message
+Error	1846	LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
+drop table t1;
+create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  `b` geometry NOT NULL,
+  `d` int(11) DEFAULT NULL,
+  SPATIAL KEY `c` (`b`),
+  KEY `d` (`d`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d;
+ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
+show warnings;
+Level	Code	Message
+Error	1846	LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
+drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb-online-alter-gis.test b/mysql-test/suite/innodb/t/innodb-online-alter-gis.test
new file mode 100644
index 0000000..90f25e4
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb-online-alter-gis.test
@@ -0,0 +1,13 @@
+--source include/have_innodb.inc
+
+create table t1(a int not null primary key, b geometry not null) engine=innodb;
+--error 1846
+ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b);
+show warnings;
+drop table t1;
+create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb;
+show create table t1;
+--error 1846
+ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d;
+show warnings;
+drop table t1;
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index d42611b..2892342 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -6861,6 +6861,9 @@ ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS
 ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS
   eng "Fulltext index creation requires a lock"
 
+ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS
+  eng "Do not support online operation on table with GIS index"
+
 ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE
   eng "sql_slave_skip_counter can not be set when the server is running with GTID_MODE = ON. Instead, for each transaction that you want to skip, generate an empty transaction with the same GTID as the transaction"
 
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index bd076aa..9bbe3a0 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -975,7 +975,7 @@ ha_innobase::check_if_supported_inplace_alter(
                                ha_alter_info->index_add_buffer[i]];
                if (key->flags & HA_SPATIAL) {
                        ha_alter_info->unsupported_reason = innobase_get_err_msg(
-                               ER_INNODB_FT_LIMIT);
+                             ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
 
                        DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
                }
@@ -1049,13 +1049,10 @@ ha_innobase::check_if_supported_inplace_alter(
 		}
 
 		if (innobase_spatial_exist(altered_table)) {
-#ifdef MYSQL_SPATIAL_INDEX
 			ha_alter_info->unsupported_reason =
 				innobase_get_err_msg(
 				ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
-#endif
-			ha_alter_info->unsupported_reason = innobase_get_err_msg(
-				ER_INNODB_FT_LIMIT);
+
 			DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
 		} else {
 			ha_alter_info->unsupported_reason =
diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic
index ae35033..8f8a419 100644
--- a/storage/innobase/include/fil0fil.ic
+++ b/storage/innobase/include/fil0fil.ic
@@ -63,6 +63,8 @@ fil_get_page_type_name(
 		return (const char*)"PAGE_COMPRESSED";
 	case FIL_PAGE_INDEX:
 		return (const char*)"INDEX";
+	case FIL_PAGE_RTREE:
+		return (const char*)"RTREE";
 	case FIL_PAGE_UNDO_LOG:
 		return (const char*)"UNDO LOG";
 	case FIL_PAGE_INODE:
@@ -130,6 +132,7 @@ fil_page_type_validate(
 	if (!((page_type == FIL_PAGE_PAGE_COMPRESSED ||
 		page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
 		page_type == FIL_PAGE_INDEX ||
+		page_type == FIL_PAGE_RTREE ||
 		page_type == FIL_PAGE_UNDO_LOG ||
 		page_type == FIL_PAGE_INODE ||
 		page_type == FIL_PAGE_IBUF_FREE_LIST ||
@@ -169,6 +172,7 @@ fil_page_type_validate(
 		ut_ad(page_type == FIL_PAGE_PAGE_COMPRESSED ||
 			page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
 			page_type == FIL_PAGE_INDEX ||
+			page_type == FIL_PAGE_RTREE ||
 			page_type == FIL_PAGE_UNDO_LOG ||
 			page_type == FIL_PAGE_INODE ||
 			page_type == FIL_PAGE_IBUF_FREE_LIST ||


More information about the commits mailing list