Commit 689d0a0a authored by unknown's avatar unknown

Updated mysql-test-run to work with the started NDB Cluster

Added one test case for ndb to mysql-test-run, ndb_basic. It will show that
NDB Cluster is supported.


mysql-test/install_test_db.sh:
  Added --skip-ndb wile installing test db
mysql-test/mysql-test-run.sh:
  To enable NDB use --ndbcluster and to disable it --skip-ndbcluster or --skip-ndb
mysql-test/r/ndb_basic.result:
  Updated testcase to use all uppercase
mysql-test/t/ndb_basic.test:
  Updated testcase to use all uppercase
parent 90cf1745
-- require r/have_ndb.require
disable_query_log;
show variables like "have_ndbcluster";
enable_query_log;
...@@ -77,7 +77,8 @@ EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/ch ...@@ -77,7 +77,8 @@ EXTRA_ARG="--language=../sql/share/english/ --character-sets-dir=../sql/share/ch
fi fi
mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \ mysqld_boot=" $execdir/mysqld --no-defaults --bootstrap --skip-grant-tables \
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $EXTRA_ARG" --basedir=$basedir --datadir=$ldata --skip-innodb --skip-ndb --skip-bdb \
$EXTRA_ARG"
echo "running $mysqld_boot" echo "running $mysqld_boot"
if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot if $scriptdir/mysql_create_system_tables test $mdata $hostname | $mysqld_boot
......
...@@ -244,9 +244,9 @@ while test $# -gt 0; do ...@@ -244,9 +244,9 @@ while test $# -gt 0; do
--local) USE_RUNNING_SERVER="" ;; --local) USE_RUNNING_SERVER="" ;;
--extern) USE_RUNNING_SERVER="1" ;; --extern) USE_RUNNING_SERVER="1" ;;
--with-ndbcluster) --with-ndbcluster)
USE_NDBCLUSTER="--with-ndbcluster" ;; USE_NDBCLUSTER="--ndbcluster" ;;
--ndbconnectstring=*) --ndbconnectstring=*)
USE_NDBCLUSTER="--with-ndbcluster" ; USE_NDBCLUSTER="--ndbcluster" ;
USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndbconnectstring=;;"` ;; USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndbconnectstring=;;"` ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;; --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--local-master) --local-master)
......
Variable_name Value
have_ndbcluster YES
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412);
SELECT pk1 FROM t1;
pk1
9410
SELECT * FROM t1;
pk1 attr1
9410 9412
SELECT t1.* FROM t1;
pk1 attr1
9410 9412
UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1;
pk1 attr1
9410 1
UPDATE t1 SET pk1=2 WHERE attr1=1;
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
SELECT * FROM t1;
pk1 attr1
9410 1
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1
INSERT INTO t1 VALUES (9410,9412);
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1;
pk1 attr1
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1
INSERT INTO t1 values (1, 4), (2, 4), (3, 5), (4, 4), (5, 5);
DELETE FROM t1 WHERE attr1=4;
SELECT * FROM t1 order by pk1;
pk1 attr1
3 5
5 5
DELETE FROM t1;
INSERT INTO t1 VALUES (9410,9412), (9411, 9413);
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1;
pk1 attr1
9411 9413
DROP TABLE t1;
CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
INSERT INTO t1 values(3456, 7890);
SELECT * FROM t1;
id id2
3456 7890
UPDATE t1 SET id=2 WHERE id2=12;
SELECT * FROM t1;
id id2
3456 7890
UPDATE t1 SET id=1234 WHERE id2=7890;
SELECT * FROM t1;
id id2
1234 7890
DELETE FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
SELECT * FROM t1;
id id2
3456 7890
3456 7890
3456 7890
DELETE FROM t1 WHERE id = 3456;
DROP TABLE t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=NDBCLUSTER;
INSERT INTO t1 values(1, 9999);
DROP TABLE t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=NDB;
INSERT INTO t1 values(1, 9999);
DROP TABLE t1;
-- source include/have_ndb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
#
# Basic test to show that the NDB
# table handler is working
#
#
# Create a normal table with primary key
#
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412);
SELECT pk1 FROM t1;
SELECT * FROM t1;
SELECT t1.* FROM t1;
UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1;
# Can't UPDATE PK! Test that correct error is returned
-- error 1112
UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1;
# Delete the record
DELETE FROM t1;
SELECT * FROM t1;
# Delete the record by specifying pk
INSERT INTO t1 VALUES (9410,9412);
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1;
# Insert three records and delete the
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
DELETE FROM t1;
SELECT * FROM t1;
# Insert three records with attr1=4 and two with attr1=5
# Delete all with attr1=4
INSERT INTO t1 values (1, 4), (2, 4), (3, 5), (4, 4), (5, 5);
DELETE FROM t1 WHERE attr1=4;
SELECT * FROM t1 order by pk1;
DELETE FROM t1;
# Insert two records and delete one
INSERT INTO t1 VALUES (9410,9412), (9411, 9413);
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1;
DROP TABLE t1;
#
# Create table without primary key
# a hidden primary key column is created by handler
#
CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
INSERT INTO t1 values(3456, 7890);
SELECT * FROM t1;
UPDATE t1 SET id=2 WHERE id2=12;
SELECT * FROM t1;
UPDATE t1 SET id=1234 WHERE id2=7890;
SELECT * FROM t1;
DELETE FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890);
SELECT * FROM t1;
DELETE FROM t1 WHERE id = 3456;
DROP TABLE t1;
# test create with the keyword "engine=NDBCLUSTER"
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=NDBCLUSTER;
INSERT INTO t1 values(1, 9999);
DROP TABLE t1;
# test create with the keyword "engine=NDB"
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=NDB;
INSERT INTO t1 values(1, 9999);
DROP TABLE t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment