File: tablespace_per_table_not_windows.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (171 lines) | stat: -rw-r--r-- 7,153 bytes parent folder | download
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
--echo #
--echo # Test the limits of a file-per-table tablespace name.  MySQL combines
--echo # the database name with the table name to make a unique table name.
--echo #

--source include/not_windows.inc
# This will test the limit of a filename in MySQL at 512 bytes.
# We control that by making it a relative path starting with "./".

SET default_storage_engine=InnoDB;
LET $MYSQLD_DATADIR = `select @@datadir`;

--disable_query_log
# Suppress errors about too long filenames in error log.
call mtr.add_suppression("\\[Warning\\] .* '.*' name too long, can't delete!");
call mtr.add_suppression("\\[ERROR\\] .* Operating system error number .* in a file operation.");
call mtr.add_suppression("\\[ERROR\\] .* Error number .* means '.*'");
call mtr.add_suppression("\\[ERROR\\] .* Cannot create file .*");
call mtr.add_suppression("\\[ERROR\\] .* File .* 'create' returned OS error .*");
call mtr.add_suppression("\\[ERROR\\] .* File .* 'delete' returned OS error .*");
call mtr.add_suppression("\\[ERROR\\] .* File .* 'stat' returned OS error .*");
--enable_query_log

--echo #
--echo # MySQL limits each database and tablename identifier to 64 characters
--echo # of up to 3 bytes per character, corresponding to 192 bytes.
--echo #
LET $too_long_name  = this_sixty_five_byte_name_is_too_long____________________________;
--error ER_TOO_LONG_IDENT
--eval CREATE DATABASE `$too_long_name`

LET $long_name      = this_sixty_four_byte_name_is_not_too_long_______________________;
--eval CREATE DATABASE `$long_name`
--eval USE `$long_name`

--echo #
--echo # A 64 character tablename can be created in a 64 character database name
--echo #
--eval CREATE TABLE `$long_name`.`$long_name` (a SERIAL)

--echo #
--echo # A 65 character tablename is too long.
--echo #
--error ER_TOO_LONG_IDENT
--eval CREATE TABLE `test`.`$too_long_name` (a SERIAL)
--error ER_TOO_LONG_IDENT
--eval CREATE TABLE `$long_name`.`$too_long_name` (a SERIAL)

--echo #
--echo # Non-non-filename-safe characters like '#' are expanded to '@0023'.
--echo # On many file systems, such as Linux extfs, you can create a database name
--echo # that expands to up to 255 bytes long.
--echo # `##################################################_long` is expanded to
--echo #                        (50 * 5) +                     5  = 255.
--echo #
LET $long_db_name = ##################################################_long;
--eval CREATE DATABASE `$long_db_name`;
--eval USE `$long_db_name`

--echo #
--echo # This 256-byte name is only one byte longer but fails with an error code
--echo # from the stat operation.
--echo # `##################################################_long_` is expanded to
--echo #                        (50 * 5) +                    6  = 256.
--echo #
--replace_regex /OS errno [0-9]+/Errcode: ##/  /@0023/#/ /Filename/File name/
--error 13
CREATE DATABASE `##################################################_long_`;

--echo #
--echo # This 300-byte name which is the longest name that gets an error code
--echo # from the stat operation.
--echo # `###########################################################_long` is expanded to
--echo #                        (59 * 5) +                             5  = 300.
--echo #
--replace_regex /OS errno [0-9]+/Errcode: ##/  /@0023/#/ /Filename/File name/
--error 13
CREATE DATABASE `###########################################################_long`;

--echo #
--echo # This 301-byte name which is only one byte longer but fails with ER_TOO_LONG_IDENT.
--echo # `###########################################################_long_` is expanded to
--echo #                        (59 * 5) +                             6  = 301.
--echo #
--replace_result @0023 #
--error ER_TOO_LONG_IDENT
CREATE DATABASE `###########################################################_long_`;

USE test;

LET $long_249_byte_table_name = #################################################long;
LET $long_250_byte_table_name = #################################################_long;
LET $long_251_byte_table_name = #################################################_long_;
LET $long_252_byte_table_name = #################################################_long___;

--echo #
--echo # An expanded table name is limited to 251 bytes
--echo #
--eval CREATE TABLE `test`.`$long_251_byte_table_name` (a SERIAL)

--echo #
--echo # A 252-byte tablename is too long
--echo #
--replace_regex /@0023/#/
--error ER_GET_ERRNO 
--eval CREATE TABLE `test`.`$long_252_byte_table_name` (a SERIAL)

CREATE DATABASE twenty_byte_db_name_;
USE `twenty_byte_db_name_`;

--echo #
--echo # A 251 byte expanded table name will fit with a longer database name
--echo #
--eval CREATE TABLE `twenty_byte_db_name_`.`$long_251_byte_table_name` (a SERIAL)

--echo #
--echo # A 252 byte expanded table name is also too long in a longer database name
--echo #
--replace_regex /@0023/#/
--error ER_GET_ERRNO 
--eval CREATE TABLE `twenty_byte_db_name_`.`$long_252_byte_table_name` (a SERIAL)

--echo #
--echo # Another limitation is a 512 byte length to an expanded path that includes
--echo # the datadir which is './' in this test, the expanded database name,
--echo # the directory separator '/', the expanded table name, and the file extension.
--echo # './long_db_name.long_250_byte_table_name.frm'
--echo #  2+    255    +1+       250            +1+3  = 512
--echo #
--eval CREATE TABLE `$long_db_name`.`$long_250_byte_table_name` (a SERIAL)

--error ER_IDENT_CAUSES_TOO_LONG_PATH
--eval CREATE TABLE `$long_db_name`.`$long_251_byte_table_name` (a SERIAL)
SHOW WARNINGS;

--echo #
--echo # Show the successfully created databases and tables
--echo #
--echo ---- list_files MYSQLD_DATADIR/test
--replace_result @0023 #
--list_files $MYSQLD_DATADIR/test
--echo ---- list_files MYSQLD_DATADIR/$long_name
--replace_result @0023 #
--list_files $MYSQLD_DATADIR/$long_name
--echo ---- list_files MYSQLD_DATADIR/$long_db_name
--replace_result @0023 #
--list_files $MYSQLD_DATADIR/@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

--replace_result @0023 #
SELECT name FROM information_schema.innodb_tables WHERE name LIKE '%long%';
--replace_result @0023 #
SELECT name FROM information_schema.innodb_tablespaces WHERE name LIKE '%long%';
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR  @0023 #
SELECT path FROM information_schema.innodb_datafiles WHERE path LIKE '%long%' order by path;
--vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR  @0023 #
SELECT file_name, tablespace_name FROM information_schema.files
  WHERE file_name LIKE '%long%' ORDER BY file_name;
--horizontal_results

--echo #
--echo # Cleanup
--echo #

--eval DROP TABLE `$long_name`.`$long_name`
--eval DROP TABLE `test`.`$long_251_byte_table_name`
--eval DROP TABLE `twenty_byte_db_name_`.`$long_251_byte_table_name`
--eval DROP TABLE `$long_db_name`.`$long_250_byte_table_name`
--eval DROP DATABASE `$long_name`
--eval DROP DATABASE `$long_db_name`
DROP DATABASE `twenty_byte_db_name_`;