Debian Codegraph @

mysql-test/suite/innodb/include/default_row_format_tablespace.inc

raw
1 # Check Default row_format=Dynamic
2 SELECT @@innodb_default_row_format;
3
4 # Check if no tablespace is set
5 if ($tablespace == '') {
6
7 # Check Default file_per_table=ON & Barracuda
8 SELECT @@innodb_file_per_table;
9
10 --echo #Create table with no tablespace
11 CREATE TABLE tab(c1 TEXT, c2 BLOB);
12
13 # Insert some records
14 INSERT INTO tab VALUES('Check with no tablespace','Check with no tablespace');
15 }
16
17 # Check if tablespace is set
18 if ($tablespace == 'tblsp') {
19
20 # Check for compressed tables without File_block_size.
21 --echo #Create table with tablespace
22 eval CREATE TABLESPACE $tablespace ADD DATAFILE '$tablespace.ibd'
23 ENGINE=InnoDB;
24
25 eval CREATE TABLE tab(c1 TEXT, c2 BLOB) TABLESPACE $tablespace;
26
27 # Check for compressed tables with File_block_size.
28 CREATE TABLESPACE tblsp1 ADD DATAFILE 'tblsp1.ibd' FILE_BLOCK_SIZE=1k
29 ENGINE=InnoDB;
30 CREATE TABLE tab1(c1 TEXT, c2 BLOB) KEY_BLOCK_SIZE=1 TABLESPACE tblsp1;
31
32 # Insert some records
33 INSERT INTO tab VALUES('Check with General tablespace',
34 'Check with General tablespace');
35 INSERT INTO tab1 VALUES('tablsp File Block size',
36 'tablsp File Block size');
37 }
38
39 # Check if system tablespace is set
40 if ($tablespace == 'innodb_system') {
41
42 --echo #Create table with innodb system tablespace
43 # Create table in system tablesspace
44 CREATE TABLE tab(c1 TEXT, c2 BLOB) TABLESPACE innodb_system;
45
46 # Insert some records
47 INSERT INTO tab VALUES('Check with InnoDB system tablespace',
48 'Check with InnoDB system tablespace');
49
50 }
51
52 # Check when file_per_table=OFF is set
53 if ($tablespace == 'OFF') {
54 # Set file_per_table=OFF
55 SET GLOBAL innodb_file_per_table=0;
56
57 # Check Default file_per_table=OFF
58 SELECT @@innodb_file_per_table;
59
60 --echo #Create table with file_per_table=0
61 CREATE TABLE tab(c1 TEXT, c2 BLOB);
62
63 # Insert some records
64 INSERT INTO tab VALUES('File per table off','File per table off');
65 }
66
67 # Check Default row_format=Dynamic
68 --source suite/innodb/include/default_row_format_show.inc
69
70 ALTER TABLE tab ROW_FORMAT=COMPACT;
71
72 # Check Default row_format=Compact
73 --source suite/innodb/include/default_row_format_show.inc
74
75 CHECK TABLE tab;
76
77 ALTER TABLE tab ROW_FORMAT=DYNAMIC;
78
79 # Check Default row_format=Dynamic
80 --source suite/innodb/include/default_row_format_show.inc
81
82 CHECK TABLE tab;
83
84 ALTER TABLE tab ROW_FORMAT=REDUNDANT;
85
86 # Check Default row_format=Redundant
87 --source suite/innodb/include/default_row_format_show.inc
88
89 CHECK TABLE tab;
90
91 # Check successful, when no tablespace is set
92 if ($tablespace == '') {
93 ALTER TABLE tab ROW_FORMAT=COMPRESSED;
94 }
95
96 # When tablespace is set, check error for compressed tables with
97 # and without File_block_size
98 # Check ALTER success for compressed tables with tablespace File_block_size
99 if ($tablespace == 'tblsp') {
100
101 # Check error with compressed tables without File_block_size
102 --error ER_ILLEGAL_HA_CREATE_OPTION
103 ALTER TABLE tab ROW_FORMAT=COMPRESSED;
104
105 # Check error with compressed tables with File_block_size
106 --error ER_ILLEGAL_HA_CREATE_OPTION
107 ALTER TABLE tab1 ROW_FORMAT=DYNAMIC;
108 }
109
110 # Check when file_per_table=OFF is set
111 if ($tablespace == 'OFF') {
112 --error ER_ILLEGAL_HA_CREATE_OPTION
113 ALTER TABLE tab ROW_FORMAT=COMPRESSED;
114 }
115
116 # Check Default row_format=Compressed
117 # Note: we do not use default_row_format_show.inc because
118 # ALTER ROW_FORMAT=COMPRESSED shows different compressed page sizes
119 # with different innodb_page_sizes
120 SELECT NAME,ROW_FORMAT FROM INFORMATION_SCHEMA.INNODB_TABLES
121 WHERE NAME='test/tab';
122
123 CHECK TABLE tab;
124
125 if ($tablespace == 'tblsp') {
126 CHECK TABLE tab1;
127 }
128
129 ALTER TABLE tab ROW_FORMAT=Dynamic;
130
131 # Check Default row_format=Dynamic;
132 --source suite/innodb/include/default_row_format_show.inc
133
134 CHECK TABLE tab;
135
136 # Cleanup
137 DROP TABLE tab;
138
139 # Drop only when tablespace is set
140 if ($tablespace == 'tblsp') {
141 DROP TABLE tab1;
142 eval DROP TABLESPACE $tablespace;
143 DROP TABLESPACE tblsp1;
144 }
145
146 # Reset to default values
147 SET GLOBAL innodb_file_per_table=Default;