Debian Codegraph @

mysql-test/suite/ndb_ddl/alter_open_trans.test

raw
1 --source connect.inc
2
3 # Configure the first mysqld to not wait for lock so long during
4 # schema distribution.
5 connection mysqld1;
6 let $save_lock_wait_timeout = `select @@ndb_schema_dist_lock_wait_timeout`;
7 set @@global.ndb_schema_dist_lock_wait_timeout = 1;
8
9 # Supress warnings provoked by test
10 --disable_query_log
11 call mtr.add_suppression("Failed to acquire exclusive metadata lock");
12 call mtr.add_suppression("Failed to update table definition in DD");
13 call mtr.add_suppression("Distribution of ALTER TABLE");
14 --enable_query_log
15
16 # Trying to perform an alter on one mysqld
17 # while having open transaction on first mysqld
18
19 # bug#7798
20 create table t1(a int primary key, b int not null, index(b)) engine = ndb;
21 insert into t1 values (1,1), (2,2);
22 set autocommit=0;
23 begin;
24 select count(*) from t1;
25 connection mysqld2;
26 # Distribution of this alter should fail on mysqld1
27 # due to the ongoing transaction
28 replace_regex /Node [0-9]+:/Node <nodeid>/;
29 ALTER TABLE t1 algorithm=copy, ADD COLUMN c int;
30 connection mysqld1;
31 --error ER_TABLE_DEF_CHANGED
32 select a from t1 where b = 2;
33 show warnings;
34 show tables;
35 drop table t1;
36
37 #
38 # bug#XXX, from ndb_binlog_multi.test
39 #
40 create table t1 (
41 col0 int, col1 int, col2 int, col3 int,
42 col4 int, col5 int, col6 int, col7 int,
43 col8 int, col9 int, col10 int, col11 int,
44 col12 int, col13 int, col14 int, col15 int,
45 col16 int, col17 int, col18 int, col19 int,
46 col20 int, col21 int, col22 int, col23 int,
47 col24 int, col25 int, col26 int, col27 int,
48 col28 int, col29 int, col30 int, col31 int,
49 primary key(col0)) engine = ndb;
50
51 connection mysqld1;
52 begin;
53 insert into t1 (col0) values (1);
54
55 connection mysqld2;
56 # Distribution of this alter should fail on mysqld1
57 # due to the ongoing transaction
58 replace_regex /Node [0-9]+:/Node <nodeid>/;
59 alter table t1 algorithm=inplace, add column col32 int COLUMN_FORMAT DYNAMIC;
60
61 connection mysqld1;
62 --error ER_TABLE_DEF_CHANGED
63 select * from t1;
64 show warnings;
65 --error ER_TABLE_DEF_CHANGED
66 select * from t1;
67 drop table t1;
68
69 # Restore intial ndb_schema_dist_lock_wait_timeout value
70 --disable_query_log ONCE
71 eval set @@global.ndb_schema_dist_lock_wait_timeout = $save_lock_wait_timeout;