1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
|
#
# Bug#30248138 - adding a function once mysql.func is converted to myisam
# leads to crash
#
#-----------------------------------------------------------------------
# Test cases to verify system table's behavior with storage engines
# InnoDB and MyISAM.
#
# Table name comparison is "case insensitive" with lower_case_table_name=1.
# Run "system_tables_storage_engine_tests.inc" tests with upper case
# system table names .
#-----------------------------------------------------------------------
CREATE TABLE system_tables (ID INT PRIMARY KEY AUTO_INCREMENT,
table_name VARCHAR(100));
INSERT INTO system_tables(table_name)
SELECT UPPER(concat(table_schema, ".", table_name))
FROM INFORMATION_SCHEMA.tables WHERE table_schema =
'mysql' AND table_name NOT IN('general_log', 'slow_log',
'ndb_binlog_index')
ORDER BY table_name;
#-----------------------------------------------------------------------
# Test case to verify altering system table's engine to MyISAM. Changing
# system table's engine to MyISAM is not allowed.
#-----------------------------------------------------------------------
CREATE PROCEDURE test_system_table_alter_engine()
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE i INT DEFAULT 1;
-- ER_UNSUPPORTED_ENGINE(1726) is reported for all the system engines except for
-- innodb_index_stats and innodb_table_stats. ER_TOO_LONG_KEY(1071) is reported for
-- innodb_index_stats and ER_NOT_ALLOWED_COMMAND(1148) is reported for innodb_table_stats
-- for now.
DECLARE CONTINUE HANDLER FOR 1726, 1071, 1148
BEGIN
GET DIAGNOSTICS CONDITION 1 @message = MESSAGE_TEXT;
SELECT @message AS ERROR;
END;
SELECT count(*) FROM system_tables INTO n;
WHILE i <= n DO
SELECT table_name FROM system_tables WHERE id = i INTO @table_name;
SELECT @table_name;
SET @sql_text = concat("ALTER TABLE ", @table_name, " ENGINE = MyISAM");
PREPARE stmt FROM @sql_text;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET i = i + 1;
END WHILE;
END$
CALL test_system_table_alter_engine();
@table_name
MYSQL.COLUMNS_PRIV
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.columns_priv]
@table_name
MYSQL.COMPONENT
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.component]
@table_name
MYSQL.DB
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.db]
@table_name
MYSQL.DEFAULT_ROLES
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.default_roles]
@table_name
MYSQL.ENGINE_COST
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.engine_cost]
@table_name
MYSQL.FUNC
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.func]
@table_name
MYSQL.GLOBAL_GRANTS
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.global_grants]
@table_name
MYSQL.GTID_EXECUTED
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.gtid_executed]
@table_name
MYSQL.HELP_CATEGORY
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.help_category]
@table_name
MYSQL.HELP_KEYWORD
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.help_keyword]
@table_name
MYSQL.HELP_RELATION
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.help_relation]
@table_name
MYSQL.HELP_TOPIC
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.help_topic]
@table_name
MYSQL.INNODB_INDEX_STATS
ERROR
Specified key was too long; max key length is 1000 bytes
@table_name
MYSQL.INNODB_TABLE_STATS
ERROR
The used command is not allowed with this MySQL version
@table_name
MYSQL.PASSWORD_HISTORY
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.password_history]
@table_name
MYSQL.PLUGIN
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.plugin]
@table_name
MYSQL.PROCS_PRIV
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.procs_priv]
@table_name
MYSQL.PROXIES_PRIV
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.proxies_priv]
@table_name
MYSQL.REPLICATION_ASYNCHRONOUS_CONNECTION_FAILOVER
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.replication_asynchronous_connection_failover]
@table_name
MYSQL.REPLICATION_ASYNCHRONOUS_CONNECTION_FAILOVER_MANAGED
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.replication_asynchronous_connection_failover_managed]
@table_name
MYSQL.REPLICATION_GROUP_CONFIGURATION_VERSION
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.replication_group_configuration_version]
@table_name
MYSQL.REPLICATION_GROUP_MEMBER_ACTIONS
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.replication_group_member_actions]
@table_name
MYSQL.ROLE_EDGES
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.role_edges]
@table_name
MYSQL.SERVER_COST
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.server_cost]
@table_name
MYSQL.SERVERS
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.servers]
@table_name
MYSQL.SLAVE_MASTER_INFO
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.slave_master_info]
@table_name
MYSQL.SLAVE_RELAY_LOG_INFO
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.slave_relay_log_info]
@table_name
MYSQL.SLAVE_WORKER_INFO
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.slave_worker_info]
@table_name
MYSQL.TABLES_PRIV
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.tables_priv]
@table_name
MYSQL.TIME_ZONE
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.time_zone]
@table_name
MYSQL.TIME_ZONE_LEAP_SECOND
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_leap_second]
@table_name
MYSQL.TIME_ZONE_NAME
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_name]
@table_name
MYSQL.TIME_ZONE_TRANSITION
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_transition]
@table_name
MYSQL.TIME_ZONE_TRANSITION_TYPE
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_transition_type]
@table_name
MYSQL.USER
ERROR
Storage engine 'MyISAM' does not support system tables. [mysql.user]
DROP PROCEDURE test_system_table_alter_engine;
#-----------------------------------------------------------------------
# Test case to verify system table creation in MyISAM engine. Creating
# system table in MyISAM is allowed to support logical upgrade.
#-----------------------------------------------------------------------
CREATE PROCEDURE execute_stmt(stmt VARCHAR(255))
BEGIN
SET @error_no = 0;
SET @sql_stmt = stmt;
PREPARE stmt FROM @sql_stmt;
EXECUTE stmt;
GET DIAGNOSTICS CONDITION 1 @error_no = MYSQL_ERRNO, @error_message = MESSAGE_TEXT;
IF @error_no > 0 THEN
SELECT "Warning" AS SEVERITY, @error_no as ERRNO, @error_message as MESSAGE;
END IF;
DEALLOCATE PREPARE stmt;
END$
CREATE PROCEDURE test_create_system_table()
BEGIN
DECLARE n INT DEFAULT 0;
DECLARE i INT DEFAULT 1;
-- Error ER_NO_SYSTEM_TABLE_ACCESS(3554) is reported for innodb_table_stats and
-- innodb_index_stats. For other tables ER_UNSUPPORTED_ENGINE "warning" is reported.
-- Warning is handled in the execute_stmt().
DECLARE CONTINUE HANDLER FOR 3554
BEGIN
GET DIAGNOSTICS CONDITION 1 @error = MYSQL_ERRNO, @error_message = MESSAGE_TEXT;
END;
SELECT count(*) FROM system_tables INTO n;
WHILE i <= n DO
SET @error = 0;
SELECT table_name FROM system_tables WHERE id = i INTO @table_name;
SET @sql_text = concat('RENAME TABLE ', @table_name, ' TO mysql.backup_table');
CALL execute_stmt(@sql_text);
SET @sql_text = concat('CREATE TABLE ', @table_name, ' ENGINE=InnoDB AS SELECT * FROM mysql.backup_table');
CALL execute_stmt(@sql_text);
SET @sql_text = concat('DROP TABLE ', @table_name);
CALL execute_stmt(@sql_text);
SET @sql_text = concat('CREATE TABLE ', @table_name, ' ENGINE=MyISAM AS SELECT * FROM mysql.backup_table');
CALL execute_stmt(@sql_text);
IF @error > 0 THEN
SELECT "ERROR" AS SEVERITY, @error AS ERRNO, @error_message AS MESSAGE;
ELSE
SET @sql_text = concat('DROP TABLE ', @table_name);
CALL execute_stmt(@sql_text);
END IF;
SET @sql_text = concat('RENAME TABLE mysql.backup_table TO ', @table_name);
CALL execute_stmt(@sql_text);
SET i = i + 1;
END WHILE;
END$
CALL test_create_system_table();
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.columns_priv]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.component]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.db]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.default_roles]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.engine_cost]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.func]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.global_grants]
SEVERITY ERRNO MESSAGE
Warning 3129 Please do not modify the gtid_executed table. This is a mysql internal system table to store GTIDs for committed transactions. Modifying it can lead to an inconsistent GTID state.
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.gtid_executed]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.help_category]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.help_keyword]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.help_relation]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.help_topic]
SEVERITY ERRNO MESSAGE
ERROR 3554 Access to system table 'mysql.innodb_index_stats' is rejected.
SEVERITY ERRNO MESSAGE
ERROR 3554 Access to system table 'mysql.innodb_table_stats' is rejected.
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.password_history]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.plugin]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.procs_priv]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.proxies_priv]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.replication_asynchronous_connection_failover]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.replication_asynchronous_connection_failover_managed]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.replication_group_configuration_version]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.replication_group_member_actions]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.role_edges]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.server_cost]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.servers]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.slave_master_info]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.slave_relay_log_info]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.slave_worker_info]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.tables_priv]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.time_zone]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_leap_second]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_name]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_transition]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.time_zone_transition_type]
SEVERITY ERRNO MESSAGE
Warning 1726 Storage engine 'MyISAM' does not support system tables. [mysql.user]
DROP PROCEDURE test_create_system_table;
DROP PROCEDURE execute_stmt;
DROP TABLE system_tables;
|