summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <magnus@neptunus.(none)>2004-09-13 14:49:50 +0200
committerunknown <magnus@neptunus.(none)>2004-09-13 14:49:50 +0200
commitf87754fb6bad38c36ace352eb453c59fdc3c4e1a (patch)
tree5ca6bc96ea20d293fd30d7a59a0ecbd272c5ecf0 /mysql-test
parentb4f59e866bf6d7a43d374d0d15e91a29cf34b6b8 (diff)
parent5a464356788b10a7cd5a5412ed12d1b88d32b479 (diff)
downloadmariadb-git-f87754fb6bad38c36ace352eb453c59fdc3c4e1a.tar.gz
Merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged ndb/src/ndbapi/TransporterFacade.cpp: Auto merged ndb/src/ndbapi/ndb_cluster_connection.cpp: Auto merged sql/handler.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_table.cc: Auto merged sql/ha_ndbcluster.cc: Go with the new solution
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh5
-rw-r--r--mysql-test/r/ndb_autodiscover.result38
-rw-r--r--mysql-test/t/ndb_autodiscover.test101
-rw-r--r--mysql-test/t/ndb_autodiscover2.test6
4 files changed, 111 insertions, 39 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 41dc3c419f0..baf05d53174 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -496,6 +496,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
CHARSETSDIR="$BASEDIR/sql/share/charsets"
INSTALL_DB="./install_test_db"
MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
+ NDB_TOOLS_DIR="$BASEDIR/ndb/tools"
else
if test -x "$BASEDIR/libexec/mysqld"
then
@@ -515,6 +516,7 @@ else
MYSQL="$CLIENT_BINDIR/mysql"
INSTALL_DB="./install_test_db --bin"
MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
+ NDB_TOOLS_DIR="$CLIENT_BINDIR"
if test -d "$BASEDIR/share/mysql/english"
then
LANGUAGE="$BASEDIR/share/mysql/english/"
@@ -561,7 +563,8 @@ MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
-export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
+export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR
+export NDB_TOOLS_DIR
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index f5b908c39e2..7f5c4aecaa2 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2,t3,t4,t5,t6,t9;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t9;
flush status;
create table t1(
id int not null primary key,
@@ -94,8 +94,6 @@ ERROR 42S01: Table 't3' already exists
show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
-SHOW TABLES FROM test;
-Tables_in_test
create table IF NOT EXISTS t3(
id int not null primary key,
id2 int not null,
@@ -119,6 +117,40 @@ Variable_name Value
Handler_discover 2
drop table t3;
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;
+id name
+1 Explorer
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 0
+flush tables;
+show tables from test;
+Tables_in_test
+t6
+t7
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 1
+flush tables;
+show table status;
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL
+t7 ndbcluster 9 Fixed 100 0 # # # 0 NULL # # NULL # NULL
+show status like 'handler_discover%';
+Variable_name Value
+Handler_discover 2
+drop table t6, t7;
+flush status;
show status like 'handler_discover%';
Variable_name Value
Handler_discover 0
diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
index 371a130291b..ddb8b6ed47a 100644
--- a/mysql-test/t/ndb_autodiscover.test
+++ b/mysql-test/t/ndb_autodiscover.test
@@ -1,7 +1,7 @@
-- source include/have_ndb.inc
--disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t9;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t9;
--enable_warnings
################################################
@@ -122,7 +122,6 @@ create table t3(
# IF NOT EXISTS wasn't specified
show status like 'handler_discover%';
-SHOW TABLES FROM test;
# now it should be discovered
create table IF NOT EXISTS t3(
@@ -145,38 +144,76 @@ show status like 'handler_discover%';
drop table t3;
-#######################################################
-# Test that a table that already exists as frm file
-# but not in NDB can be deleted from disk.
+##################################################
+# Test that a table that already exists in NDB
+# is discovered when SHOW TABLES
+# is used
#
-# Manual test
-#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;
+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;
+system rm var/master-data/test/t7.frm ;
+
+show tables from test;
+show status like 'handler_discover%';
+
+# Remove the frm file from disk again
+flush tables;
+system rm var/master-data/test/t7.frm ;
+
+--replace_column 7 # 8 # 9 # 12 # 13 # 15 #
+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"
#
+
+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;
+
# Remove the table from NDB
-#system drop_tab -c "$NDB_CONNECTSTRING2" -d test t4 > /dev/null ;
-#system drop_tab -c "host=localhost:2200;nodeid=5" -d test t4 > /dev/null ;
-#
-#--error 1296
-#select * from t4;
-#
-#flush table t4;
-#--error 1016
-#select * from t4;
-#
-#show status like 'handler_discover%';
-#drop table t4;
-#flush tables;
-#show tables;
-#--error 1146
-#select * from t4;
+system exec $NDB_TOOLS_DIR/ndb_drop_table -d test t4;
+
+system exec ../ndb/tools/ndb_show_tables > show_tables.log;
+
+# Test that correct error is returned
+--error 1146
+select * from t4;
+--error 1146
+select * from t4;
+
+show status like 'handler_discover%';
+drop table t4;
+
+show tables;
+
#########################################################
@@ -241,7 +278,6 @@ show status like 'handler_discover%';
drop table t6;
######################################################
-# Simple test to show use of discover on startup
# Note! This should always be the last step in this
# file, the table t9 will be used and dropped
# by ndb_autodiscover2
@@ -259,8 +295,7 @@ system rm var/master-data/test/t9.frm ;
# Now leave test case, when ndb_autodiscover2 will run, this
# MySQL Server will have been restarted because it has a
-# ndb_autodiscover2-master.opt file. And thus the table should
-# have been discovered by the "discover on startup" function.
+# ndb_autodiscover2-master.opt file.
#TODO
#SLECT * FROM t1, t2, t4;
diff --git a/mysql-test/t/ndb_autodiscover2.test b/mysql-test/t/ndb_autodiscover2.test
index 6a3f2092148..cce75d5ca4f 100644
--- a/mysql-test/t/ndb_autodiscover2.test
+++ b/mysql-test/t/ndb_autodiscover2.test
@@ -1,14 +1,16 @@
-- source include/have_ndb.inc
#
-# Simple test to show use of discover on startup
+# Simple test to show use of discover when the server has been restarted
# The previous step has simply removed the frm file
# from disk, but left the table in NDB
#
--sleep 3;
select * from t9 order by a;
-# handler_discover should be zero
+# handler_discover should be 1
show status like 'handler_discover%';
drop table t9;
+
+