mirror of
https://github.com/MariaDB/server.git
synced 2025-07-20 10:24:14 +03:00
This imports and adapts a number of MySQL 5.7 test cases that are applicable to MariaDB. Some tests for old bug fixes are not that relevant because the code has been refactored since then (especially starting with MariaDB Server 10.6), and the tests would not reproduce the original bug if the fix was reverted. In the test innodb_fts.opt, there are many duplicate MATCH ranks, which would make the results nondeterministic. The test was stabilized by changing some LIMIT clauses or by adding sorted_result in those cases where the purpose of a test was to show that no sorting took place in the server. In the test innodb_fts.phrase, MySQL 5.7 would generate FTS_DOC_ID that are 1 larger than in MariaDB. In innodb_fts.index_table the difference is 2. This is because in MariaDB, fts_get_next_doc_id() post-increments cache->next_doc_id, while MySQL 5.7 pre-increments it. Reviewed by: Thirunarayanan Balathandayuthapani
135 lines
8.6 KiB
Plaintext
135 lines
8.6 KiB
Plaintext
#
|
|
# Test the limits of a file-per-table tablespace name. MySQL combines
|
|
# the database name with the table name to make a unique table name.
|
|
#
|
|
SET default_storage_engine=InnoDB;
|
|
#
|
|
# MySQL limits each database and tablename identifier to 64 characters
|
|
# of up to 3 bytes per character, corresponding to 192 bytes.
|
|
#
|
|
CREATE DATABASE `this_sixty_five_byte_name_is_too_long____________________________`;
|
|
ERROR 42000: Incorrect database name 'this_sixty_five_byte_name_is_too_long____________________________'
|
|
CREATE DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`;
|
|
USE `this_sixty_four_byte_name_is_not_too_long_______________________`;
|
|
#
|
|
# A 64 character tablename can be created in a 64 character database name
|
|
#
|
|
CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________` (a SERIAL);
|
|
#
|
|
# A 65 character tablename is too long.
|
|
#
|
|
CREATE TABLE `test`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL);
|
|
ERROR 42000: Incorrect table name 'this_sixty_five_byte_name_is_too_long____________________________'
|
|
CREATE TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_five_byte_name_is_too_long____________________________` (a SERIAL);
|
|
ERROR 42000: Incorrect table name 'this_sixty_five_byte_name_is_too_long____________________________'
|
|
#
|
|
# Non-non-filename-safe characters like '#' are expanded to '@0023'.
|
|
# On many file systems, such as Linux extfs, you can create a database name
|
|
# that expands to up to 255 bytes long.
|
|
# `##################################################_long` is expanded to
|
|
# (50 * 5) + 5 = 255.
|
|
#
|
|
CREATE DATABASE `##################################################_long`;;
|
|
USE `##################################################_long`;
|
|
#
|
|
# This 256-byte name is only one byte longer but fails with an error code
|
|
# from the stat operation.
|
|
# `##################################################_long_` is expanded to
|
|
# (50 * 5) + 6 = 256.
|
|
#
|
|
CREATE DATABASE `##################################################_long_`;
|
|
ERROR HY000: Can't get stat of './##################################################_long_' (Errcode: ## "File name too long")
|
|
#
|
|
# This 300-byte name which is the longest name that gets an error code
|
|
# from the stat operation.
|
|
# `###########################################################_long` is expanded to
|
|
# (59 * 5) + 5 = 300.
|
|
#
|
|
CREATE DATABASE `###########################################################_long`;
|
|
ERROR HY000: Can't get stat of './###########################################################_long' (Errcode: ## "File name too long")
|
|
#
|
|
# This 301-byte name which is only one byte longer but fails with ER_TOO_LONG_IDENT.
|
|
# `###########################################################_long_` is expanded to
|
|
# (59 * 5) + 6 = 301.
|
|
#
|
|
CREATE DATABASE `###########################################################_long_`;
|
|
ERROR 42000: Incorrect database name '###########################################################_long_'
|
|
USE test;
|
|
#
|
|
# An expanded table name is limited to 251 bytes
|
|
#
|
|
CREATE TABLE `test`.`#################################################_long_` (a SERIAL);
|
|
#
|
|
# A 252-byte tablename is too long
|
|
#
|
|
CREATE TABLE `test`.`#################################################_long___` (a SERIAL);
|
|
ERROR HY000: Can't create table `test`.`#################################################_long___` (errno: ## "File name too long")
|
|
CREATE DATABASE twenty_byte_db_name_;
|
|
USE `twenty_byte_db_name_`;
|
|
#
|
|
# A 251 byte expanded table name will fit with a longer database name
|
|
#
|
|
CREATE TABLE `twenty_byte_db_name_`.`#################################################_long_` (a SERIAL);
|
|
#
|
|
# A 252 byte expanded table name is also too long in a longer database name
|
|
#
|
|
CREATE TABLE `twenty_byte_db_name_`.`#################################################_long___` (a SERIAL);
|
|
ERROR HY000: Can't create table `twenty_byte_db_name_`.`#################################################_long___` (errno: ## "File name too long")
|
|
#
|
|
# Another limitation is a 512 byte length to an expanded path that includes
|
|
# the datadir which is './' in this test, the expanded database name,
|
|
# the directory separator '/', the expanded table name, and the file extension.
|
|
# './long_db_name.long_250_byte_table_name.frm'
|
|
# 2+ 255 +1+ 250 +1+3 = 512
|
|
#
|
|
CREATE TABLE `##################################################_long`.`#################################################_long` (a SERIAL);
|
|
CREATE TABLE `##################################################_long`.`#################################################_long_` (a SERIAL);
|
|
ERROR HY000: Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023_long/@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Error 1860 Long database name and identifier for object resulted in path length exceeding 512 characters. Path: './@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023_long/@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@0023@
|
|
#
|
|
# Show the successfully created databases and tables
|
|
#
|
|
---- list_files MYSQLD_DATADIR/test
|
|
#################################################_long_.frm
|
|
#################################################_long_.ibd
|
|
db.opt
|
|
---- list_files MYSQLD_DATADIR/this_sixty_four_byte_name_is_not_too_long_______________________
|
|
db.opt
|
|
this_sixty_four_byte_name_is_not_too_long_______________________.frm
|
|
this_sixty_four_byte_name_is_not_too_long_______________________.ibd
|
|
---- list_files MYSQLD_DATADIR/##################################################_long
|
|
#################################################_long.frm
|
|
#################################################_long.ibd
|
|
db.opt
|
|
SELECT name FROM information_schema.innodb_sys_tables WHERE name LIKE '%long%';
|
|
name
|
|
##################################################_long/#################################################_long
|
|
test/#################################################_long_
|
|
this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________
|
|
twenty_byte_db_name_/#################################################_long_
|
|
SELECT name FROM information_schema.innodb_sys_tablespaces WHERE name LIKE '%long%';
|
|
name
|
|
this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________
|
|
test/#################################################_long_
|
|
twenty_byte_db_name_/#################################################_long_
|
|
##################################################_long/#################################################_long
|
|
SELECT path FROM information_schema.innodb_sys_datafiles WHERE path LIKE '%long%';
|
|
path
|
|
./this_sixty_four_byte_name_is_not_too_long_______________________/this_sixty_four_byte_name_is_not_too_long_______________________.ibd
|
|
./test/#################################################_long_.ibd
|
|
./twenty_byte_db_name_/#################################################_long_.ibd
|
|
./##################################################_long/#################################################_long.ibd
|
|
SELECT file_name, tablespace_name FROM information_schema.files WHERE file_name LIKE '%long%';
|
|
#
|
|
# Cleanup
|
|
#
|
|
DROP TABLE `this_sixty_four_byte_name_is_not_too_long_______________________`.`this_sixty_four_byte_name_is_not_too_long_______________________`;
|
|
DROP TABLE `test`.`#################################################_long_`;
|
|
DROP TABLE `twenty_byte_db_name_`.`#################################################_long_`;
|
|
DROP TABLE `##################################################_long`.`#################################################_long`;
|
|
DROP DATABASE `this_sixty_four_byte_name_is_not_too_long_______________________`;
|
|
DROP DATABASE `##################################################_long`;
|
|
DROP DATABASE `twenty_byte_db_name_`;
|