File: instant_ddl_recovery.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (86 lines) | stat: -rw-r--r-- 2,630 bytes parent folder | download
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
##########################################################################
# Test script to test RECOVERY for table having INSTANT
# ADD/DROP columns.
#
# $row_format is to be set to the row_format on which test is to be run.
##########################################################################

--echo # ------------------------------------------------------------
--echo # Create a table with 3 columns. [id, c1, c2]
--echo # ------------------------------------------------------------
--eval CREATE TABLE t1(id INT PRIMARY KEY, c1 CHAR(10), c2 CHAR(10)) ROW_FORMAT=$row_format;
--let $table_name=t1
--source suite/innodb/include/print_instant_metadata.inc

INSERT INTO t1 VALUES (1, "r1c1", "r1c2");
SELECT * FROM t1;

--echo # INSTANT ADD a column
Alter table t1 add column c3 char(10), algorithm=instant;
--let $table_name=t1
--source suite/innodb/include/print_instant_metadata.inc
INSERT INTO t1 VALUES (2, "r2c1", "r2c2", "r2c3");
SELECT * FROM t1;

--echo # INSTANT DROP a column
Alter table t1 drop column c2 , algorithm=instant;
--let $table_name=t1
--source suite/innodb/include/print_instant_metadata.inc
INSERT INTO t1 VALUES (3, "r3c1", "r3c3");
SELECT * FROM t1;

--echo # Make sure nothing gets flushed on disk
SET GLOBAL innodb_log_checkpoint_now = ON;
SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
SET GLOBAL innodb_dict_stats_disabled_debug = 1;
SET GLOBAL innodb_master_thread_disabled_debug = 1;

--echo # Make inplace update
UPDATE t1 SET c1="r0c0";

--echo # Make not-inplace update
UPDATE t1 SET c3="r1c3" WHERE id=1;

--echo # Insert a new record
INSERT INTO t1 VALUES (4, "r4c1", "r4c3");

--echo # Delete a record
DELETE FROM t1 WHERE id=2;

# kill and restart the server
--source include/kill_and_restart_mysqld.inc

#restart the server

--let $table_name=t1
--source suite/innodb/include/print_instant_metadata.inc

SELECT * FROM t1;

--echo ###########
--echo # CLEANUP #
--echo ###########
DROP TABLE t1;

#
# Bug#35183686 ALTER_STORED_COLUMN_ORDER with algorithm=INSTANT makes wrong INSERT REDO log
#
--eval CREATE TABLE t1 (`c` text, `b` blob NOT NULL, `nc03242` longblob, `d` int DEFAULT NULL, UNIQUE KEY `b` (`b`(99))) ENGINE=InnoDB ROW_FORMAT=$row_format

alter table t1
  change c c text after d,
  add column nc05984 bool,
algorithm=instant;

SET GLOBAL innodb_log_checkpoint_now = ON;
SET GLOBAL innodb_page_cleaner_disabled_debug = 1;
SET GLOBAL innodb_dict_stats_disabled_debug = 1;
SET GLOBAL innodb_master_thread_disabled_debug = 1;

INSERT INTO t1 SET b='ulccclraaacaucrouorouoooolrlo', d=6;

--source include/kill_and_restart_mysqld.inc

SELECT * FROM t1;

DROP TABLE t1;