summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/innodb-index-online-norebuild.test
blob: 518b4efe1df04491bf4bc690344922d3d8836f29 (plain)
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
--source include/have_innodb.inc

--echo # INPLACE ALTER WITH INPLACE_IGNORE FLAG AND CHANGE CREATE OPTION

--echo # CHANGE THE COLUMN DEFAULT (INPLACE_IGNORE)
--echo # AND TABLE CHARSET(CHANGE CREATE)

CREATE TABLE t1(
	id INT PRIMARY KEY,
	f1 INT NOT NULL DEFAULT 0)ENGINE=INNODB;

INSERT INTO t1 VALUES(1, 2);

let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;

# Allow the following operation to report errors.
SET SQL_MODE='STRICT_ALL_TABLES';
ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL DEFAULT 0,
	       DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;

let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;

if ($id_before_alter != $id_after_alter)
{
  --echo "Table rebuild happened";
}

DROP TABLE t1;

--echo # CHANGE THE COMMENT OF COLUMN(INPLACE IGNORE)
--echo # AND TABLE CHARSET(CHANGE CREATE)

CREATE TABLE t1(id INT COMMENT 'independence day')ENGINE=INNODB;

INSERT INTO t1 values(1);

let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;

ALTER TABLE t1 MODIFY COLUMN id INT COMMENT 'identifier',
	       DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;

let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;

if ($id_before_alter != $id_after_alter)
{
  --echo "Table rebuild happened";
}

DROP TABLE t1;

--echo # RENAME THE TABLE(INPLACE IGNORE)
--echo # AND CHANGE TABLE CHARSET(CHANGE CREATE)

CREATE TABLE t1(
	f1 INT NOT NULL,
	f2 INT NOT NULL)ENGINE=INNODB;

INSERT INTO t1 VALUES(1, 2);

let id_before_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t1"`;

ALTER TABLE t1 RENAME t2, DEFAULT CHARSET=latin1, ALGORITHM=INPLACE;

let id_after_alter =`SELECT table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE name="test/t2"`;

if ($id_before_alter != $id_after_alter)
{
  --echo "Table rebuild happened";
}

DROP TABLE t2;