summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--acconfig.h3
-rw-r--r--acinclude.m442
-rw-r--r--configure.in18
-rw-r--r--mysql-test/mysql-test-run.sh41
-rwxr-xr-xmysql-test/ndb/install_ndbcluster148
-rw-r--r--mysql-test/ndb/ndb_config_2_node.ini133
-rwxr-xr-xmysql-test/ndb/stop_ndbcluster52
8 files changed, 438 insertions, 0 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 234472f9f4a..d844c855de3 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -151,6 +151,7 @@ tim@threads.polyesthetic.msg
tim@white.box
tim@work.mysql.com
tom@basil-firewall.home.com
+tomas@mc05.(none)
tonu@hundin.mysql.fi
tonu@volk.internalnet
tonu@x153.internalnet
diff --git a/acconfig.h b/acconfig.h
index fbc26b8f3b5..67e9d1759c6 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -152,6 +152,9 @@
/* Do we use user level threads */
#undef HAVE_mit_thread
+/* Using Ndb Cluster DB */
+#undef HAVE_NDBCLUSTER_DB
+
/* For some non posix threads */
#undef HAVE_NONPOSIX_PTHREAD_GETSPECIFIC
diff --git a/acinclude.m4 b/acinclude.m4
index 55902364010..677c3cc9e99 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1332,6 +1332,48 @@ dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_EXAMPLE SECTION
dnl ---------------------------------------------------------------------------
+dnl ---------------------------------------------------------------------------
+dnl Macro: MYSQL_CHECK_NDBCLUSTER
+dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used
+dnl ---------------------------------------------------------------------------
+
+AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
+ AC_ARG_WITH([ndbcluster],
+ [
+ --with-ndbcluster Include the NDB Cluster table handler],
+ [ndbcluster="$withval"],
+ [ndbcluster=no])
+
+ AC_MSG_CHECKING([for NDB Cluster])
+
+ have_ndbcluster=no
+ ndbcluster_includes=
+ ndbcluster_libs=
+ case "$ndbcluster" in
+ yes )
+ AC_MSG_RESULT([Using NDB Cluster])
+ AC_DEFINE(HAVE_NDBCLUSTER_DB)
+ have_ndbcluster="yes"
+ ndbcluster_includes="-I../ndb/include -I../ndb/include/ndbapi"
+ ndbcluster_libs="\$(top_builddir)/ndb/lib/libNDB_API.a"
+ ndbcluster_system_libs=""
+ ;;
+ * )
+ AC_MSG_RESULT([Not using NDB Cluster])
+ ;;
+ esac
+
+ AC_SUBST(ndbcluster_includes)
+ AC_SUBST(ndbcluster_libs)
+ AC_SUBST(ndbcluster_system_libs)
+])
+
+dnl ---------------------------------------------------------------------------
+dnl END OF MYSQL_CHECK_NDBCLUSTER SECTION
+dnl ---------------------------------------------------------------------------
+
+
+>>>>>>>
dnl By default, many hosts won't let programs access large files;
dnl one must use special compiler options to get large-file access to work.
dnl For more details about this brain damage please see:
diff --git a/configure.in b/configure.in
index 8bfee20972b..94ad5a47991 100644
--- a/configure.in
+++ b/configure.in
@@ -2619,6 +2619,7 @@ MYSQL_CHECK_ISAM
MYSQL_CHECK_BDB
MYSQL_CHECK_INNODB
MYSQL_CHECK_EXAMPLEDB
+MYSQL_CHECK_NDBCLUSTER
# If we have threads generate some library functions and test programs
sql_server_dirs=
@@ -2748,6 +2749,19 @@ EOF
sql_server_dirs="$sql_server_dirs innobase"
AC_CONFIG_SUBDIRS(innobase)
fi
+
+ if test X"$have_ndbcluster" = Xyes
+ then
+ sql_server_dirs="$sql_server_dirs ndb"
+ echo "CONFIGURING FOR NDB CLUSTER"
+ case $with_debug in
+ no) flag="-R" ;;
+ *) flag="-D" ;;
+ esac
+ (cd ndb && ./configure $flag) \
+ || AC_MSG_ERROR([could not configure NDB Cluster])
+ echo "END OF NDB CLUSTER CONFIGURATION"
+ fi
#
# END of configuration for optional table handlers
#
@@ -2809,6 +2823,10 @@ case $SYSTEM_TYPE in
MAKE_BINARY_DISTRIBUTION_OPTIONS=
;;
esac
+if test X"$have_ndbcluster" = Xyes
+then
+ MAKE_BINARY_DISTRIBUTION_OPTIONS="$MAKE_BINARY_DISTRIBUTION_OPTIONS --with-ndbcluster"
+fi
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
# Output results
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 96ac17755ac..f47c63160eb 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -212,6 +212,8 @@ EXTRA_MYSQL_TEST_OPT=""
EXTRA_MYSQLDUMP_OPT=""
EXTRA_MYSQLBINLOG_OPT=""
USE_RUNNING_SERVER=""
+USE_NDBCLUSTER=""
+USE_RUNNING_NDBCLUSTER=""
DO_GCOV=""
DO_GDB=""
MANUAL_GDB=""
@@ -241,6 +243,11 @@ while test $# -gt 0; do
SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
--local) USE_RUNNING_SERVER="" ;;
--extern) USE_RUNNING_SERVER="1" ;;
+ --with-ndbcluster)
+ USE_NDBCLUSTER="--with-ndbcluster" ;;
+ --ndbconnectstring=*)
+ USE_NDBCLUSTER="--with-ndbcluster" ;
+ USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndbconnectstring=;;"` ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--local-master)
MASTER_MYPORT=3306;
@@ -894,6 +901,7 @@ start_master()
--local-infile \
--exit-info=256 \
--core \
+ $USE_NDBCLUSTER \
--datadir=$MASTER_MYDDIR \
--pid-file=$MASTER_MYPID \
--socket=$MASTER_MYSOCK \
@@ -919,6 +927,7 @@ start_master()
--character-sets-dir=$CHARSETSDIR \
--default-character-set=$CHARACTER_SET \
--core \
+ $USE_NDBCLUSTER \
--tmpdir=$MYSQL_TMP_DIR \
--language=$LANGUAGE \
--innodb_data_file_path=ibdata1:50M \
@@ -1402,6 +1411,15 @@ then
fi
fi
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ if [ -z "$USE_RUNNING_NDBCLUSTER" ]
+ then
+ # Kill any running ndbcluster stuff
+ ./ndb/stop_ndbcluster
+ fi
+ fi
+
# Remove files that can cause problems
$RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
@@ -1412,6 +1430,20 @@ then
wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
$ECHO "Installing Test Databases"
mysql_install_db
+
+ if [ ! -z "$USE_NDBCLUSTER" ]
+ then
+ if [ -z "$USE_RUNNING_NDBCLUSTER" ]
+ then
+ echo "Starting ndbcluster"
+ ./ndb/install_ndbcluster --initial --data-dir=$MASTER_MYDDIR || exit 1
+ export NDB_CONNECTSTRING=`cat Ndb.cfg`
+ else
+ export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
+ echo "Using ndbcluster at $NDB_CONNECTSTRING"
+ fi
+ fi
+
start_manager
# Do not automagically start daemons if we are in gdb or running only one test
@@ -1492,6 +1524,15 @@ then
mysql_stop
fi
+if [ ! -z "$USE_NDBCLUSTER" ]
+then
+if [ -z "$USE_RUNNING_NDBCLUSTER" ]
+then
+ # Kill any running ndbcluster stuff
+ ./ndb/stop_ndbcluster
+fi
+fi
+
stop_manager
report_stats
$ECHO
diff --git a/mysql-test/ndb/install_ndbcluster b/mysql-test/ndb/install_ndbcluster
new file mode 100755
index 00000000000..dab94db759e
--- /dev/null
+++ b/mysql-test/ndb/install_ndbcluster
@@ -0,0 +1,148 @@
+#!/bin/sh
+# Copyright (C) 2004 MySQL AB
+# For a more info consult the file COPYRIGHT distributed with this file
+
+# This scripts starts the table handler ndbcluster
+
+# configurable parameters, make sure to change in mysqlcluterd as well
+port_base="22" # using ports port_base{"00","01", etc}
+fsdir=`pwd`
+# end configurable parameters
+
+libdir=`pwd`/../ndb/lib
+bindir=`pwd`/../ndb/bin
+
+pidfile=ndbcluster.pid
+
+while test $# -gt 0; do
+ case "$1" in
+ --initial)
+ flags_ndb=$flags_ndb" -i"
+ initial_ndb=1
+ ;;
+ --data-dir=*)
+ fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
+ ;;
+ --port-base=*)
+ port_base=`echo "$1" | sed -e "s;--port-base=;;"`
+ ;;
+ -- ) shift; break ;;
+ --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
+ * ) break ;;
+ esac
+ shift
+done
+
+exec_ndb=$bindir/ndb
+exec_mgmtsrvr=$bindir/mgmtsrvr
+fs_ndb=$fsdir/ndbcluster
+fs_mgm_1=$fs_ndb/1.ndb_mgm
+fs_ndb_2=$fs_ndb/2.ndb_db
+fs_ndb_3=$fs_ndb/3.ndb_db
+fs_name_2=$fs_ndb/node-2-fs
+fs_name_3=$fs_ndb/node-3-fs
+
+NDB_HOME=
+export NDB_CONNECTSTRING
+if [ ! -x $fsdir ]; then
+ echo "$fsdir missing"
+ exit 1
+fi
+if [ ! -x $exec_ndb ]; then
+ echo "$exec_ndb missing"
+ exit 1
+fi
+if [ ! -x $exec_mgmtsrv ]; then
+ echo "$exec_mgmtsrvr missing"
+ exit 1
+fi
+
+start_default_ndbcluster() {
+
+# do some checks
+
+NDB_CONNECTSTRING=
+
+if [ $initial_ndb ] ; then
+ mkdir $fs_ndb
+ mkdir $fs_mgm_1
+ mkdir $fs_ndb_2
+ mkdir $fs_ndb_3
+ mkdir $fs_name_2
+ mkdir $fs_name_3
+fi
+if [ -d "$fs_ndb" -a -d "$fs_mgm_1" -a -d "$fs_ndb_2" -a -d "$fs_ndb_3" -a -d "$fs_name_2" -a -d "$fs_name_3" ]; then :; else
+ echo "$fs_ndb filesystem directory does not exist"
+ exit 1
+fi
+
+# set som help variables
+
+ndb_host="localhost"
+ndb_port=$port_base"00"
+NDB_CONNECTSTRING_BASE="host=$ndb_host:$ndb_port;nodeid="
+
+
+# Start management server as deamon
+
+NDB_ID="1"
+NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
+
+# Edit file system path and ports in config file
+
+if [ $initial_ndb ] ; then
+sed \
+ -e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
+ -e s,"CHOOSE_FILESYSTEM_NODE_2","$fs_name_2",g \
+ -e s,"CHOOSE_FILESYSTEM_NODE_3","$fs_name_3",g \
+ -e s,"CHOOSE_PORT_BASE",$port_base,g \
+ < ndb/ndb_config_2_node.ini \
+ > "$fs_mgm_1/config.ini"
+fi
+
+if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else
+ echo "Unable to start $exec_mgmtsrvr from `pwd`"
+ exit 1
+fi
+
+cat `find $fs_ndb -name 'node*.pid'` > $pidfile
+
+# Start database node
+
+NDB_ID="2"
+NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
+( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
+
+cat `find $fs_ndb -name 'node*.pid'` > $pidfile
+
+# Start database node
+
+NDB_ID="3"
+NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
+( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & )
+
+cat `find $fs_ndb -name 'node*.pid'` > $pidfile
+
+# Start management client
+
+sleep 5
+echo "show" | $bindir/mgmtclient $ndb_host $ndb_port
+
+# test if Ndb Cluster starts properly
+
+NDB_ID="11"
+NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID
+#if ( export LD_LIBRARY_PATH=$libdir ; $bindir/list_tables ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
+if ( export LD_LIBRARY_PATH=$libdir ; $bindir/waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
+ echo "Ndbcluster startup failed"
+ exit 1
+fi
+
+echo $NDB_CONNECTSTRING > Ndb.cfg
+
+cat `find $fs_ndb -name 'node*.pid'` > $pidfile
+}
+
+start_default_ndbcluster
+
+exit 0
diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini
new file mode 100644
index 00000000000..9e0f8254c78
--- /dev/null
+++ b/mysql-test/ndb/ndb_config_2_node.ini
@@ -0,0 +1,133 @@
+[DB DEFAULT]
+#NoOfFragmentLogfiles: 1
+#TimeBetweenLocalCheckpoints: 31
+NoOfReplicas: 2
+
+[COMPUTER]
+Id: 1
+ByteOrder: Little
+HostName: CHOOSE_HOSTNAME_1
+
+[COMPUTER]
+Id: 2
+ByteOrder: Little
+HostName: CHOOSE_HOSTNAME_2
+
+[COMPUTER]
+Id: 3
+ByteOrder: Little
+HostName: CHOOSE_HOSTNAME_3
+
+[COMPUTER]
+Id: 4
+ByteOrder: Little
+HostName: CHOOSE_HOSTNAME_4
+
+[COMPUTER]
+Id: 5
+ByteOrder: Little
+HostName: CHOOSE_HOSTNAME_5
+
+[COMPUTER]
+Id: 6
+ByteOrder: Little
+HostName: CHOOSE_HOSTNAME_6
+
+[COMPUTER]
+Id: 7
+ByteOrder: Little
+HostName: CHOOSE_HOSTNAME_7
+
+[MGM]
+Id: 1
+ExecuteOnComputer: 1
+PortNumber: CHOOSE_PORT_BASE00
+PortNumberStats: CHOOSE_PORT_BASE01
+
+
+[DB]
+Id: 2
+ExecuteOnComputer: 2
+FileSystemPath: CHOOSE_FILESYSTEM_NODE_2
+
+[DB]
+Id: 3
+ExecuteOnComputer: 3
+FileSystemPath: CHOOSE_FILESYSTEM_NODE_3
+
+[API]
+Id: 11
+ExecuteOnComputer: 4
+
+[API]
+Id: 12
+ExecuteOnComputer: 5
+
+[API]
+Id: 13
+ExecuteOnComputer: 6
+
+[API]
+Id: 14
+ExecuteOnComputer: 7
+
+# Mgmtsrvr connections
+
+[TCP]
+NodeId1: 1
+NodeId2: 2
+PortNumber: CHOOSE_PORT_BASE02
+
+[TCP]
+NodeId1: 1
+NodeId2: 3
+PortNumber: CHOOSE_PORT_BASE03
+
+# Ndb nodes connections
+
+[TCP]
+NodeId1: 2
+NodeId2: 3
+PortNumber: CHOOSE_PORT_BASE04
+
+# Api connections
+
+[TCP]
+NodeId1: 11
+NodeId2: 2
+PortNumber: CHOOSE_PORT_BASE05
+
+[TCP]
+NodeId1: 11
+NodeId2: 3
+PortNumber: CHOOSE_PORT_BASE06
+
+[TCP]
+NodeId1: 12
+NodeId2: 2
+PortNumber: CHOOSE_PORT_BASE07
+
+[TCP]
+NodeId1: 12
+NodeId2: 3
+PortNumber: CHOOSE_PORT_BASE08
+
+[TCP]
+NodeId1: 13
+NodeId2: 2
+PortNumber: CHOOSE_PORT_BASE09
+
+[TCP]
+NodeId1: 13
+NodeId2: 3
+PortNumber: CHOOSE_PORT_BASE10
+
+[TCP]
+NodeId1: 14
+NodeId2: 2
+PortNumber: CHOOSE_PORT_BASE11
+
+[TCP]
+NodeId1: 14
+NodeId2: 3
+PortNumber: CHOOSE_PORT_BASE12
diff --git a/mysql-test/ndb/stop_ndbcluster b/mysql-test/ndb/stop_ndbcluster
new file mode 100755
index 00000000000..09e22cf69c4
--- /dev/null
+++ b/mysql-test/ndb/stop_ndbcluster
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Copyright (C) 2004 MySQL AB
+# For a more info consult the file COPYRIGHT distributed with this file
+
+# This scripts stops the table handler ndbcluster
+
+bindir=`pwd`/../ndb/bin
+pidfile=ndbcluster.pid
+cfgfile=Ndb.cfg
+
+while test $# -gt 0; do
+ case "$1" in
+ --port-base=*)
+ port_base=`echo "$1" | sed -e "s;--port-base=;;"`
+ ;;
+ -- ) shift; break ;;
+ --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
+ * ) break ;;
+ esac
+ shift
+done
+
+stop_default_ndbcluster() {
+
+if [ ! -f $pidfile ] ; then
+ exit 0
+fi
+
+if [ ! -f $cfgfile ] ; then
+ echo "$cfgfile missing"
+ exit 1
+fi
+
+ndb_host=`cat $cfgfile | sed -e "s,.*host=\(.*\)\:.*,\1,1"`
+ndb_port=`cat $cfgfile | sed -e "s,.*host=$ndb_host\:\([0-9]*\).*,\1,1"`
+
+# Start management client
+
+exec_mgmtclient="$bindir/mgmtclient --try-reconnect=1 $ndb_host $ndb_port"
+
+echo "$exec_mgmtclient"
+echo "all stop" | $exec_mgmtclient
+
+sleep 5
+
+kill `cat $pidfile`
+rm $pidfile
+}
+
+stop_default_ndbcluster
+
+exit 0