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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
|
# test create 2 myisam tables with same name on
# different servers hence disable test for embedded
# which only runs on one
-- source include/not_embedded.inc
-- source include/have_multi_ndb.inc
-- disable_query_log
call mtr.add_suppression("Skipping locally defined table 'test.t1'");
-- enable_query_log
--disable_warnings
connection server2;
drop table if exists t1, t2, t3, t4;
flush status;
connection server1;
drop table if exists t1, t2, t3, t4;
flush status;
--enable_warnings
# Create test tables on server1
create table t1 (a int) engine=ndbcluster;
create table t2 (a int) engine=ndbcluster;
insert into t1 value (2);
insert into t2 value (3);
select * from t1;
select * from t2;
show status like 'handler_discover%';
# Check dropping and recreating table on same server
connect (con1,localhost,root,,test);
connect (con2,localhost,root,,test);
connection con1;
select * from t1;
connection con2;
drop table t1;
create table t1 (a int) engine=ndbcluster;
insert into t1 value (2);
connection con1;
select * from t1;
# Check dropping and recreating table on different server
connection server2;
show status like 'handler_discover%';
drop table t1;
create table t1 (a int) engine=ndbcluster;
insert into t1 value (2);
connection server1;
select * from t1;
select * from t1;
# Connect to server2 and use the tables from there
connection server2;
flush status;
select * from t1;
update t1 set a=3 where a=2;
show status like 'handler_discover%';
# Create a new table on server2
create table t3 (a int not null primary key, b varchar(22),
c int, last_col text) engine=ndb;
insert into t3 values(1, 'Hi!', 89, 'Longtext column');
create table t4 (pk int primary key, b int) engine=ndb;
# Check that the tables are accessible from server1
connection server1;
select * from t1;
select * from t3;
show tables like 't4';
show tables;
drop table t1, t2, t3, t4;
# bug#21378
connection server1;
create table t1(c1 int key)ENGINE=MyISAM;
insert into t1 values(1),(3),(5);
select * from t1 order by c1;
connection server2;
show tables;
create table t1(c1 int key)ENGINE=MyISAM;
insert into t1 values(100),(344),(533);
select * from t1 order by c1;
connection server1;
alter table t1 engine=ndb;
connection server2;
show tables;
select * from t1 order by c1;
drop table t1;
connection server1;
select * from t1 order by c1;
drop table t1;
# End of 4.1 tests
# Check distributed drop of database in 5.1
create database db;
use db;
create table t1(x int) engine=ndb;
connection server2;
use db;
show tables;
connection server1;
drop database db;
connection server2;
--error 1049
show tables;
connection server1;
# bug#21495
create database db;
use db;
create table t1(x int) engine=ndb;
connection server2;
use db;
create table t2(x int) engine=myisam;
show tables;
connection server1;
drop database db;
connection server2;
show tables;
drop database db;
# Bug#44529 Cannot drop database with stale temporary tables
connection server1;
create database db;
use db;
create table t1(x int) engine=ndb;
connection server2;
--let $MYSQLD_DATADIR= `SELECT @@datadir`
use db;
show tables;
--write_file $MYSQLD_DATADIR/db/#sql-1c17_25d0.ndb
EOF
connection server1;
drop database db;
connection server2;
--error ER_BAD_DB_ERROR
use db;
#
# bug#31470, ndb table with special characters in name
# are not discovered correctly
connection server1;
use test;
create table `test`.`t1$EX`
(server_id int unsigned,
master_server_id int unsigned,
master_epoch bigint unsigned,
count int unsigned,
primary key(server_id, master_server_id,
master_epoch, count))
engine ndb;
# check that table shows up ok on both servers
# before bugfix table would not show up on server2
--replace_regex /EX/ex/
show tables like '%$%';
connection server2;
use test;
--replace_regex /EX/ex/
show tables like '%$%';
# check cleanup
drop table `test`.`t1$EX`;
show tables like '%$%';
connection server1;
show tables like '%$%';
#
# Bug #42614 Mysql auto locate databases can overwrite frm data.
#
connection server1;
create table t1(s char(1)) engine = myisam;
insert into t1 values ("a"),("b"),("c");
connection server2;
create table t1(s char(1)) engine = ndb;
insert into t1 values ("d"),("e"),("f");
connection server1;
## Restart mysqld nodes
--echo Restarting mysqld
let $mysqld_name=mysqld.1.1;
--source include/restart_mysqld.inc
use test;
select * from t1 order by s;
connection server2;
select * from t1 order by s;
drop table t1;
connection server1;
select * from t1 order by s;
connection server2;
create table t1(s char(1)) engine = ndb;
insert into t1 values ("g"),("h"),("i");
connection server1;
show tables;
select * from t1 order by s;
#
# Clean-up
#
connection server1;
drop table t1;
connection server2;
drop table t1;
#
--echo Bug 11894966 - second mysqld does not have table after non
--echo distributed table alter to ndb
#
# - only queries with "autodiscover" see the new table
# on second mysqld since schema distribution does not
# create the table on second mysqld(at least when !ndb_binlog_running)
#
connection server1;
# Create table t1 in myisam
create table t1(a int) engine myisam;
insert into t1 values(37);
# Alter t1 into ndb
alter table t1 engine ndb;
# Switch to other mysqld
connection server2;
# Check that .frm and .ndb file has been created
# on second mysqld
let $datadir2 = `select @@datadir`;
#echo datadir2: $datadir2;
--file_exists $datadir2/test/t1.frm
--file_exists $datadir2/test/t1.ndb
# Check that truncate works on second mysqld
# (didn't work before fix)
truncate t1;
# Cleanup
drop table t1;
connection server1;
# 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 server2;
ALTER OFFLINE TABLE t1 ADD COLUMN c int;
connection server1;
select a from t1 where b = 2;
commit;
show tables;
drop table t1;
|