Skip to content

Commit dc9f919

Browse files
author
Jan Lindström
committed
MDEV-11005: Incorrect error message when using ONLINE alter table with GIS
Corrected error message when ONLINE alter table with GIS indexes is used on InnoDB.
1 parent 3d0d290 commit dc9f919

File tree

4 files changed

+242
-10
lines changed

4 files changed

+242
-10
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
create table t1(a int not null primary key, b geometry not null) engine=innodb;
2+
ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b);
3+
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
4+
show warnings;
5+
Level Code Message
6+
Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
7+
show errors;
8+
Level Code Message
9+
Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
10+
ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b), LOCK=SHARED;
11+
show warnings;
12+
Level Code Message
13+
show errors;
14+
Level Code Message
15+
drop table t1;
16+
create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb;
17+
show create table t1;
18+
Table Create Table
19+
t1 CREATE TABLE `t1` (
20+
`a` int(11) NOT NULL,
21+
`b` geometry NOT NULL,
22+
`d` int(11) DEFAULT NULL,
23+
SPATIAL KEY `c` (`b`),
24+
KEY `d` (`d`)
25+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
26+
ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d;
27+
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
28+
show warnings;
29+
Level Code Message
30+
Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
31+
show errors;
32+
Level Code Message
33+
Error 1846 LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
34+
ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED;
35+
show warnings;
36+
Level Code Message
37+
show errors;
38+
Level Code Message
39+
drop table t1;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--source include/have_innodb.inc
2+
3+
create table t1(a int not null primary key, b geometry not null) engine=innodb;
4+
--error 1846
5+
ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b);
6+
show warnings;
7+
show errors;
8+
ALTER ONLINE TABLE t1 ADD SPATIAL INDEX new(b), LOCK=SHARED;
9+
show warnings;
10+
show errors;
11+
drop table t1;
12+
create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb;
13+
show create table t1;
14+
--error 1846
15+
ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d;
16+
show warnings;
17+
show errors;
18+
ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED;
19+
show warnings;
20+
show errors;
21+
drop table t1;

sql/share/errmsg-utf8.txt

Lines changed: 180 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7151,12 +7151,187 @@ skip-to-error-number 2000
71517151
# MySQL 5.7 error numbers starts here
71527152
skip-to-error-number 3000
71537153

