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 658 659 660 661 662 663 664
|
#
# Test support for the COMPRESSION syntax on any system by
# making InnoDB ignore the actual Punch Hole and setting the
# file system punch hole size (block_size or compression unit)
# to half the UNIV_PAGE_SIZE so that punch hole seems to work
# even though no space on the FS is being released.
#
SET DEFAULT_STORAGE_ENGINE=InnoDB;
SET GLOBAL innodb_file_per_table = ON;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
CREATE TABLESPACE s1 ADD DATAFILE 's1.ibd';
#
# Try to create a table with ZLib compression with strict mode OFF.
# If there is an error about Punch Hole not supported, make InnoDB
# think that Punch Hole is working but actually ignore the calls.
#
SET SESSION innodb_strict_mode = OFF;
SELECT @@innodb_strict_mode;
@@innodb_strict_mode
0
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB";
DROP TABLE t1;
#
# Test acceptable DDL with innodb_strict_mode=ON.
#
SET SESSION innodb_strict_mode = ON;
SELECT @@innodb_strict_mode;
@@innodb_strict_mode
1
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB";
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB'
INSERT INTO t1 VALUES(1),(2),(3),(4);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
SELECT * FROM t1;
c1
1
2
3
4
CREATE TABLE t2(c1 INT PRIMARY KEY) COMPRESSION="LZ4";
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='LZ4'
INSERT INTO t2 VALUES(1),(2),(3),(4);
FLUSH TABLES t2 WITH READ LOCK;
UNLOCK TABLES;
SELECT * FROM t2;
c1
1
2
3
4
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' OR TABLE_NAME = 't2' ORDER BY TABLE_NAME;
TABLE_NAME CREATE_OPTIONS
t1 COMPRESSION="ZLIB"
t2 COMPRESSION="LZ4"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME LIKE 'test/t%' ORDER BY NAME;
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
test/t2 Dynamic Single
#
# Bug#21687636 COMPRESSION COLUMN IN INNODB_TABLESPACES IS NOT CORRECT
#
# restart
SET GLOBAL innodb_file_per_table = ON;
SET SESSION innodb_strict_mode = ON;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='LZ4'
#
# Bug#21557723 Create table from the SHOW CREATE TABLE output
#
DROP TABLE t1, t2;
CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB';
CREATE TABLE `t2` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='LZ4';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB'
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='LZ4'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' OR TABLE_NAME = 't2' ORDER BY TABLE_NAME;
TABLE_NAME CREATE_OPTIONS
t1 COMPRESSION="ZLIB"
t2 COMPRESSION="LZ4"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME LIKE 'test/t%' ORDER BY NAME;
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
test/t2 Dynamic Single
INSERT INTO t1 VALUES(1),(2),(3),(4);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
SELECT * FROM t1;
c1
1
2
3
4
INSERT INTO t2 VALUES(1),(2),(3),(4);
FLUSH TABLES t2 WITH READ LOCK;
UNLOCK TABLES;
SELECT * FROM t2;
c1
1
2
3
4
DROP TABLE t2;
#
# Create a second table using CREATE TABLE LIKE and CREATE TABLE AS SELECT *
# starting with a table that really has Page Compression
#
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 SELECT * FROM t1;
CREATE TABLE t3 AS SELECT * FROM t1;
CREATE DATABASE test2;
CREATE TABLE test2.t2 LIKE t1;
INSERT INTO test2.t2 SELECT * FROM t1;
CREATE TABLE test2.t3 AS SELECT * FROM t1;
SELECT TABLE_SCHEMA, TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 't2' OR TABLE_NAME = 't3' ORDER BY TABLE_SCHEMA, TABLE_NAME;
TABLE_SCHEMA TABLE_NAME CREATE_OPTIONS
test t2 COMPRESSION="ZLIB"
test t3
test2 t2 COMPRESSION="ZLIB"
test2 t3
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
WHERE NAME LIKE 'test%/t%' ORDER BY NAME;
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
test/t2 Dynamic Single
test/t3 Dynamic Single
test2/t2 Dynamic Single
test2/t3 Dynamic Single
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB'
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SHOW CREATE TABLE test2.t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='ZLIB'
SHOW CREATE TABLE test2.t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` int NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE test2.t2;
DROP TABLE test2.t3;
DROP DATABASE test2;
#
# Change compression with ALTER TABLE
#
ALTER TABLE t1 COMPRESSION='';
INSERT INTO t1 VALUES(5);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
ALTER TABLE t1 COMPRESSION='LZ4';
INSERT INTO t1 VALUES(6);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='LZ4'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 COMPRESSION="LZ4"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
ALTER TABLE t1 COMPRESSION='NONE';
INSERT INTO t1 VALUES(7);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='NONE'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 COMPRESSION="NONE"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='NONE'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 COMPRESSION="NONE"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
DROP TABLE t1;
#
# Test various BAD DDL with innodb_strict_mode=ON.
#
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="zlibX";
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Unsupported compression algorithm 'zlibX'
Error 1031 Table storage engine for 't1' doesn't have this option
SHOW CREATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist
#
# Check for too long string
#
SET @long_str = REPEAT('ZLIB', 32768);
SET @s = CONCAT('CREATE TABLE t1(c1 INT) ENGINE=InnoDB, COMPRESSION="', @long_str, '"');
PREPARE stmt from @s;
EXECUTE stmt;
ERROR HY000: String 'ZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZL' is too long for COMPRESSION (should be no longer than 2048)
SHOW WARNINGS;
Level Code Message
Error 1470 String 'ZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZL' is too long for COMPRESSION (should be no longer than 2048)
DEALLOCATE PREPARE stmt;
SHOW CREATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist
#
# Compression cannot be used with ROW_FORMAT=COMPRESSED, TEMPORARY
# or Shared tablespaces, either general or system.
#
# CREATE TABLE: COMPRESSION + TEMPORARY
CREATE TEMPORARY TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB";
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for temporary tables
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + TABLESPACE
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=s1;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for shared general tablespaces
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + TABLESPACE=innodb_system
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=innodb_system;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for the system tablespace
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + TABLESPACE=innodb_temporary
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=innodb_temporary;
ERROR HY000: InnoDB: Tablespace `innodb_temporary` can only contain TEMPORARY tables.
SHOW WARNINGS;
Level Code Message
Error 1478 InnoDB: Tablespace `innodb_temporary` can only contain TEMPORARY tables.
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + TEMPORARY + TABLESPACE=innodb_temporary
CREATE TEMPORARY TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=innodb_temporary;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: TABLESPACE=innodb_temporary option is ignored. All temporary tables are created in a session temporary tablespace. This option is deprecated and will be removed in a future release.
Warning 138 InnoDB: Page Compression is not supported for temporary tables
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + implicit System Tablespace
SET GLOBAL INNODB_FILE_PER_TABLE = OFF;
CREATE TABLE t1(C1 INT) ENGINE=InnoDB COMPRESSION="zlib";
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for the system tablespace
Error 1031 Table storage engine for 't1' doesn't have this option
CREATE TABLE t1(C1 INT) ENGINE=InnoDB COMPRESSION="blah";
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Unsupported compression algorithm 'blah'
Error 1031 Table storage engine for 't1' doesn't have this option
SET GLOBAL INNODB_FILE_PER_TABLE = ON;
# CREATE TABLE: COMPRESSION + ROW_FORMAT=COMPRESSED
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" ROW_FORMAT=COMPRESSED;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + KEY_BLOCK_SIZE
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" KEY_BLOCK_SIZE=2;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
Error 1031 Table storage engine for 't1' doesn't have this option
# ALTER TABLE: implicit COMPRESSION + TABLESPACE
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB";
ALTER TABLE t1 TABLESPACE=s1;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for shared general tablespaces
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
# ALTER TABLE: COMPRESSION + TABLESPACE
ALTER TABLE t1 COMPRESSION="LZ4" TABLESPACE=s1;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for shared general tablespaces
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
# ALTER TABLE: implicit COMPRESSION + ROW_FORMAT=COMPRESSED
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
# ALTER TABLE: COMPRESSION + ROW_FORMAT=COMPRESSED
ALTER TABLE t1 COMPRESSION="ZLIB" ROW_FORMAT=COMPRESSED;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
# ALTER TABLE: COMPRESSION + KEY_BLOCK_SIZE
ALTER TABLE t1 COMPRESSION="ZLIB" KEY_BLOCK_SIZE=2;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
# ALTER TABLE: COMPRESSION='abcdefghijklmnopqrstuvwxyz'
ALTER TABLE t1 COMPRESSION='abcdefghijklmnopqrstuvwxyz';
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Unsupported compression algorithm 'abcdefghijklmnopqrstuvwxyz'
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
DROP TABLE t1;
#
# Test the bad combinations above with innodb_strict_mode=OFF.
#
SET SESSION innodb_strict_mode = OFF;
SELECT @@innodb_strict_mode;
@@innodb_strict_mode
0
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="zlibX";
Warnings:
Warning 1112 InnoDB: Unsupported compression algorithm 'zlibX'
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Unsupported compression algorithm 'zlibX'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMPRESSION='zlibX'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 COMPRESSION="zlibX"
SELECT NAME, ROW_FORMAT, SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Dynamic Single
DROP TABLE t1;
#
# Check for too long string
#
SET @long_str = REPEAT('ZLIB', 32768);
SET @s = CONCAT('CREATE TABLE t1(c1 INT) ENGINE=InnoDB, COMPRESSION="', @long_str, '"');
PREPARE stmt from @s;
EXECUTE stmt;
ERROR HY000: String 'ZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZL' is too long for COMPRESSION (should be no longer than 2048)
SHOW WARNINGS;
Level Code Message
Error 1470 String 'ZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZLIBZL' is too long for COMPRESSION (should be no longer than 2048)
DEALLOCATE PREPARE stmt;
SHOW CREATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist
#
# Compression cannot be used with ROW_FORMAT=COMPRESSED, TEMPORARY
# or Shared tablespaces, either general or system.
#
# CREATE TABLE: COMPRESSION + TEMPORARY
CREATE TEMPORARY TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB";
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for temporary tables
Warning 138 InnoDB: Compression not supported for temporary tables
Error 1112 Table 't1' uses an extension that doesn't exist in this MySQL version
# CREATE TABLE: COMPRESSION + TABLESPACE
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=s1;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for shared general tablespaces
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + TABLESPACE=innodb_system
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=innodb_system;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for the system tablespace
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + TABLESPACE=innodb_temporary
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=innodb_temporary;
ERROR HY000: InnoDB: Tablespace `innodb_temporary` can only contain TEMPORARY tables.
SHOW WARNINGS;
Level Code Message
Error 1478 InnoDB: Tablespace `innodb_temporary` can only contain TEMPORARY tables.
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + TEMPORARY + TABLESPACE=innodb_temporary
CREATE TEMPORARY TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" TABLESPACE=innodb_temporary;
ERROR HY000: Table storage engine for 't1' doesn't have this option
SHOW WARNINGS;
Level Code Message
Warning 1478 InnoDB: TABLESPACE=innodb_temporary option is ignored. All temporary tables are created in a session temporary tablespace. This option is deprecated and will be removed in a future release.
Warning 138 InnoDB: Page Compression is not supported for temporary tables
Error 1031 Table storage engine for 't1' doesn't have this option
# CREATE TABLE: COMPRESSION + implicit System Tablespace
SET GLOBAL INNODB_FILE_PER_TABLE = OFF;
CREATE TABLE t1(C1 INT) ENGINE=InnoDB COMPRESSION="zlib";
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for the system tablespace
Warning 138 InnoDB: Compression not supported for shared tablespaces
Error 1112 Table 't1' uses an extension that doesn't exist in this MySQL version
CREATE TABLE t1(C1 INT) ENGINE=InnoDB COMPRESSION="blah";
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Unsupported compression algorithm 'blah'
Warning 138 InnoDB: Compression not supported for shared tablespaces
Error 1112 Table 't1' uses an extension that doesn't exist in this MySQL version
SET GLOBAL INNODB_FILE_PER_TABLE = ON;
# CREATE TABLE: COMPRESSION + ROW_FORMAT=COMPRESSED
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" ROW_FORMAT=COMPRESSED;
Warnings:
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED COMPRESSION='ZLIB'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 row_format=COMPRESSED COMPRESSION="ZLIB"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Compressed Single
INSERT INTO t1 VALUES(1),(2),(3),(4);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
SELECT * FROM t1;
c1
1
2
3
4
DROP TABLE t1;
# CREATE TABLE: COMPRESSION + KEY_BLOCK_SIZE
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB" KEY_BLOCK_SIZE=2;
Warnings:
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci KEY_BLOCK_SIZE=2 COMPRESSION='ZLIB'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 KEY_BLOCK_SIZE=2 COMPRESSION="ZLIB"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Compressed Single
INSERT INTO t1 VALUES(1),(2),(3),(4);
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
SELECT * FROM t1;
c1
1
2
3
4
DROP TABLE t1;
# ALTER TABLE: implicit COMPRESSION + TABLESPACE
CREATE TABLE t1(c1 INT PRIMARY KEY) COMPRESSION="ZLIB";
ALTER TABLE t1 TABLESPACE=s1;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for shared general tablespaces
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
# ALTER TABLE: COMPRESSION + TABLESPACE
ALTER TABLE t1 COMPRESSION="LZ4" TABLESPACE=s1;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
SHOW WARNINGS;
Level Code Message
Warning 138 InnoDB: Page Compression is not supported for shared general tablespaces
Error 1478 Table storage engine 'InnoDB' does not support the create option 'COMPRESSION'
# ALTER TABLE: implicit COMPRESSION + ROW_FORMAT=COMPRESSED
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
Warnings:
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED COMPRESSION='ZLIB'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 row_format=COMPRESSED COMPRESSION="ZLIB"
SELECT NAME, ROW_FORMAT, SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Compressed Single
# ALTER TABLE: COMPRESSION + ROW_FORMAT=COMPRESSED
ALTER TABLE t1 COMPRESSION="ZLIB" ROW_FORMAT=COMPRESSED;
Warnings:
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED COMPRESSION='ZLIB'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 row_format=COMPRESSED COMPRESSION="ZLIB"
SELECT NAME, ROW_FORMAT, SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Compressed Single
# ALTER TABLE: COMPRESSION + KEY_BLOCK_SIZE
ALTER TABLE t1 COMPRESSION="ZLIB" KEY_BLOCK_SIZE=2;
Warnings:
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Page Compression is not supported with row_format=compressed or key_block_size > 0
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 COMPRESSION='ZLIB'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 row_format=COMPRESSED KEY_BLOCK_SIZE=2 COMPRESSION="ZLIB"
SELECT NAME, ROW_FORMAT, SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Compressed Single
# ALTER TABLE: COMPRESSION='abcdefghijklmnopqrstuvwxyz'
ALTER TABLE t1 COMPRESSION='abcdefghijklmnopqrstuvwxyz';
Warnings:
Warning 1112 InnoDB: Unsupported compression algorithm 'abcdefghijklmnopqrstuvwxyz'
SHOW WARNINGS;
Level Code Message
Warning 1112 InnoDB: Unsupported compression algorithm 'abcdefghijklmnopqrstuvwxyz'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int NOT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 COMPRESSION='abcdefghijklmnopqrstuvwxyz'
SELECT TABLE_NAME, CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_NAME CREATE_OPTIONS
t1 row_format=COMPRESSED KEY_BLOCK_SIZE=2 COMPRESSION="abcdefg"
SELECT NAME,ROW_FORMAT,SPACE_TYPE FROM INFORMATION_SCHEMA.INNODB_TABLESPACES WHERE NAME = 'test/t1';
NAME ROW_FORMAT SPACE_TYPE
test/t1 Compressed Single
DROP TABLE t1;
#
# BUG#22916982 - ASSERT 0 IN FSP_SDI_GET_ROOT_PAGE_NUM(), FLUSH TABLES FOR EXPORT
#
CREATE TABLE t1 (a INT) ENGINE=INNODB ROW_FORMAT=DYNAMIC COMPRESSION='ZLIB';
FLUSH TABLE t1 FOR EXPORT;
# restart
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE t1;
#
# Cleanup
#
DROP TABLESPACE s1;
SET GLOBAL INNODB_FILE_PER_TABLE=1;
SET GLOBAL INNODB_FILE_PER_TABLE=1;
SET DEBUG='-d,ignore_punch_hole';
SET DEBUG='-d,ignore_punch_hole_size';
|