config root man

Current Path : /home/usr.opt/mysql57/mysql-test/suite/ndb/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/suite/ndb/t/ndb_multi.test

# The include statement below is a temp one for tests that are yet to
#be ported to run with InnoDB,
#but needs to be kept for tests that would need MyISAM in future.
--source include/force_myisam_default.inc

# 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 TABLE t1 algorithm=copy, ADD COLUMN c int;
connection server1;
select a from t1 where b = 2;
commit;
show tables;
drop table t1;

#
# The mysql.ndb_schema table should be not be visible in SHOW TABLES
# or I_S.TABLES
#
SHOW TABLES FROM mysql LIKE 'ndb_schema';
SELECT count(1) FROM INFORMATION_SCHEMA.TABLES
  WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'ndb_schema';

connection server1;
#
# Bug#14798043 DROP DATABASE PERFORMANCE_SCHEMA DROPS IT ON ALL SQL NODES
# Check that local tables in system database are not dropped remotely

create table mysql.dummy(a int primary key, b int) engine=myisam;
connection server2;
create table mysql.dummy(a int primary key, b int) engine=myisam;
connection server1;
drop table mysql.dummy;
connection server2;
show create table mysql.dummy;
drop table mysql.dummy;

#
#Bug #19550973: CREATE/DROP DATABASE STATEMENT SEGFAULTS IF IDENTIFIER LENGTH IS >=64
#
--connection server1
--echo #
--echo # Testing schema identifier with length 63
--echo # NDB's identifier length limit is 63
--echo #
CREATE DATABASE
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12;

--echo #create and drop NDB tables to test the database
CREATE TABLE 
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12.t1
(a int) 
ENGINE=NDB;
DROP TABLE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12.t1;
DROP DATABASE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12;

--echo #
--echo # Testing schema identifier with length 64
--echo # mysqld allows until 64, but ndb's limit is 63
--echo #
CREATE DATABASE
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;

--echo #verify database existence
USE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
--echo #create normal table
CREATE TABLE t1
(a int);
--echo #create ndb table and fail
--error ER_TOO_LONG_IDENT
CREATE TABLE t2
(a int)
ENGINE=NDB;
show warnings;

--echo #dbs with identifier length = 64 won't be replicated to other mysqlds 
--echo #verify the above created db is not present in the other mysqld
--connection server2
--error ER_BAD_DB_ERROR
USE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
--connection server1

--echo #testing alter database
ALTER DATABASE
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123
character set=utf8;

# Read current mysqld datadir to use for masking
let $MYSQLD_DATADIR= `select @@datadir`;

--echo #test alter table with this database
CREATE DATABASE db1;
CREATE TABLE db1.t1
(a int)
ENGINE=NDB;
--error ER_TOO_LONG_IDENT
ALTER TABLE db1.t1
RENAME abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123.t3;
#replace win slashes since not using default database
--replace_regex /[\\]/\// 
#remove any absolute path in warning string
--replace_result $MYSQLD_DATADIR ./ master-data/ '' 
SHOW WARNINGS;
--error ER_TOO_LONG_IDENT
ALTER TABLE db1.t1
RENAME db1.abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
#replace win slashes since not using default database
--replace_regex /[\\]/\// 
#remove any absolute path in warning string
--replace_result $MYSQLD_DATADIR ./ master-data/ '' 
SHOW WARNINGS;
DROP DATABASE db1;
DROP DATABASE
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;

--echo #checking database doesn't exists
--error ER_BAD_DB_ERROR
USE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;

--echo #
--echo # Testing schema identifier with length 65
--echo # mysqld rejects length of 65 and more
--echo #
--error ER_TOO_LONG_IDENT
CREATE DATABASE
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz1234;


#
# Bug#20480035 REMOVE MCP_BUG44529
#  - The mysqld participating in schema distribution
#    of DROP DATABASE failed to remove the database
#    when there was a .ndb file in the directory
#    which didn't have any corresponding table in NDB.
#  - Fix by adding an additional check for leftover .ndb
#    files in ndbcluster's DROP DATABASE implementation.
#

--echo #
--echo # 1. Check that DROP DATABASE removes leftover .ndb file
--echo #    in the database directory
--echo #
--connection server1
create database db;
use db;
create table t1(x int) engine=ndb;
create table t2(b int primary key) engine=ndb;
create table t3_default_engine(c int primary key);
--let $MYSQLD_DATADIR= `SELECT @@datadir`
# Write emtpy .ndb file with normal file name
--write_file $MYSQLD_DATADIR/db/t4.ndb
EOF
# Write emtpy .ndb file with temporary file name
--write_file $MYSQLD_DATADIR/db/#sql-1c17_25d0.ndb
EOF

drop database db;

--echo #
--echo # 2. Check that DROP DATABASE removes leftover .ndb file
--echo #    in the database directory on participating mysqld.
--echo #    This is the same testcase as BUG44529 with comments
--echo #
--echo # Create DATABASE and one table on first mysqld
--connection server1
create database db;
use db;
create table t1(x int) engine=ndb;

--echo # Show that DATABASE exist on the pariticipant(second mysqld)
--echo # and create a .ndb file without corresponding table in NDB
--connection server2
use db;
show tables;
--let $MYSQLD_DATADIR= `SELECT @@datadir`
--write_file $MYSQLD_DATADIR/db/#sql-1c17_25d0.ndb
EOF

--echo # Drop the DATABASE from first mysqld
--connection server1
drop database db;

--echo # Check that the pariticipant has dropped the DATABASE
--connection server2
--error ER_BAD_DB_ERROR
use db;

--connection server1

Man Man