| 1 |
######### |
| 2 |
# SETUP # |
| 3 |
######### |
| 4 |
# Stop the running the server |
| 5 |
# Copy and unzip the datadir. |
| 6 |
# Restart the server against the unzipped datadir |
| 7 |
# restart: --datadir=DATADIR --innodb-page-size=16k |
| 8 |
############################################## |
| 9 |
# Test instant ADD/DROP COLUMN for REDUNDANT format |
| 10 |
############################################## |
| 11 |
# ------------------------------------------------------------ |
| 12 |
# Start server with old datadir with |
| 13 |
# table t1_redundant having |
| 14 |
# c1 normal column |
| 15 |
# c2 INSTANT ADD column |
| 16 |
# |
| 17 |
# table t2_redundant having |
| 18 |
# id, c1 normal columns |
| 19 |
# c2 INSTANT ADD column |
| 20 |
# ------------------------------------------------------------ |
| 21 |
SHOW CREATE TABLE t1_redundant; |
| 22 |
Table Create Table |
| 23 |
t1_redundant CREATE TABLE `t1_redundant` ( |
| 24 |
`c1` longtext, |
| 25 |
`c2` int DEFAULT NULL |
| 26 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=REDUNDANT |
| 27 |
BEGIN; |
| 28 |
UPDATE t1_redundant SET c2 = 0; |
| 29 |
ROLLBACK; |
| 30 |
SELECT SUBSTRING(c1, 1000, 32) FROM t1_redundant; |
| 31 |
SUBSTRING(c1, 1000, 32) |
| 32 |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 33 |
SHOW CREATE TABLE t2_redundant; |
| 34 |
Table Create Table |
| 35 |
t2_redundant CREATE TABLE `t2_redundant` ( |
| 36 |
`id` int NOT NULL AUTO_INCREMENT, |
| 37 |
`c1` longtext, |
| 38 |
`c2` int DEFAULT NULL, |
| 39 |
PRIMARY KEY (`id`) |
| 40 |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=REDUNDANT |
| 41 |
BEGIN; |
| 42 |
UPDATE t2_redundant SET c2 = 0; |
| 43 |
ROLLBACK; |
| 44 |
SELECT SUBSTRING(c1, 1000, 32) FROM t2_redundant; |
| 45 |
SUBSTRING(c1, 1000, 32) |
| 46 |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 47 |
############################################ |
| 48 |
# Test instant ADD/DROP COLUMN for DYNAMIC format |
| 49 |
############################################ |
| 50 |
# ------------------------------------------------------------ |
| 51 |
# Start server with old datadir with |
| 52 |
# table t1_dynamic having |
| 53 |
# c1 normal column |
| 54 |
# c2 INSTANT ADD column |
| 55 |
# |
| 56 |
# table t2_dynamic having |
| 57 |
# id, c1 normal columns |
| 58 |
# c2 INSTANT ADD column |
| 59 |
# ------------------------------------------------------------ |
| 60 |
SHOW CREATE TABLE t1_dynamic; |
| 61 |
Table Create Table |
| 62 |
t1_dynamic CREATE TABLE `t1_dynamic` ( |
| 63 |
`c1` longtext, |
| 64 |
`c2` int DEFAULT NULL |
| 65 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC |
| 66 |
BEGIN; |
| 67 |
UPDATE t1_dynamic SET c2 = 0; |
| 68 |
ROLLBACK; |
| 69 |
SELECT SUBSTRING(c1, 1000, 32) FROM t1_dynamic; |
| 70 |
SUBSTRING(c1, 1000, 32) |
| 71 |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 72 |
SHOW CREATE TABLE t2_dynamic; |
| 73 |
Table Create Table |
| 74 |
t2_dynamic CREATE TABLE `t2_dynamic` ( |
| 75 |
`id` int NOT NULL AUTO_INCREMENT, |
| 76 |
`c1` longtext, |
| 77 |
`c2` int DEFAULT NULL, |
| 78 |
PRIMARY KEY (`id`) |
| 79 |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC |
| 80 |
BEGIN; |
| 81 |
UPDATE t2_dynamic SET c2 = 0; |
| 82 |
ROLLBACK; |
| 83 |
SELECT SUBSTRING(c1, 1000, 32) FROM t2_dynamic; |
| 84 |
SUBSTRING(c1, 1000, 32) |
| 85 |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 86 |
############################################ |
| 87 |
# Test instant ADD/DROP COLUMN for COMPACT format |
| 88 |
############################################ |
| 89 |
# ------------------------------------------------------------ |
| 90 |
# Start server with old datadir with |
| 91 |
# table t1_compact having |
| 92 |
# c1 normal column |
| 93 |
# c2 INSTANT ADD column |
| 94 |
# |
| 95 |
# table t2_compact having |
| 96 |
# id, c1 normal columns |
| 97 |
# c2 INSTANT ADD column |
| 98 |
# ------------------------------------------------------------ |
| 99 |
SHOW CREATE TABLE t1_compact; |
| 100 |
Table Create Table |
| 101 |
t1_compact CREATE TABLE `t1_compact` ( |
| 102 |
`c1` longtext, |
| 103 |
`c2` int DEFAULT NULL |
| 104 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT |
| 105 |
BEGIN; |
| 106 |
UPDATE t1_compact SET c2 = 0; |
| 107 |
ROLLBACK; |
| 108 |
SELECT SUBSTRING(c1, 1000, 32) FROM t1_compact; |
| 109 |
SUBSTRING(c1, 1000, 32) |
| 110 |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 111 |
SHOW CREATE TABLE t2_compact; |
| 112 |
Table Create Table |
| 113 |
t2_compact CREATE TABLE `t2_compact` ( |
| 114 |
`id` int NOT NULL AUTO_INCREMENT, |
| 115 |
`c1` longtext, |
| 116 |
`c2` int DEFAULT NULL, |
| 117 |
PRIMARY KEY (`id`) |
| 118 |
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT |
| 119 |
BEGIN; |
| 120 |
UPDATE t2_compact SET c2 = 0; |
| 121 |
ROLLBACK; |
| 122 |
SELECT SUBSTRING(c1, 1000, 32) FROM t2_compact; |
| 123 |
SUBSTRING(c1, 1000, 32) |
| 124 |
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 125 |
########### |
| 126 |
# CLEANUP # |
| 127 |
########### |
| 128 |
# Shutdown server |
| 129 |
# Remove copied files |
| 130 |
# Restarting server to restore server state |
| 131 |
# restart |