polardbxengine/mysql-test/suite/ndb_ddl/alter_open_trans.test

71 lines
2.1 KiB
Plaintext

--source connect.inc
# Configure the first mysqld to not wait for lock so long during
# schema distribution.
connection mysqld1;
let $save_lock_wait_timeout = `select @@ndb_schema_dist_lock_wait_timeout`;
set @@global.ndb_schema_dist_lock_wait_timeout = 1;
# Supress warnings provoked by test
--disable_query_log
call mtr.add_suppression("Failed to acquire exclusive metadata lock");
call mtr.add_suppression("Failed to update table definition in DD");
call mtr.add_suppression("NDB: Distribution of ALTER TABLE");
--enable_query_log
# Trying to perform an alter on one mysqld
# while having open transaction on first mysqld
# bug#7798
create table t1(a int primary key, b int not null, index(b)) engine = ndb;
insert into t1 values (1,1), (2,2);
set autocommit=0;
begin;
select count(*) from t1;
connection mysqld2;
# Distribution of this alter should fail on mysqld1
# due to the ongoing transaction
replace_regex /Node [0-9]+:/Node <nodeid>/;
ALTER TABLE t1 algorithm=copy, ADD COLUMN c int;
connection mysqld1;
--error ER_TABLE_DEF_CHANGED
select a from t1 where b = 2;
show warnings;
show tables;
drop table t1;
#
# bug#XXX, from ndb_binlog_multi.test
#
create table t1 (
col0 int, col1 int, col2 int, col3 int,
col4 int, col5 int, col6 int, col7 int,
col8 int, col9 int, col10 int, col11 int,
col12 int, col13 int, col14 int, col15 int,
col16 int, col17 int, col18 int, col19 int,
col20 int, col21 int, col22 int, col23 int,
col24 int, col25 int, col26 int, col27 int,
col28 int, col29 int, col30 int, col31 int,
primary key(col0)) engine = ndb;
connection mysqld1;
begin;
insert into t1 (col0) values (1);
connection mysqld2;
# Distribution of this alter should fail on mysqld1
# due to the ongoing transaction
replace_regex /Node [0-9]+:/Node <nodeid>/;
alter table t1 algorithm=inplace, add column col32 int COLUMN_FORMAT DYNAMIC;
connection mysqld1;
--error ER_TABLE_DEF_CHANGED
select * from t1;
show warnings;
select * from t1;
drop table t1;
# Restore intial ndb_schema_dist_lock_wait_timeout value
--disable_query_log ONCE
eval set @@global.ndb_schema_dist_lock_wait_timeout = $save_lock_wait_timeout;