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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657
|
SET default_storage_engine=InnoDB;
#
# TABLESPACE related tests.
#
#
# CREATE TABLE ... DATA DIRECTORY
# Innodb does not support INDEX DIRECTORY.
#
SET SESSION innodb_strict_mode = ON;
CREATE TABLE t1 (a int KEY, b text) INDEX DIRECTORY='MYSQL_TMP_DIR/alt_dir';
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: INDEX DIRECTORY is not supported
Error 1031 Table storage engine for 't1' doesn't have this option
#
# Without strict mode, INDEX DIRECTORY is just ignored
#
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (a int KEY, b text) INDEX DIRECTORY='MYSQL_TMP_DIR/alt_dir';
Warnings:
Warning 1618 <INDEX DIRECTORY> option ignored
SHOW WARNINGS;
Level Code Message
Warning 1618 <INDEX DIRECTORY> option ignored
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# Innodb does not support DATA DIRECTORY without innodb_file_per_table=ON.
#
SET SESSION innodb_strict_mode = ON;
SET GLOBAL innodb_file_per_table=OFF;
CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: DATA DIRECTORY requires innodb_file_per_table.
Error 1031 Table storage engine for 't1' doesn't have this option
#
# Without strict mode, DATA DIRECTORY without innodb_file_per_table=ON is just ignored.
#
SET SESSION innodb_strict_mode = OFF;
CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
Warnings:
Warning 1478 InnoDB: DATA DIRECTORY requires innodb_file_per_table.
Warning 1618 <DATA DIRECTORY> option ignored
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: DATA DIRECTORY requires innodb_file_per_table.
Warning 1618 <DATA DIRECTORY> option ignored
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
# Now set innodb_file_per_table so that DATA DIRECTORY can be tested.
SET GLOBAL innodb_file_per_table=ON;
#
# Create the tablespace in MYSQL_TMP_DIR/alt_dir
# InnoDB will create the sub-directories if needed.
#
CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
SHOW WARNINGS;
Level Code Message
INSERT INTO t1 VALUES (1, "Create the tablespace");
SELECT * FROM t1;
a b
1 Create the tablespace
#
# Check if link file exists in MYSQLD_DATADIR
#
---- MYSQLD_DATADIR/test
t1.frm
t1.isl
# Check if tablespace file exists where we specified in DATA DIRECTORY
---- MYSQL_TMP_DIR/alt_dir/test
t1.ibd
#
# Check that DATA DIRECTORY shows up in the SHOW CREATE TABLE results.
#
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
# Show that the new system tables have this table in them correctly
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
name n_cols file_format row_format
test/t1 5 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/t1 Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir/test/t1.ibd
#
# Show that the system tables are updated on drop table
#
DROP TABLE t1;
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
#
# Create the same table a second time in the same place
#
CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
INSERT INTO t1 VALUES (2, "Create the same table a second time in the same place");
SELECT * FROM t1;
a b
2 Create the same table a second time in the same place
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/t1 5 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/t1 Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir/test/t1.ibd
---- MYSQLD_DATADIR/test
t1.frm
t1.isl
---- MYSQL_TMP_DIR/alt_dir/test
t1.ibd
#
# Truncate the table, then insert and verify
#
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (3, "Truncate the table, then insert");
SELECT * FROM t1;
a b
3 Truncate the table, then insert
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/t1 5 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/t1 Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir/test/t1.ibd
---- MYSQLD_DATADIR/test
t1.frm
t1.isl
---- MYSQL_TMP_DIR/alt_dir/test
t1.ibd
#
# Rename the table, then insert and verify
#
RENAME TABLE t1 TO t2;
INSERT INTO t2 VALUES (4, "Rename the table, then insert");
SELECT * FROM t2;
a b
3 Truncate the table, then insert
4 Rename the table, then insert
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/t2 5 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/t2 Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir/test/t2.ibd
---- MYSQLD_DATADIR/test
t2.frm
t2.isl
---- MYSQL_TMP_DIR/alt_dir/test
t2.ibd
#
# CREATE TABLE LIKE does not retain DATA DIRECTORY automatically.
#
CREATE TABLE t3 LIKE t2;
INSERT INTO t3 VALUES (5, "CREATE TABLE LIKE");
SELECT * FROM t3;
a b
5 CREATE TABLE LIKE
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/t2 5 Antelope Compact
test/t3 5 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/t2 Antelope Compact or Redundant
test/t3 Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir/test/t2.ibd
MYSQLD_DATADIR/test/t3.ibd
---- MYSQLD_DATADIR/test
t2.frm
t2.isl
t3.frm
t3.ibd
#
# Now make sure the tables can be fully dropped.
#
DROP TABLE t2, t3;
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
---- MYSQLD_DATADIR/test
---- MYSQL_TMP_DIR/alt_dir/test
#
# Be sure SQL MODE "NO_DIR_IN_CREATE" prevents the use of DATA DIRECTORY
#
SET @org_mode=@@sql_mode;
SET @@sql_mode='NO_DIR_IN_CREATE';
SELECT @@sql_mode;
@@sql_mode
NO_DIR_IN_CREATE
CREATE TABLE t1 (a int, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
SHOW WARNINGS;
Level Code Message
Warning 1618 <DATA DIRECTORY> option ignored
INSERT INTO t1 VALUES (6, "SQL MODE NO_DIR_IN_CREATE prevents DATA DIRECTORY");
DROP TABLE t1;
set @@sql_mode=@org_mode;
#
# MySQL engine does not allow DATA DIRECTORY to be
# within --datadir for any engine, including InnoDB
#
CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY 'MYSQLD_DATADIR/test';
ERROR HY000: Incorrect arguments to DATA DIRECTORY
# TEMPORARY tables are incompatible with DATA DIRECTORY
SET SESSION innodb_strict_mode = ON;
CREATE TEMPORARY TABLE t1 (a int KEY, b text) engine=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: DATA DIRECTORY cannot be used for TEMPORARY tables.
Error 1031 Table storage engine for 't1' doesn't have this option
SET SESSION innodb_strict_mode = OFF;
CREATE TEMPORARY TABLE t1 (a int KEY, b text) engine=InnoDB DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
Warnings:
Warning 1478 InnoDB: DATA DIRECTORY cannot be used for TEMPORARY tables.
Warning 1618 <DATA DIRECTORY> option ignored
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: DATA DIRECTORY cannot be used for TEMPORARY tables.
Warning 1618 <DATA DIRECTORY> option ignored
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
---- MYSQLD_DATADIR/test
---- MYSQL_TMP_DIR/alt_dir/test
#
# Create the remote table via static DDL statements in a stored procedure
#
CREATE PROCEDURE static_proc() BEGIN CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'; END |
CALL static_proc;
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir/test/t1.ibd
INSERT INTO t1 VALUES (7, "Create the remote table via static DDL statements");
SELECT * FROM t1;
a b
7 Create the remote table via static DDL statements
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
---- MYSQLD_DATADIR/test
t1.frm
t1.isl
---- MYSQL_TMP_DIR/alt_dir/test
t1.ibd
DROP PROCEDURE static_proc;
DROP TABLE t1;
#
# Create the remote table via dynamic DDL statements in a stored procedure
#
CREATE PROCEDURE dynamic_proc() BEGIN PREPARE stmt1 FROM "CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir'"; EXECUTE stmt1; END |
CALL dynamic_proc;
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir/test/t1.ibd
INSERT INTO t1 VALUES (8, "Create the remote table via dynamic DDL statements");
SELECT * FROM t1;
a b
8 Create the remote table via dynamic DDL statements
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
---- MYSQLD_DATADIR/test
t1.frm
t1.isl
---- MYSQL_TMP_DIR/alt_dir/test
t1.ibd
DROP PROCEDURE dynamic_proc;
DROP TABLE t1;
#
# CREATE, DROP, ADD and TRUNCATE PARTITION with DATA DIRECTORY
#
CREATE TABLE emp (
id INT NOT NULL,
store_name VARCHAR(30),
parts VARCHAR(30),
store_id INT
)
PARTITION BY LIST(store_id) (
PARTITION east VALUES IN (10,20,30)
DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_east',
PARTITION north VALUES IN (40,50,60)
DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_north',
PARTITION west VALUES IN (70,80,100)
DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_west'
);
INSERT INTO emp values(1,'Oracle','NUTT',10);
INSERT INTO emp values(2,'HUAWEI','BOLT',40);
INSERT INTO emp values(3,'IBM','NAIL',70);
SHOW CREATE TABLE emp;
Table Create Table
emp CREATE TABLE `emp` (
`id` int(11) NOT NULL,
`store_name` varchar(30) DEFAULT NULL,
`parts` varchar(30) DEFAULT NULL,
`store_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (store_id)
(PARTITION east VALUES IN (10,20,30) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_east' ENGINE = InnoDB,
PARTITION north VALUES IN (40,50,60) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_north' ENGINE = InnoDB,
PARTITION west VALUES IN (70,80,100) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_west' ENGINE = InnoDB) */
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/emp#p#east 7 Antelope Compact
test/emp#p#north 7 Antelope Compact
test/emp#p#west 7 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/emp#p#east Antelope Compact or Redundant
test/emp#p#north Antelope Compact or Redundant
test/emp#p#west Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir_east/test/emp#p#east.ibd
MYSQL_TMP_DIR/alt_dir_north/test/emp#p#north.ibd
MYSQL_TMP_DIR/alt_dir_west/test/emp#p#west.ibd
SELECT * FROM emp;
id store_name parts store_id
1 Oracle NUTT 10
2 HUAWEI BOLT 40
3 IBM NAIL 70
---- MYSQLD_DATADIR/test
emp#p#east.isl
emp#p#north.isl
emp#p#west.isl
emp.frm
emp.par
---- MYSQL_TMP_DIR/alt_dir_east/test
emp#p#east.ibd
---- MYSQL_TMP_DIR/alt_dir_north/test
emp#p#north.ibd
---- MYSQL_TMP_DIR/alt_dir_west/test
emp#p#west.ibd
#
# DROP one PARTITION.
#
ALTER TABLE emp DROP PARTITION west;
SHOW CREATE TABLE emp;
Table Create Table
emp CREATE TABLE `emp` (
`id` int(11) NOT NULL,
`store_name` varchar(30) DEFAULT NULL,
`parts` varchar(30) DEFAULT NULL,
`store_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (store_id)
(PARTITION east VALUES IN (10,20,30) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_east' ENGINE = InnoDB,
PARTITION north VALUES IN (40,50,60) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_north' ENGINE = InnoDB) */
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/emp#p#east 7 Antelope Compact
test/emp#p#north 7 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/emp#p#east Antelope Compact or Redundant
test/emp#p#north Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir_east/test/emp#p#east.ibd
MYSQL_TMP_DIR/alt_dir_north/test/emp#p#north.ibd
SELECT * FROM emp;
id store_name parts store_id
1 Oracle NUTT 10
2 HUAWEI BOLT 40
---- MYSQLD_DATADIR/test
emp#p#east.isl
emp#p#north.isl
emp.frm
emp.par
---- MYSQL_TMP_DIR/alt_dir_east/test
emp#p#east.ibd
---- MYSQL_TMP_DIR/alt_dir_north/test
emp#p#north.ibd
---- MYSQL_TMP_DIR/alt_dir_west/test
#
# ADD the PARTITION back.
#
ALTER TABLE emp ADD PARTITION (
PARTITION west VALUES IN (70,80,100)
DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_west');
SHOW CREATE TABLE emp;
Table Create Table
emp CREATE TABLE `emp` (
`id` int(11) NOT NULL,
`store_name` varchar(30) DEFAULT NULL,
`parts` varchar(30) DEFAULT NULL,
`store_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (store_id)
(PARTITION east VALUES IN (10,20,30) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_east' ENGINE = InnoDB,
PARTITION north VALUES IN (40,50,60) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_north' ENGINE = InnoDB,
PARTITION west VALUES IN (70,80,100) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_west' ENGINE = InnoDB) */
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/emp#p#east 7 Antelope Compact
test/emp#p#north 7 Antelope Compact
test/emp#p#west 7 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/emp#p#east Antelope Compact or Redundant
test/emp#p#north Antelope Compact or Redundant
test/emp#p#west Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir_east/test/emp#p#east.ibd
MYSQL_TMP_DIR/alt_dir_north/test/emp#p#north.ibd
MYSQL_TMP_DIR/alt_dir_west/test/emp#p#west.ibd
INSERT INTO emp VALUES(3,'IBM','NAIL',70);
SELECT * FROM emp;
id store_name parts store_id
1 Oracle NUTT 10
2 HUAWEI BOLT 40
3 IBM NAIL 70
---- MYSQLD_DATADIR/test
emp#p#east.isl
emp#p#north.isl
emp#p#west.isl
emp.frm
emp.par
---- MYSQL_TMP_DIR/alt_dir_east/test
emp#p#east.ibd
---- MYSQL_TMP_DIR/alt_dir_north/test
emp#p#north.ibd
---- MYSQL_TMP_DIR/alt_dir_west/test
emp#p#west.ibd
#
# TRUNCATE one PARTITION.
#
ALTER TABLE emp TRUNCATE PARTITION west;
SHOW CREATE TABLE emp;
Table Create Table
emp CREATE TABLE `emp` (
`id` int(11) NOT NULL,
`store_name` varchar(30) DEFAULT NULL,
`parts` varchar(30) DEFAULT NULL,
`store_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (store_id)
(PARTITION east VALUES IN (10,20,30) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_east' ENGINE = InnoDB,
PARTITION north VALUES IN (40,50,60) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_north' ENGINE = InnoDB,
PARTITION west VALUES IN (70,80,100) DATA DIRECTORY = 'MYSQL_TMP_DIR/alt_dir_west' ENGINE = InnoDB) */
SELECT name,n_cols,file_format,row_format
FROM information_schema.innodb_sys_tables
WHERE name LIKE 'test%'
ORDER BY name;
name n_cols file_format row_format
test/emp#p#east 7 Antelope Compact
test/emp#p#north 7 Antelope Compact
test/emp#p#west 7 Antelope Compact
SELECT name,file_format,row_format
FROM information_schema.innodb_sys_tablespaces
ORDER BY name;
name file_format row_format
mysql/innodb_index_stats Antelope Compact or Redundant
mysql/innodb_table_stats Antelope Compact or Redundant
mysql/slave_master_info Antelope Compact or Redundant
mysql/slave_relay_log_info Antelope Compact or Redundant
mysql/slave_worker_info Antelope Compact or Redundant
test/emp#p#east Antelope Compact or Redundant
test/emp#p#north Antelope Compact or Redundant
test/emp#p#west Antelope Compact or Redundant
SELECT path FROM information_schema.innodb_sys_datafiles
WHERE path LIKE '%test%' ORDER BY space;
path
MYSQL_TMP_DIR/alt_dir_east/test/emp#p#east.ibd
MYSQL_TMP_DIR/alt_dir_north/test/emp#p#north.ibd
MYSQL_TMP_DIR/alt_dir_west/test/emp#p#west.ibd
SELECT * FROM emp;
id store_name parts store_id
1 Oracle NUTT 10
2 HUAWEI BOLT 40
INSERT INTO emp VALUES(3,'IBM','NAIL',70);
SELECT * FROM emp;
id store_name parts store_id
1 Oracle NUTT 10
2 HUAWEI BOLT 40
3 IBM NAIL 70
---- MYSQLD_DATADIR/test
emp#p#east.isl
emp#p#north.isl
emp#p#west.isl
emp.frm
emp.par
---- MYSQL_TMP_DIR/alt_dir_east/test
emp#p#east.ibd
---- MYSQL_TMP_DIR/alt_dir_north/test
emp#p#north.ibd
---- MYSQL_TMP_DIR/alt_dir_west/test
emp#p#west.ibd
DROP TABLE emp;
#
# Cleanup
#
|