7154-
ER_MYSQL_57_TEST
7155-
eng "5.7 test"
7156-
ER_WRONG_TABLESPACE_NAME 42000
7157-
eng "Incorrect tablespace name %`-.192s"
7154+
ER_ERROR_ON_MASTER
7155+
eng "Query partially completed on the master (error on master: %d) and was aborted. There is a chance that your master is inconsistent at this point. If you are sure that your master is ok, run this query manually on the slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;. Query:'%s'"
7156+
7157+
ER_INCONSISTENT_ERROR
7158+
eng "Query caused different errors on master and slave. Error on master: message (format)='%s' error code=%d; Error on slave:actual message='%s', error code=%d. Default database:'%s'. Query:'%s'"
7159+
7160+
ER_STORAGE_ENGINE_NOT_LOADED
7161+
eng "Storage engine for table '%s'.'%s' is not loaded."
7162+
7163+
ER_GET_STACKED_DA_WITHOUT_ACTIVE_HANDLER 0Z002
7164+
eng "GET STACKED DIAGNOSTICS when handler not active"
7165+
7166+
ER_WARN_LEGACY_SYNTAX_CONVERTED
7167+
eng "%s is no longer supported. The statement was converted to %s."
7168+
7169+
ER_BINLOG_UNSAFE_FULLTEXT_PLUGIN
7170+
eng "Statement is unsafe because it uses a fulltext parser plugin which may not return the same value on the slave."
7171+
71587172
ER_CANNOT_DISCARD_TEMPORARY_TABLE
7159-
eng "Cannot DISCARD/IMPORT tablespace associated with temporary table"
7173+
eng "Cannot DISCARD/IMPORT tablespace associated with temporary table"
7174+
7175+
ER_FK_DEPTH_EXCEEDED
7176+
eng "Foreign key cascade delete/update exceeds max depth of %d."
7177+
7178+
ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2
7179+
eng "Column count of %s.%s is wrong. Expected %d, found %d. Created with MySQL %d, now running %d. Please use mysql_upgrade to fix this error."
7180+
ger "Spaltenanzahl von %s.%s falsch. %d erwartet, aber %d erhalten. Erzeugt mit MySQL %d, jetzt unter %d. Bitte benutzen Sie mysql_upgrade, um den Fehler zu beheben"
7181+
7182+
ER_WARN_TRIGGER_DOESNT_HAVE_CREATED
7183+
eng "Trigger %s.%s.%s does not have CREATED attribute."
7184+
7185+
ER_REFERENCED_TRG_DOES_NOT_EXIST_MYSQL
7186+
eng "Referenced trigger '%s' for the given action time and event type does not exist."
7187+
7188+
ER_EXPLAIN_NOT_SUPPORTED
7189+
eng "EXPLAIN FOR CONNECTION command is supported only for SELECT/UPDATE/INSERT/DELETE/REPLACE"
7190+
ER_INVALID_FIELD_SIZE
7191+
eng "Invalid size for column '%-.192s'."
7192+
7193+
ER_MISSING_HA_CREATE_OPTION
7194+
eng "Table storage engine '%-.64s' found required create option missing"
7195+
7196+
ER_ENGINE_OUT_OF_MEMORY
7197+
eng "Out of memory in storage engine '%-.64s'."
7198+
7199+
ER_PASSWORD_EXPIRE_ANONYMOUS_USER
7200+
eng "The password for anonymous user cannot be expired."
7201+
7202+
ER_SLAVE_SQL_THREAD_MUST_STOP
7203+
eng "This operation cannot be performed with a running slave sql thread; run STOP SLAVE SQL_THREAD first"
7204+
7205+
ER_NO_FT_MATERIALIZED_SUBQUERY
7206+
eng "Cannot create FULLTEXT index on materialized subquery"
7207+
7208+
ER_INNODB_UNDO_LOG_FULL
7209+
eng "Undo Log error: %s"
7210+
7211+
ER_INVALID_ARGUMENT_FOR_LOGARITHM 2201E
7212+
eng "Invalid argument for logarithm"
7213+
7214+
ER_SLAVE_CHANNEL_IO_THREAD_MUST_STOP
7215+
eng "This operation cannot be performed with a running slave io thread; run STOP SLAVE IO_THREAD FOR CHANNEL '%s' first."
7216+
7217+
ER_WARN_OPEN_TEMP_TABLES_MUST_BE_ZERO
7218+
eng "This operation may not be safe when the slave has temporary tables. The tables will be kept open until the server restarts or until the tables are deleted by any replicated DROP statement. Suggest to wait until slave_open_temp_tables = 0."
7219+
7220+
ER_WARN_ONLY_MASTER_LOG_FILE_NO_POS
7221+
eng "CHANGE MASTER TO with a MASTER_LOG_FILE clause but no MASTER_LOG_POS clause may not be safe. The old position value may not be valid for the new binary log file."
7222+
7223+
ER_QUERY_TIMEOUT
7224+
eng "Query execution was interrupted, maximum statement execution time exceeded"
7225+
7226+
ER_NON_RO_SELECT_DISABLE_TIMER
7227+
eng "Select is not a read only statement, disabling timer"
7228+
7229+
ER_DUP_LIST_ENTRY
7230+
eng "Duplicate entry '%-.192s'."
7231+
7232+
ER_SQL_MODE_NO_EFFECT
7233+
eng "'%s' mode no longer has any effect. Use STRICT_ALL_TABLES or STRICT_TRANS_TABLES instead."
7234+
7235+
ER_AGGREGATE_ORDER_FOR_UNION
7236+
eng "Expression #%u of ORDER BY contains aggregate function and applies to a UNION"
7237+
7238+
ER_AGGREGATE_ORDER_NON_AGG_QUERY
7239+
eng "Expression #%u of ORDER BY contains aggregate function and applies to the result of a non-aggregated query"
7240+
7241+
ER_SLAVE_WORKER_STOPPED_PREVIOUS_THD_ERROR
7242+
eng "Slave worker has stopped after at least one previous worker encountered an error when slave-preserve-commit-order was enabled. To preserve commit order, the last transaction executed by this thread has not been committed. When restarting the slave after fixing any failed threads, you should fix this worker as well."
7243+
7244+
ER_DONT_SUPPORT_SLAVE_PRESERVE_COMMIT_ORDER
7245+
eng "slave_preserve_commit_order is not supported %s."
7246+
7247+
ER_SERVER_OFFLINE_MODE
7248+
eng "The server is currently in offline mode"
7249+
7250+
ER_GIS_DIFFERENT_SRIDS
7251+
eng "Binary geometry function %s given two geometries of different srids: %u and %u, which should have been identical."
7252+
7253+
ER_GIS_UNSUPPORTED_ARGUMENT
7254+
eng "Calling geometry function %s with unsupported types of arguments."
7255+
7256+
ER_GIS_UNKNOWN_ERROR
7257+
eng "Unknown GIS error occured in function %s."
7258+
7259+
ER_GIS_UNKNOWN_EXCEPTION
7260+
eng "Unknown exception caught in GIS function %s."
7261+
7262+
ER_GIS_INVALID_DATA 22023
7263+
eng "Invalid GIS data provided to function %s."
7264+
7265+
ER_BOOST_GEOMETRY_EMPTY_INPUT_EXCEPTION
7266+
eng "The geometry has no data in function %s."
7267+
7268+
ER_BOOST_GEOMETRY_CENTROID_EXCEPTION
7269+
eng "Unable to calculate centroid because geometry is empty in function %s."
7270+
7271+
ER_BOOST_GEOMETRY_OVERLAY_INVALID_INPUT_EXCEPTION
7272+
eng "Geometry overlay calculation error: geometry data is invalid in function %s."
7273+
7274+
ER_BOOST_GEOMETRY_TURN_INFO_EXCEPTION
7275+
eng "Geometry turn info calculation error: geometry data is invalid in function %s."
7276+
7277+
ER_BOOST_GEOMETRY_SELF_INTERSECTION_POINT_EXCEPTION
7278+
eng "Analysis procedures of intersection points interrupted unexpectedly in function %s."
7279+
7280+
ER_BOOST_GEOMETRY_UNKNOWN_EXCEPTION
7281+
eng "Unknown exception thrown in function %s."
7282+
7283+
ER_STD_BAD_ALLOC_ERROR
7284+
eng "Memory allocation error: %-.256s in function %s."
7285+
7286+
ER_STD_DOMAIN_ERROR
7287+
eng "Domain error: %-.256s in function %s."
7288+
7289+
ER_STD_LENGTH_ERROR
7290+
eng "Length error: %-.256s in function %s."
7291+
7292+
ER_STD_INVALID_ARGUMENT
7293+
eng "Invalid argument error: %-.256s in function %s."
7294+
7295+
ER_STD_OUT_OF_RANGE_ERROR
7296+
eng "Out of range error: %-.256s in function %s."
7297+
7298+
ER_STD_OVERFLOW_ERROR
7299+
eng "Overflow error error: %-.256s in function %s."
7300+
7301+
ER_STD_RANGE_ERROR
7302+
eng "Range error: %-.256s in function %s."
7303+
7304+
ER_STD_UNDERFLOW_ERROR
7305+
eng "Underflow error: %-.256s in function %s."
7306+
7307+
ER_STD_LOGIC_ERROR
7308+
eng "Logic error: %-.256s in function %s."
7309+
7310+
ER_STD_RUNTIME_ERROR
7311+
eng "Runtime error: %-.256s in function %s."
7312+
7313+
ER_STD_UNKNOWN_EXCEPTION
7314+
eng "Unknown exception: %-.384s in function %s."
7315+
7316+
ER_GIS_DATA_WRONG_ENDIANESS
7317+
eng "Geometry byte string must be little endian."
7318+
7319+
ER_CHANGE_MASTER_PASSWORD_LENGTH
7320+
eng "The password provided for the replication user exceeds the maximum length of 32 characters"
7321+
7322+
ER_USER_LOCK_WRONG_NAME 42000
7323+
eng "Incorrect user-level lock name '%-.192s'."
7324+
7325+
# Should be different from ER_LOCK_DEADLOCK since it doesn't cause implicit
7326+
# rollback. Should not be mapped to SQLSTATE 40001 for the same reason.
7327+
ER_USER_LOCK_DEADLOCK
7328+
eng "Deadlock found when trying to get user-level lock; try rolling back transaction/releasing locks and restarting lock acquisition."
7329+
7330+
ER_REPLACE_INACCESSIBLE_ROWS
7331+
eng "REPLACE cannot be executed as it requires deleting rows that are not in the view"
7332+
7333+
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS
7334+
eng "Do not support online operation on table with GIS index"
71607335

71617336
# MariaDB extra error numbers starts from 4000
71627337
skip-to-error-number 4000

storage/innobase/handler/handler0alter.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ ha_innobase::check_if_supported_inplace_alter(
975975
ha_alter_info->index_add_buffer[i]];
976976
if (key->flags & HA_SPATIAL) {
977977
ha_alter_info->unsupported_reason = innobase_get_err_msg(
978-
ER_INNODB_FT_LIMIT);
978+
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
979979

980980
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
981981
}
@@ -1049,13 +1049,10 @@ ha_innobase::check_if_supported_inplace_alter(
10491049
}
10501050

10511051
if (innobase_spatial_exist(altered_table)) {
1052-
#ifdef MYSQL_SPATIAL_INDEX
10531052
ha_alter_info->unsupported_reason =
10541053
innobase_get_err_msg(
10551054
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
1056-
#endif
1057-
ha_alter_info->unsupported_reason = innobase_get_err_msg(
1058-
ER_INNODB_FT_LIMIT);
1055+
10591056
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
10601057
} else {
10611058
ha_alter_info->unsupported_reason =

0 commit comments

Comments
 (0)