Debian Codegraph @

mysql-test/suite/ndb_ddl/alter_allow_copying.test

raw
1 --source setup.inc
2
3 # Test that it's possible to turn off copying ALTER TABLE by
4 # setting ndb_allow_copying_alter_table = 0. This means that
5 # only queries which automatically are performed inplace or were
6 # user explicitly requested ALGORITHM=COPY will
7 # be allowed
8 #
9
10 # Check the default value of ndb_allow_copying_alter_table
11 select @@ndb_allow_copying_alter_table;
12
13 #
14 # 1) Query fails since implicit copying alter is not allowed
15 #
16 set @@ndb_allow_copying_alter_table = 0;
17 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
18 ALTER TABLE t1
19 modify column b varchar(255);
20 SHOW WARNINGS LIMIT 2;
21
22 #
23 # 1b) Query fails since implicit copying alter is not allowed
24 # - reason explaining that table with hidden primary key
25 # does not support inplace alter table
26 #
27 set @@ndb_allow_copying_alter_table = 0;
28 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
29 ALTER TABLE t8 ADD COLUMN VALUE_NEW VARCHAR(25) DEFAULT NULL;
30 SHOW WARNINGS LIMIT 2;
31
32 #
33 # 2) Query is allowed since user explicitly requested ALGORITHM=COPY
34 # and that overrides ndb_allow_copying_alter_table=0
35 #
36 set @@ndb_allow_copying_alter_table = 0;
37 ALTER TABLE t1
38 ALGORITHM=COPY,
39 modify column b varchar(255);
40
41 # Set variable back to default and check
42 set @@ndb_allow_copying_alter_table = default;
43 select @@ndb_allow_copying_alter_table;
44
45
46
47 #
48 # Check combination with ndb_use_copying_alter_table, which
49 # forces usage of copying alter table unless ALGORITHM=INPLACE
50 # has been specified
51 #
52 set @@ndb_allow_copying_alter_table = 0;
53 set @@ndb_use_copying_alter_table = 1;
54
55 # Implicit inplace alter, use_copying -> error because of allow_copying
56 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
57 ALTER TABLE t1
58 add column c int;
59
60 # Implicit copying alter, use_copying -> error because of allow_copying
61 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
62 ALTER TABLE t1
63 modify column b varchar(255);
64
65 # Explicit inplace alter, allowed
66 ALTER TABLE t1
67 ALGORITHM=INPLACE,
68 add column c int COLUMN_FORMAT DYNAMIC;
69
70 # Explicit copying alter, works as it overrides ndb_allow_copying_alter_table
71 ALTER TABLE t1
72 ALGORITHM=COPY,
73 add column d int;
74
75 set @@ndb_use_copying_alter_table = default;
76 set @@ndb_allow_copying_alter_table = default;
77
78 --source verify_mysql_dd.inc
79
80 --source cleanup.inc
81
82