2004-05-17 09:53:13 +02:00
|
|
|
-- source include/have_ndb.inc
|
2005-04-19 17:23:49 +02:00
|
|
|
-- source include/not_embedded.inc
|
2004-05-17 09:53:13 +02:00
|
|
|
|
|
|
|
--disable_warnings
|
2004-11-08 11:06:36 +01:00
|
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
|
2004-05-17 09:53:13 +02:00
|
|
|
--enable_warnings
|
|
|
|
|
|
|
|
################################################
|
|
|
|
# Test that a table that does not exist as a
|
|
|
|
# frm file on disk can be "discovered" from a
|
|
|
|
# connected NDB Cluster
|
|
|
|
#
|
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test discover + SELECT
|
|
|
|
#
|
|
|
|
|
|
|
|
create table t1(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(20)
|
|
|
|
) engine=ndb;
|
|
|
|
|
|
|
|
insert into t1 values(1, "Autodiscover");
|
|
|
|
flush tables;
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
|
2004-05-17 09:53:13 +02:00
|
|
|
select * from t1;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test discover + INSERT
|
|
|
|
#
|
|
|
|
|
|
|
|
flush tables;
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
|
2004-05-17 09:53:13 +02:00
|
|
|
insert into t1 values (2, "Auto 2");
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
insert into t1 values (3, "Discover 3");
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
flush tables;
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
|
2004-05-26 14:22:49 +02:00
|
|
|
select * from t1 order by id;
|
2004-05-17 09:53:13 +02:00
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test discover + UPDATE
|
|
|
|
#
|
|
|
|
|
|
|
|
flush tables;
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
|
2004-05-17 09:53:13 +02:00
|
|
|
update t1 set name="Autodiscover" where id = 2;
|
|
|
|
show status like 'handler_discover%';
|
2004-08-27 14:15:47 +02:00
|
|
|
select * from t1 order by id;
|
2004-05-17 09:53:13 +02:00
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test discover + DELETE
|
|
|
|
#
|
|
|
|
|
|
|
|
flush tables;
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
|
2004-05-17 09:53:13 +02:00
|
|
|
delete from t1 where id = 3;
|
2004-05-26 14:34:40 +02:00
|
|
|
select * from t1 order by id;
|
2004-05-17 09:53:13 +02:00
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######################################################
|
|
|
|
# Test that a table that is outdated on disk
|
|
|
|
# can be "discovered" from a connected NDB Cluster
|
|
|
|
#
|
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
create table t2(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(22)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t2 values (1, "Discoverer");
|
|
|
|
select * from t2;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
flush tables;
|
|
|
|
|
|
|
|
# Modify the frm file on disk
|
2006-01-24 08:30:54 +01:00
|
|
|
system echo "blaj" >> $MYSQLTEST_VARDIR/master-data/test/t2.frm ;
|
2004-05-17 09:53:13 +02:00
|
|
|
select * from t2;
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t2;
|
|
|
|
|
|
|
|
|
|
|
|
##################################################
|
|
|
|
# Test that a table that already exists in NDB
|
|
|
|
# is only discovered if CREATE TABLE IF NOT EXISTS
|
|
|
|
# is used
|
|
|
|
#
|
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
create table t3(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(255)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t3 values (1, "Explorer");
|
|
|
|
select * from t3;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
flush tables;
|
|
|
|
|
|
|
|
# Remove the frm file from disk
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm ;
|
2004-05-17 09:53:13 +02:00
|
|
|
|
|
|
|
--error 1050
|
|
|
|
create table t3(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(20), a int, b float, c char(24)
|
|
|
|
) engine=ndb;
|
|
|
|
|
|
|
|
# The table shall not have been discovered since
|
|
|
|
# IF NOT EXISTS wasn't specified
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
# now it should be discovered
|
|
|
|
create table IF NOT EXISTS t3(
|
|
|
|
id int not null primary key,
|
|
|
|
id2 int not null,
|
|
|
|
name char(20)
|
|
|
|
) engine=ndb;
|
|
|
|
|
|
|
|
# NOTE! the table called t3 have now been updated to
|
|
|
|
# use the same frm as in NDB, thus it's not certain that
|
|
|
|
# the table schema is the same as was stated in the
|
|
|
|
# CREATE TABLE statement above
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
SHOW CREATE TABLE t3;
|
|
|
|
|
|
|
|
select * from t3;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t3;
|
|
|
|
|
2004-09-13 14:46:38 +02:00
|
|
|
##################################################
|
|
|
|
# Test that a table that already exists in NDB
|
|
|
|
# is discovered when SHOW TABLES
|
|
|
|
# is used
|
2004-05-17 09:53:13 +02:00
|
|
|
#
|
|
|
|
|
2004-09-13 14:46:38 +02:00
|
|
|
flush status;
|
|
|
|
|
|
|
|
create table t7(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(255)
|
|
|
|
) engine=ndb;
|
|
|
|
create table t6(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(255)
|
|
|
|
) engine=MyISAM;
|
|
|
|
insert into t7 values (1, "Explorer");
|
|
|
|
insert into t6 values (2, "MyISAM table");
|
|
|
|
select * from t7;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
# Remove the frm file from disk
|
|
|
|
flush tables;
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
|
2004-09-13 14:46:38 +02:00
|
|
|
|
|
|
|
show tables from test;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
# Remove the frm file from disk again
|
|
|
|
flush tables;
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
|
2004-09-13 14:46:38 +02:00
|
|
|
|
2005-01-26 15:07:39 +01:00
|
|
|
--replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 #
|
2004-09-13 14:46:38 +02:00
|
|
|
show table status;
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t6, t7;
|
|
|
|
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# Test that a table that has been dropped from NDB
|
|
|
|
# but still exists on disk, get a consistent error message
|
|
|
|
# saying "No such table existed"
|
2004-05-26 14:22:49 +02:00
|
|
|
#
|
2004-09-13 14:46:38 +02:00
|
|
|
|
2004-09-30 14:20:14 +02:00
|
|
|
flush status;
|
|
|
|
|
|
|
|
create table t4(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(27)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t4 values (1, "Automatic");
|
|
|
|
select * from t4;
|
2004-09-13 14:46:38 +02:00
|
|
|
|
2004-05-17 09:53:13 +02:00
|
|
|
# Remove the table from NDB
|
2005-02-01 17:08:39 +01:00
|
|
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
|
2004-09-13 14:46:38 +02:00
|
|
|
|
2004-09-21 12:13:58 +02:00
|
|
|
#
|
2004-09-13 14:46:38 +02:00
|
|
|
# Test that correct error is returned
|
2004-09-30 14:20:14 +02:00
|
|
|
--error 1146
|
|
|
|
select * from t4;
|
|
|
|
--error 1146
|
|
|
|
select * from t4;
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
2005-02-17 14:22:44 +01:00
|
|
|
--error 1051
|
2004-09-30 14:20:14 +02:00
|
|
|
drop table t4;
|
2004-09-13 14:46:38 +02:00
|
|
|
|
2005-02-17 14:22:44 +01:00
|
|
|
create table t4(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(27)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t4 values (1, "Automatic");
|
|
|
|
select * from t4;
|
|
|
|
|
|
|
|
# Remove the table from NDB
|
|
|
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
|
|
|
|
|
|
|
|
--error 1146
|
|
|
|
select * from t4;
|
|
|
|
|
|
|
|
drop table if exists t4;
|
|
|
|
|
|
|
|
# Test that dropping a table that does not exists
|
|
|
|
# on disk or in NDB gives same result as above
|
|
|
|
--error 1051
|
|
|
|
drop table t5;
|
|
|
|
drop table if exists t5;
|
|
|
|
|
2004-05-17 09:53:13 +02:00
|
|
|
|
2004-09-26 16:11:24 +02:00
|
|
|
#######################################################
|
|
|
|
# Test that a table that has been dropped from NDB
|
|
|
|
# but still exists on disk is deleted from disk
|
|
|
|
# when SHOW TABLES is called
|
|
|
|
#
|
2004-09-30 14:20:14 +02:00
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
create table t4(
|
|
|
|
id int not null primary key,
|
|
|
|
id2 int,
|
|
|
|
name char(27)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t4 values (1, 76, "Automatic2");
|
|
|
|
select * from t4;
|
|
|
|
flush tables;
|
|
|
|
|
|
|
|
# Remove the table from NDB
|
2005-02-01 17:08:39 +01:00
|
|
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t4 >> $NDB_TOOLS_OUTPUT ;
|
2004-09-30 14:20:14 +02:00
|
|
|
|
|
|
|
SHOW TABLES;
|
|
|
|
|
|
|
|
--error 1146
|
|
|
|
select * from t4;
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# Test SHOW TABLES ability to detect new and delete old
|
|
|
|
# tables. Test all at once using many tables
|
2004-09-26 16:11:24 +02:00
|
|
|
#
|
2004-09-30 14:20:14 +02:00
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
# Create tables
|
|
|
|
create table t1(id int) engine=ndbcluster;
|
|
|
|
create table t2(id int, b char(255)) engine=myisam;
|
|
|
|
create table t3(id int, c char(255)) engine=ndbcluster;
|
|
|
|
create table t4(id int) engine=myisam;
|
|
|
|
create table t5(id int, d char(56)) engine=ndbcluster;
|
|
|
|
create table t6(id int) engine=ndbcluster;
|
|
|
|
create table t7(id int) engine=ndbcluster;
|
|
|
|
create table t8(id int, e char(34)) engine=myisam;
|
|
|
|
create table t9(id int) engine=myisam;
|
|
|
|
|
|
|
|
# Populate tables
|
|
|
|
insert into t2 values (2, "myisam table 2");
|
|
|
|
insert into t3 values (3, "ndb table 3");
|
|
|
|
insert into t5 values (5, "ndb table 5");
|
|
|
|
insert into t6 values (6);
|
|
|
|
insert into t8 values (8, "myisam table 8");
|
|
|
|
insert into t9 values (9);
|
|
|
|
|
|
|
|
# Remove t3, t5 from NDB
|
2005-02-01 17:08:39 +01:00
|
|
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >> $NDB_TOOLS_OUTPUT ;
|
|
|
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >> $NDB_TOOLS_OUTPUT ;
|
2004-09-30 14:20:14 +02:00
|
|
|
# Remove t6, t7 from disk
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
|
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
|
2004-09-30 14:20:14 +02:00
|
|
|
|
|
|
|
SHOW TABLES;
|
|
|
|
|
|
|
|
select * from t6;
|
|
|
|
select * from t7;
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t1, t2, t4, t6, t7, t8, t9;
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# Test SHOW TABLES LIKE ability to detect new and delete old
|
|
|
|
# tables. Test all at once using many tables.
|
2004-09-26 16:11:24 +02:00
|
|
|
#
|
2004-09-30 14:20:14 +02:00
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
# Create tables
|
|
|
|
create table t1(id int) engine=ndbcluster;
|
|
|
|
create table t2(id int, b char(255)) engine=myisam;
|
|
|
|
create table t3(id int, c char(255)) engine=ndbcluster;
|
|
|
|
create table t4(id int) engine=myisam;
|
|
|
|
create table t5(id int, d char(56)) engine=ndbcluster;
|
|
|
|
create table t6(id int) engine=ndbcluster;
|
|
|
|
create table t7(id int) engine=ndbcluster;
|
|
|
|
create table t8(id int, e char(34)) engine=myisam;
|
|
|
|
create table t9(id int) engine=myisam;
|
|
|
|
|
|
|
|
# Populate tables
|
|
|
|
insert into t2 values (2, "myisam table 2");
|
|
|
|
insert into t3 values (3, "ndb table 3");
|
|
|
|
insert into t5 values (5, "ndb table 5");
|
|
|
|
insert into t6 values (6);
|
|
|
|
insert into t8 values (8, "myisam table 8");
|
|
|
|
insert into t9 values (9);
|
|
|
|
|
|
|
|
# Remove t3, t5 from NDB
|
2004-11-22 16:05:51 +01:00
|
|
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null ;
|
|
|
|
system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null ;
|
2004-09-30 14:20:14 +02:00
|
|
|
# Remove t6, t7 from disk
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ;
|
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ;
|
2004-09-30 14:20:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
SHOW TABLES LIKE 't6';
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
# Check that t3 or t5 can't be created
|
|
|
|
# frm files for these tables is stilll on disk
|
|
|
|
--error 1050
|
|
|
|
create table t3(a int);
|
|
|
|
--error 1050
|
|
|
|
create table t5(a int);
|
|
|
|
|
|
|
|
SHOW TABLES LIKE 't%';
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t1, t2, t4, t6, t7, t8, t9;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
######################################################
|
|
|
|
# Test that several tables can be discovered when
|
|
|
|
# one statement access several table at once.
|
2004-09-26 16:11:24 +02:00
|
|
|
#
|
|
|
|
|
2004-09-30 14:20:14 +02:00
|
|
|
flush status;
|
2004-09-26 16:11:24 +02:00
|
|
|
|
2004-09-30 14:20:14 +02:00
|
|
|
# Create tables
|
|
|
|
create table t1(id int) engine=ndbcluster;
|
|
|
|
create table t2(id int, b char(255)) engine=ndbcluster;
|
|
|
|
create table t3(id int, c char(255)) engine=ndbcluster;
|
|
|
|
create table t4(id int) engine=myisam;
|
|
|
|
|
|
|
|
# Populate tables
|
|
|
|
insert into t1 values (1);
|
|
|
|
insert into t2 values (2, "table 2");
|
|
|
|
insert into t3 values (3, "ndb table 3");
|
|
|
|
insert into t4 values (4);
|
|
|
|
|
|
|
|
# Remove t1, t2, t3 from disk
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ;
|
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ;
|
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ;
|
2004-09-30 14:20:14 +02:00
|
|
|
flush tables;
|
2004-09-26 16:11:24 +02:00
|
|
|
|
2004-09-30 14:20:14 +02:00
|
|
|
# Select from the table which only exists in NDB.
|
|
|
|
select * from t1, t2, t3, t4;
|
2004-09-26 16:11:24 +02:00
|
|
|
|
2004-09-30 14:20:14 +02:00
|
|
|
# 3 table should have been discovered
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t1, t2, t3, t4;
|
2004-09-26 16:11:24 +02:00
|
|
|
|
2004-05-17 09:53:13 +02:00
|
|
|
|
|
|
|
#########################################################
|
|
|
|
# Test that a table that has been changed in NDB
|
|
|
|
# since it's been opened will be refreshed and discovered
|
|
|
|
# again
|
|
|
|
#
|
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
create table t5(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(200)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t5 values (1, "Magnus");
|
|
|
|
select * from t5;
|
|
|
|
|
|
|
|
ALTER TABLE t5 ADD COLUMN adress char(255) FIRST;
|
|
|
|
|
|
|
|
select * from t5;
|
|
|
|
|
|
|
|
insert into t5 values
|
|
|
|
("Adress for record 2", 2, "Carl-Gustav"),
|
|
|
|
("Adress for record 3", 3, "Karl-Emil");
|
|
|
|
update t5 set name="Bertil" where id = 2;
|
|
|
|
select * from t5 order by id;
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t5;
|
|
|
|
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
# Test that a table that has been changed with ALTER TABLE
|
|
|
|
# can be used from the same thread
|
|
|
|
#
|
|
|
|
|
|
|
|
flush status;
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
create table t6(
|
|
|
|
id int not null primary key,
|
|
|
|
name char(20)
|
|
|
|
) engine=ndb;
|
|
|
|
insert into t6 values (1, "Magnus");
|
|
|
|
select * from t6;
|
|
|
|
|
|
|
|
ALTER TABLE t6 ADD COLUMN adress char(255) FIRST;
|
|
|
|
|
|
|
|
select * from t6;
|
|
|
|
insert into t6 values
|
|
|
|
("Adress for record 2", 2, "Carl-Gustav"),
|
|
|
|
("Adress for record 3", 3, "Karl-Emil");
|
|
|
|
update t6 set name="Bertil" where id = 2;
|
|
|
|
select * from t6 order by id;
|
|
|
|
|
|
|
|
show status like 'handler_discover%';
|
|
|
|
|
|
|
|
drop table t6;
|
|
|
|
|
2004-10-08 13:37:13 +02:00
|
|
|
#####################################################
|
|
|
|
# Test that only tables in the current database shows
|
|
|
|
# up in SHOW TABLES
|
|
|
|
#
|
|
|
|
|
|
|
|
show tables;
|
|
|
|
|
2004-10-10 10:31:45 +02:00
|
|
|
create table t1 (a int,b longblob) engine=ndb;
|
2004-10-08 13:37:13 +02:00
|
|
|
show tables;
|
|
|
|
create database test2;
|
|
|
|
use test2;
|
|
|
|
show tables;
|
|
|
|
--error 1146
|
|
|
|
select * from t1;
|
2004-10-10 10:31:45 +02:00
|
|
|
create table t2 (b int,c longblob) engine=ndb;
|
2004-10-08 13:37:13 +02:00
|
|
|
use test;
|
|
|
|
select * from t1;
|
|
|
|
show tables;
|
|
|
|
drop table t1;
|
|
|
|
use test2;
|
|
|
|
drop table t2;
|
|
|
|
drop database test2;
|
|
|
|
use test;
|
|
|
|
|
2005-01-20 13:45:42 +01:00
|
|
|
#########################################################
|
|
|
|
# Bug#8035
|
|
|
|
# mysqld would segfault on second select * before bug was fixed
|
|
|
|
#
|
|
|
|
--disable_warnings
|
|
|
|
drop database if exists test_only_ndb_tables;
|
|
|
|
--enable_warnings
|
|
|
|
create database test_only_ndb_tables;
|
|
|
|
use test_only_ndb_tables;
|
|
|
|
create table t1 (a int primary key) engine=ndb;
|
|
|
|
select * from t1;
|
|
|
|
--exec $NDB_MGM --no-defaults -e "all restart -n" > /dev/null
|
|
|
|
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --not-started > /dev/null
|
|
|
|
--error 1015
|
|
|
|
select * from t1;
|
|
|
|
--exec $NDB_MGM --no-defaults -e "all start" > /dev/null
|
|
|
|
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults > /dev/null
|
|
|
|
use test;
|
|
|
|
drop database test_only_ndb_tables;
|
|
|
|
|
BUG#10365 Cluster handler uses non-standard error codes
- Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table.
- Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
mysql-test/r/ndb_autodiscover.result:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
mysql-test/t/ndb_autodiscover.test:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
ndb/test/ndbapi/create_tab.cpp:
Set connectstring before creating Ndb object.
sql/ha_ndbcluster.cc:
Rename and use the function ndbcluster_table_exists_in_engine.
Correct return valu from ndbcluster_discover
Remove old code "ndb_discover_tables"
sql/ha_ndbcluster.h:
Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine
sql/handler.cc:
Update comment of ha_create_table_from_engine
Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine.
Cleanup return codes from ha_create_table_from_engine.
Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes.
sql/handler.h:
Remove paramter create_if_cound from ha_create_table_from_engine
Rename ha_table_exists to ha_table_exists_in_engine
sql/sql_base.cc:
Use the function ha_table_exists_in_engine to detect if table exists in enegine.
If it exists, call function ha_create_table_from_engine to try and create it.
If create of table fails, set correct error message.
sql/sql_table.cc:
Add comments, remove parameter create_if_found to ha_create_table_from_engine.
When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists.
Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed"
When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
|
|
|
#####################################################
|
|
|
|
# Test that it's not possible to create tables
|
|
|
|
# with same name as NDB internal tables
|
|
|
|
# This will also test that it's not possible to create
|
|
|
|
# a table with tha same name as a table that can't be
|
|
|
|
# discovered( for example a table created via NDBAPI)
|
|
|
|
|
2005-07-12 10:39:58 +02:00
|
|
|
# Test disabled since it doesn't work on case insensitive systems
|
|
|
|
#--error 1050
|
|
|
|
#CREATE TABLE sys.SYSTAB_0 (a int);
|
|
|
|
#--error 1105
|
|
|
|
#select * from sys.SYSTAB_0;
|
|
|
|
|
|
|
|
#CREATE TABLE IF NOT EXISTS sys.SYSTAB_0 (a int);
|
|
|
|
#show warnings;
|
|
|
|
#--error 1105
|
|
|
|
#select * from sys.SYSTAB_0;
|
|
|
|
|
|
|
|
#--error 1051
|
|
|
|
#drop table sys.SYSTAB_0;
|
|
|
|
#drop table IF EXISTS sys.SYSTAB_0;
|
BUG#10365 Cluster handler uses non-standard error codes
- Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table.
- Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
mysql-test/r/ndb_autodiscover.result:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
mysql-test/t/ndb_autodiscover.test:
Add tests for reading from a table that can't be discovered(SYSTAB_0)
Discovery is not performed during create table anymore.
ndb/test/ndbapi/create_tab.cpp:
Set connectstring before creating Ndb object.
sql/ha_ndbcluster.cc:
Rename and use the function ndbcluster_table_exists_in_engine.
Correct return valu from ndbcluster_discover
Remove old code "ndb_discover_tables"
sql/ha_ndbcluster.h:
Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine
sql/handler.cc:
Update comment of ha_create_table_from_engine
Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine.
Cleanup return codes from ha_create_table_from_engine.
Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes.
sql/handler.h:
Remove paramter create_if_cound from ha_create_table_from_engine
Rename ha_table_exists to ha_table_exists_in_engine
sql/sql_base.cc:
Use the function ha_table_exists_in_engine to detect if table exists in enegine.
If it exists, call function ha_create_table_from_engine to try and create it.
If create of table fails, set correct error message.
sql/sql_table.cc:
Add comments, remove parameter create_if_found to ha_create_table_from_engine.
When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists.
Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed"
When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
2005-06-08 13:31:59 +02:00
|
|
|
|
2004-05-17 09:53:13 +02:00
|
|
|
######################################################
|
|
|
|
# Note! This should always be the last step in this
|
|
|
|
# file, the table t9 will be used and dropped
|
|
|
|
# by ndb_autodiscover2
|
|
|
|
#
|
|
|
|
|
|
|
|
CREATE TABLE t9 (
|
|
|
|
a int NOT NULL PRIMARY KEY,
|
|
|
|
b int
|
|
|
|
) engine=ndb;
|
|
|
|
|
|
|
|
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
|
|
|
|
|
|
|
|
#Don't drop the table, instead remove the frm file
|
2006-01-24 08:30:54 +01:00
|
|
|
system rm $MYSQLTEST_VARDIR/master-data/test/t9.frm ;
|
2004-05-17 09:53:13 +02:00
|
|
|
|
|
|
|
# Now leave test case, when ndb_autodiscover2 will run, this
|
|
|
|
# MySQL Server will have been restarted because it has a
|
2004-09-13 14:46:38 +02:00
|
|
|
# ndb_autodiscover2-master.opt file.
|
2004-05-17 09:53:13 +02:00
|
|
|
|
2004-11-08 11:06:36 +01:00
|
|
|
create table t10 (
|
|
|
|
a int not null primary key,
|
|
|
|
b blob
|
|
|
|
) engine=ndb;
|
2004-09-30 14:20:14 +02:00
|
|
|
|
2004-11-08 11:06:36 +01:00
|
|
|
insert into t10 values (1, 'kalle');
|
2004-09-30 14:20:14 +02:00
|
|
|
|
2005-02-01 17:08:39 +01:00
|
|
|
--exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test `$NDB_TOOLS_DIR/ndb_show_tables --no-defaults | grep BLOB` >> $NDB_TOOLS_OUTPUT 2>&1 || true
|
2005-07-28 02:22:47 +02:00
|
|
|
|
|
|
|
# End of 4.1 tests
|