| 1 |
########################################################################## |
| 2 |
# Test script to test UPGRADE from older version table (not) having |
| 3 |
# INSTANT ADD columns. |
| 4 |
# |
| 5 |
# $row_format is to be set to the row_format on which test is to be run. |
| 6 |
########################################################################## |
| 7 |
|
| 8 |
--echo # ------------------------------------------------------------ |
| 9 |
--echo # Start server with old datadir with |
| 10 |
--echo # table t1_$row_format having |
| 11 |
--echo # c1, c2 normal columns |
| 12 |
--echo # c3 INSTANT ADD column with default def_c3. |
| 13 |
--echo # c4 INSTANT ADD column with default def_c4. |
| 14 |
--echo # +------+------+--------+--------+ |
| 15 |
--echo # | c1 | c2 | c3 | c4 | |
| 16 |
--echo # +------+------+--------+--------+ |
| 17 |
--echo # | r1c1 | r1c2 | c3_def | c4_def | |
| 18 |
--echo # | r2c1 | r2c2 | r2c3 | c4_def | |
| 19 |
--echo # | r3c1 | r3c2 | r3c3 | r3c4 | |
| 20 |
--echo # +------+------+--------+--------+ |
| 21 |
--echo # |
| 22 |
--echo # table t2_$row_format having |
| 23 |
--echo # c1, c2 normal columns |
| 24 |
--echo # c3 INSTANT ADD column with default def_c3. |
| 25 |
--echo # +------+------+--------+ |
| 26 |
--echo # | c1 | c2 | c3 | |
| 27 |
--echo # +------+------+--------+ |
| 28 |
--echo # | r1c1 | r1c2 | c3_def | |
| 29 |
--echo # | r2c1 | r2c2 | r2c3 | |
| 30 |
--echo # +------+------+--------+ |
| 31 |
--echo # ------------------------------------------------------------ |
| 32 |
|
| 33 |
eval SHOW CREATE TABLE t1_$row_format; |
| 34 |
|
| 35 |
--echo # ------------------------------------------------------------ |
| 36 |
--echo # Read rows from upgraded table t1_$row_format |
| 37 |
--echo # ------------------------------------------------------------ |
| 38 |
--let $table_name=t1_$row_format |
| 39 |
--source suite/innodb/include/print_instant_metadata.inc |
| 40 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 41 |
|
| 42 |
--echo # ------------------------------------------------------------ |
| 43 |
--echo # Insert a row in upgraded table t1_$row_format |
| 44 |
--echo # ------------------------------------------------------------ |
| 45 |
eval INSERT INTO t1_$row_format values ("r4c1", "r4c2", "r4c3", "r4c4"); |
| 46 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 47 |
|
| 48 |
--echo # ------------------------------------------------------------ |
| 49 |
--echo # UPDATE : IN PLACE for row with no version |
| 50 |
--echo # ------------------------------------------------------------ |
| 51 |
eval UPDATE t1_$row_format SET c2="temp" where c1="r1c1"; |
| 52 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 53 |
|
| 54 |
--echo # ------------------------------------------------------------ |
| 55 |
--echo # UPDATE : IN PLACE for row with V1 |
| 56 |
--echo # ------------------------------------------------------------ |
| 57 |
eval UPDATE t1_$row_format SET c2="temp" where c1="r2c1"; |
| 58 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 59 |
|
| 60 |
--echo # ------------------------------------------------------------ |
| 61 |
--echo # UPDATE : NOT IN PLACE for row with no version |
| 62 |
--echo # ------------------------------------------------------------ |
| 63 |
eval UPDATE t1_$row_format SET c3="r1c3" where c1="r1c1"; |
| 64 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 65 |
|
| 66 |
--echo # ------------------------------------------------------------ |
| 67 |
--echo # UPDATE : NOT IN PLACE for row with V1 |
| 68 |
--echo # ------------------------------------------------------------ |
| 69 |
eval UPDATE t1_$row_format SET c4="r2c4" where c1="r2c1"; |
| 70 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 71 |
|
| 72 |
--echo # ------------------------------------------------------------ |
| 73 |
--echo # INSTANT DROP c2 |
| 74 |
--echo # ------------------------------------------------------------ |
| 75 |
eval ALTER TABLE t1_$row_format DROP COLUMN c2, ALGORITHM=INSTANT; |
| 76 |
--let $table_name=t1_$row_format |
| 77 |
--source suite/innodb/include/print_instant_metadata.inc |
| 78 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 79 |
eval INSERT INTO t1_$row_format values ("r5c1", "r5c3", "r5c4"); |
| 80 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 81 |
|
| 82 |
--echo # ------------------------------------------------------------ |
| 83 |
--echo # INSTANT ADD c5 at the end |
| 84 |
--echo # ------------------------------------------------------------ |
| 85 |
eval ALTER TABLE t1_$row_format ADD COLUMN c5 char(10) default "c5_def", ALGORITHM=INSTANT; |
| 86 |
--let $table_name=t1_$row_format |
| 87 |
--source suite/innodb/include/print_instant_metadata.inc |
| 88 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 89 |
eval INSERT INTO t1_$row_format values ("r6c1", "r6c3", "r6c4", "r6c5"); |
| 90 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 91 |
|
| 92 |
--echo # ------------------------------------------------------------ |
| 93 |
--echo # INSTANT ADD c6 somewhere in between |
| 94 |
--echo # ------------------------------------------------------------ |
| 95 |
eval ALTER TABLE t1_$row_format ADD COLUMN c6 char(10) default "c6_def" after c1, ALGORITHM=INSTANT; |
| 96 |
--let $table_name=t1_$row_format |
| 97 |
--source suite/innodb/include/print_instant_metadata.inc |
| 98 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 99 |
eval INSERT INTO t1_$row_format values ("r7c1", "r7c6", "r7c3", "r7c4", "r7c5"); |
| 100 |
eval SELECT * FROM t1_$row_format ORDER BY c1; |
| 101 |
|
| 102 |
eval DROP TABLE t1_$row_format; |
| 103 |
|
| 104 |
if ($is_debug) |
| 105 |
{ |
| 106 |
--echo # ------------------------------------------------------------ |
| 107 |
--echo # TEMP record with different possibilities |
| 108 |
--echo # ------------------------------------------------------------ |
| 109 |
--source include/count_sessions.inc |
| 110 |
|
| 111 |
eval show create table t2_$row_format; |
| 112 |
|
| 113 |
eval Select * from t2_$row_format; |
| 114 |
eval Insert into t2_$row_format values ("r3c1", "r3c2", "r3c3"); |
| 115 |
eval Select * from t2_$row_format; |
| 116 |
eval Alter table t2_$row_format add column c4 char(10) default "c4_def" first, algorithm=INSTANT; |
| 117 |
eval Insert into t2_$row_format values ("r4c4", "r4c1", "r4c2", "r4c3"); |
| 118 |
eval Select * from t2_$row_format; |
| 119 |
|
| 120 |
--echo # Make alter table wait |
| 121 |
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL s1 WAIT_FOR s2'; |
| 122 |
|
| 123 |
--echo # Rebuild the table |
| 124 |
--send_eval ALTER TABLE t2_$row_format force, algorithm=inplace; |
| 125 |
|
| 126 |
connect (con1,localhost,root,,); |
| 127 |
--echo # connection con1 |
| 128 |
connection con1; |
| 129 |
|
| 130 |
SET DEBUG_SYNC = 'now WAIT_FOR s1'; |
| 131 |
|
| 132 |
--echo # Update query |
| 133 |
eval UPDATE t2_$row_format SET c1="c1_upd"; |
| 134 |
|
| 135 |
--echo # Let Alter table continue |
| 136 |
SET DEBUG_SYNC = 'now SIGNAL s2'; |
| 137 |
|
| 138 |
--echo # connection default |
| 139 |
connection default; |
| 140 |
--reap |
| 141 |
|
| 142 |
eval SELECT * FROM t2_$row_format; |
| 143 |
|
| 144 |
DISCONNECT con1; |
| 145 |
|
| 146 |
# Wait till all disconnects are completed |
| 147 |
--source include/wait_until_count_sessions.inc |
| 148 |
|
| 149 |
eval DROP TABLE t2_$row_format; |
| 150 |
} |