345 lines
8.8 KiB
Plaintext
345 lines
8.8 KiB
Plaintext
drop table if exists t1, t2, t3, t4;
|
|
flush status;
|
|
drop table if exists t1, t2, t3, t4;
|
|
flush status;
|
|
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;
|
|
a
|
|
2
|
|
select * from t2;
|
|
a
|
|
3
|
|
show status like 'handler_discover%';
|
|
Variable_name Value
|
|
Handler_discover 0
|
|
select * from t1;
|
|
a
|
|
2
|
|
drop table t1;
|
|
create table t1 (a int) engine=ndbcluster;
|
|
insert into t1 value (2);
|
|
select * from t1;
|
|
a
|
|
2
|
|
show status like 'handler_discover%';
|
|
Variable_name Value
|
|
Handler_discover 0
|
|
drop table t1;
|
|
create table t1 (a int) engine=ndbcluster;
|
|
insert into t1 value (2);
|
|
select * from t1;
|
|
a
|
|
2
|
|
select * from t1;
|
|
a
|
|
2
|
|
flush status;
|
|
select * from t1;
|
|
a
|
|
2
|
|
update t1 set a=3 where a=2;
|
|
show status like 'handler_discover%';
|
|
Variable_name Value
|
|
Handler_discover 0
|
|
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;
|
|
select * from t1;
|
|
a
|
|
3
|
|
select * from t3;
|
|
a b c last_col
|
|
1 Hi! 89 Longtext column
|
|
show tables like 't4';
|
|
Tables_in_test (t4)
|
|
t4
|
|
show tables;
|
|
Tables_in_test
|
|
t1
|
|
t2
|
|
t3
|
|
t4
|
|
drop table t1, t2, t3, t4;
|
|
create table t1(c1 int key)ENGINE=MyISAM;
|
|
insert into t1 values(1),(3),(5);
|
|
select * from t1 order by c1;
|
|
c1
|
|
1
|
|
3
|
|
5
|
|
show tables;
|
|
Tables_in_test
|
|
create table t1(c1 int key)ENGINE=MyISAM;
|
|
insert into t1 values(100),(344),(533);
|
|
select * from t1 order by c1;
|
|
c1
|
|
100
|
|
344
|
|
533
|
|
alter table t1 engine=ndb;
|
|
show tables;
|
|
Tables_in_test
|
|
t1
|
|
Warnings:
|
|
Warning 1050 Local table test.t1 shadows ndb table
|
|
select * from t1 order by c1;
|
|
c1
|
|
100
|
|
344
|
|
533
|
|
drop table t1;
|
|
select * from t1 order by c1;
|
|
c1
|
|
1
|
|
3
|
|
5
|
|
drop table t1;
|
|
create database db;
|
|
use db;
|
|
create table t1(x int) engine=ndb;
|
|
use db;
|
|
show tables;
|
|
Tables_in_db
|
|
t1
|
|
drop database db;
|
|
show tables;
|
|
ERROR 42000: Unknown database 'db'
|
|
create database db;
|
|
use db;
|
|
create table t1(x int) engine=ndb;
|
|
use db;
|
|
create table t2(x int) engine=myisam;
|
|
show tables;
|
|
Tables_in_db
|
|
t1
|
|
t2
|
|
drop database db;
|
|
show tables;
|
|
Tables_in_db
|
|
t2
|
|
drop database db;
|
|
create database db;
|
|
use db;
|
|
create table t1(x int) engine=ndb;
|
|
use db;
|
|
show tables;
|
|
Tables_in_db
|
|
t1
|
|
drop database db;
|
|
use db;
|
|
ERROR 42000: Unknown database 'db'
|
|
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;
|
|
show tables like '%$%';
|
|
Tables_in_test (%$%)
|
|
t1$ex
|
|
use test;
|
|
show tables like '%$%';
|
|
Tables_in_test (%$%)
|
|
t1$ex
|
|
drop table `test`.`t1$EX`;
|
|
show tables like '%$%';
|
|
Tables_in_test (%$%)
|
|
show tables like '%$%';
|
|
Tables_in_test (%$%)
|
|
create table t1(s char(1)) engine = myisam;
|
|
insert into t1 values ("a"),("b"),("c");
|
|
create table t1(s char(1)) engine = ndb;
|
|
insert into t1 values ("d"),("e"),("f");
|
|
Restarting mysqld
|
|
# restart
|
|
use test;
|
|
select * from t1 order by s;
|
|
s
|
|
a
|
|
b
|
|
c
|
|
select * from t1 order by s;
|
|
s
|
|
d
|
|
e
|
|
f
|
|
drop table t1;
|
|
select * from t1 order by s;
|
|
s
|
|
a
|
|
b
|
|
c
|
|
create table t1(s char(1)) engine = ndb;
|
|
insert into t1 values ("g"),("h"),("i");
|
|
show tables;
|
|
Tables_in_test
|
|
t1
|
|
Warnings:
|
|
Warning 1050 Local table test.t1 shadows ndb table
|
|
select * from t1 order by s;
|
|
s
|
|
a
|
|
b
|
|
c
|
|
drop table t1;
|
|
drop table t1;
|
|
Bug 11894966 - second mysqld does not have table after non
|
|
distributed table alter to ndb
|
|
create table t1(a int) engine myisam;
|
|
insert into t1 values(37);
|
|
alter table t1 engine ndb;
|
|
truncate t1;
|
|
drop table t1;
|
|
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;
|
|
count(*)
|
|
2
|
|
ALTER TABLE t1 algorithm=copy, ADD COLUMN c int;
|
|
select a from t1 where b = 2;
|
|
a
|
|
2
|
|
commit;
|
|
show tables;
|
|
Tables_in_test
|
|
t1
|
|
drop table t1;
|
|
SHOW TABLES FROM mysql LIKE 'ndb_schema';
|
|
Tables_in_mysql (ndb_schema)
|
|
SELECT count(1) FROM INFORMATION_SCHEMA.TABLES
|
|
WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'ndb_schema';
|
|
count(1)
|
|
0
|
|
create table mysql.dummy(a int primary key, b int) engine=myisam;
|
|
create table mysql.dummy(a int primary key, b int) engine=myisam;
|
|
drop table mysql.dummy;
|
|
show create table mysql.dummy;
|
|
Table Create Table
|
|
dummy CREATE TABLE `dummy` (
|
|
`a` int(11) NOT NULL,
|
|
`b` int(11) DEFAULT NULL,
|
|
PRIMARY KEY (`a`)
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
drop table mysql.dummy;
|
|
#
|
|
# Testing schema identifier with length 63
|
|
# NDB's identifier length limit is 63
|
|
#
|
|
CREATE DATABASE
|
|
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12;
|
|
#create and drop NDB tables to test the database
|
|
CREATE TABLE
|
|
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12.t1
|
|
(a int)
|
|
ENGINE=NDB;
|
|
DROP TABLE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12.t1;
|
|
DROP DATABASE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz12;
|
|
#
|
|
# Testing schema identifier with length 64
|
|
# mysqld allows until 64, but ndb's limit is 63
|
|
#
|
|
CREATE DATABASE
|
|
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
|
|
Warnings:
|
|
Warning 1059 Ndb has an internal limit of 63 bytes on the size of schema identifiers
|
|
#verify database existence
|
|
USE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
|
|
#create normal table
|
|
CREATE TABLE t1
|
|
(a int);
|
|
#create ndb table and fail
|
|
CREATE TABLE t2
|
|
(a int)
|
|
ENGINE=NDB;
|
|
ERROR 42000: Identifier name 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123' is too long
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 1059 Ndb has an internal limit of 63 bytes on the size of schema identifiers
|
|
Error 1059 Identifier name 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123' is too long
|
|
Error 1031 Table storage engine for 't2' doesn't have this option
|
|
#dbs with identifier length = 64 won't be replicated to other mysqlds
|
|
#verify the above created db is not present in the other mysqld
|
|
USE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
|
|
ERROR 42000: Unknown database 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123'
|
|
#testing alter database
|
|
ALTER DATABASE
|
|
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123
|
|
character set=utf8;
|
|
Warnings:
|
|
Warning 1059 Ndb has an internal limit of 63 bytes on the size of schema identifiers
|
|
#test alter table with this database
|
|
CREATE DATABASE db1;
|
|
CREATE TABLE db1.t1
|
|
(a int)
|
|
ENGINE=NDB;
|
|
ALTER TABLE db1.t1
|
|
RENAME abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123.t3;
|
|
ERROR 42000: Identifier name 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123' is too long
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1059 Ndb has an internal limit of 63 bytes on the size of schema identifiers
|
|
Error 1059 Identifier name 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123' is too long
|
|
Error 1025 Error on rename of './db1/t1' to './abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123/t3' (errno: 140 - Wrong create options)
|
|
ALTER TABLE db1.t1
|
|
RENAME db1.abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
|
|
ERROR 42000: Identifier name 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123' is too long
|
|
SHOW WARNINGS;
|
|
Level Code Message
|
|
Warning 1059 Ndb has an internal limit of 63 bytes on the size of schema identifiers
|
|
Error 1059 Identifier name 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123' is too long
|
|
Error 1025 Error on rename of './db1/t1' to './db1/abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123' (errno: 140 - Wrong create options)
|
|
DROP DATABASE db1;
|
|
DROP DATABASE
|
|
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
|
|
Warnings:
|
|
Warning 1059 Ndb has an internal limit of 63 bytes on the size of schema identifiers
|
|
#checking database doesn't exists
|
|
USE abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123;
|
|
ERROR 42000: Unknown database 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz123'
|
|
#
|
|
# Testing schema identifier with length 65
|
|
# mysqld rejects length of 65 and more
|
|
#
|
|
CREATE DATABASE
|
|
abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz1234;
|
|
ERROR 42000: Identifier name 'abcdefghijklmnopqrstuvwxyz1234567890bcdefghijklmnopqrstuvwxyz1234' is too long
|
|
#
|
|
# 1. Check that DROP DATABASE removes leftover .ndb file
|
|
# in the database directory
|
|
#
|
|
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);
|
|
drop database db;
|
|
#
|
|
# 2. Check that DROP DATABASE removes leftover .ndb file
|
|
# in the database directory on participating mysqld.
|
|
# This is the same testcase as BUG44529 with comments
|
|
#
|
|
# Create DATABASE and one table on first mysqld
|
|
create database db;
|
|
use db;
|
|
create table t1(x int) engine=ndb;
|
|
# Show that DATABASE exist on the pariticipant(second mysqld)
|
|
# and create a .ndb file without corresponding table in NDB
|
|
use db;
|
|
show tables;
|
|
Tables_in_db
|
|
t1
|
|
# Drop the DATABASE from first mysqld
|
|
drop database db;
|
|
# Check that the pariticipant has dropped the DATABASE
|
|
use db;
|
|
ERROR 42000: Unknown database 'db'
|