diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 8d675ec7f68..13ddb8f221e 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1417,7 +1417,7 @@ then if [ -z "$USE_RUNNING_NDBCLUSTER" ] then # Kill any running ndbcluster stuff - ./ndb/stop_ndbcluster + ./ndb/ndbcluster --stop fi fi @@ -1438,7 +1438,7 @@ then if [ -z "$USE_RUNNING_NDBCLUSTER" ] then echo "Starting ndbcluster" - ./ndb/install_ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1 + ./ndb/ndbcluster --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1 export NDB_CONNECTSTRING=`cat Ndb.cfg` else export NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER" @@ -1538,7 +1538,7 @@ then if [ -z "$USE_RUNNING_NDBCLUSTER" ] then # Kill any running ndbcluster stuff - ./ndb/stop_ndbcluster + ./ndb/ndbcluster --stop fi fi diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am index 9ab785346da..44627c85bb5 100644 --- a/mysql-test/ndb/Makefile.am +++ b/mysql-test/ndb/Makefile.am @@ -2,13 +2,9 @@ benchdir_root= $(prefix) testdir = $(benchdir_root)/mysql-test/ndb -test_SCRIPTS = \ -install_ndbcluster \ -stop_ndbcluster +test_SCRIPTS = ndbcluster -EXTRA_SCRIPTS = \ -install_ndbcluster.sh \ -stop_ndbcluster.sh +EXTRA_SCRIPTS = ndbcluster.sh test_DATA = ndb_config_2_node.ini diff --git a/mysql-test/ndb/install_ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh similarity index 70% rename from mysql-test/ndb/install_ndbcluster.sh rename to mysql-test/ndb/ndbcluster.sh index 00e341e8563..c894885360e 100755 --- a/mysql-test/ndb/install_ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -19,28 +19,34 @@ cd $CWD if [ -d ../sql ] ; then SOURCE_DIST=1 ndbtop=$BASEDIR/ndb - exec_ndb=$ndbtop/src/kernel/ndb-main/ndb - exec_mgmtsrvr=$ndbtop/src/mgmsrv/mgmtsrvr + exec_ndb=$ndbtop/src/kernel/ndb-main/ndbd + exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd exec_waiter=$ndbtop/tools/ndb_waiter - exec_mgmtclient=$ndbtop/src/mgmclient/mgmtclient + exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgmclient else BINARY_DIST=1 - if test -x "$BASEDIR/libexec/ndb" + if test -x "$BASEDIR/libexec/ndbd" then - exec_ndb=$BASEDIR/libexec/ndb - exec_mgmtsrvr=$BASEDIR/libexec/mgmtsrvr + exec_ndb=$BASEDIR/libexec/ndbd + exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd else - exec_ndb=$BASEDIR/bin/ndb - exec_mgmtsrvr=$BASEDIR/bin/mgmtsrvr + exec_ndb=$BASEDIR/bin/ndbd + exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd fi exec_waiter=$BASEDIR/bin/ndb_waiter - exec_mgmtclient=$BASEDIR/bin/mgmtclient + exec_mgmtclient=$BASEDIR/bin/ndb_mgmclient fi pidfile=ndbcluster.pid +cfgfile=Ndb.cfg +stop_ndb= +initial_ndb= while test $# -gt 0; do case "$1" in + --stop) + stop_ndb=1 + ;; --initial) flags_ndb=$flags_ndb" -i" initial_ndb=1 @@ -123,7 +129,7 @@ sed \ > "$fs_mgm_1/config.ini" fi -if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else +if ( cd $fs_mgm_1 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_mgmtsrvr -d -c config.ini ) ; then :; else echo "Unable to start $exec_mgmtsrvr from `pwd`" exit 1 fi @@ -134,7 +140,7 @@ cat `find $fs_ndb -name 'node*.pid'` > $pidfile NDB_ID="2" NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID -( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & ) +( cd $fs_ndb_2 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & ) cat `find $fs_ndb -name 'node*.pid'` > $pidfile @@ -142,7 +148,7 @@ cat `find $fs_ndb -name 'node*.pid'` > $pidfile NDB_ID="3" NDB_CONNECTSTRING=$NDB_CONNECTSTRING_BASE$NDB_ID -( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > Ndb.cfg ; $exec_ndb -d $flags_ndb & ) +( cd $fs_ndb_3 ; echo $NDB_CONNECTSTRING > $cfgfile ; $exec_ndb -d $flags_ndb & ) cat `find $fs_ndb -name 'node*.pid'` > $pidfile @@ -160,11 +166,45 @@ if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else exit 1 fi -echo $NDB_CONNECTSTRING > Ndb.cfg +echo $NDB_CONNECTSTRING > $cfgfile cat `find $fs_ndb -name 'node*.pid'` > $pidfile } -start_default_ndbcluster +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="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_port" + +echo "$exec_mgmtclient" +echo "all stop" | $exec_mgmtclient + +sleep 5 + +if [ -f $pidfile ] ; then + kill `cat $pidfile` + rm $pidfile +fi + +} + +if [ $stop_ndb ] ; then + stop_default_ndbcluster +else + start_default_ndbcluster +fi exit 0 diff --git a/mysql-test/ndb/stop_ndbcluster.sh b/mysql-test/ndb/stop_ndbcluster.sh deleted file mode 100755 index 50fd755169d..00000000000 --- a/mysql-test/ndb/stop_ndbcluster.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/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 - -#BASEDIR is always one above mysql-test directory -CWD=`pwd` -cd .. -BASEDIR=`pwd` -cd $CWD - -# Are we using a source or a binary distribution? -if [ -d ../sql ] ; then - SOURCE_DIST=1 - ndbtop=$BASEDIR/ndb - exec_ndb=$ndbtop/src/kernel/ndb-main/ndb - exec_mgmtsrvr=$ndbtop/src/mgmsrv/mgmtsrvr - exec_waiter=$ndbtop/tools/ndb_waiter - exec_mgmtclient=$ndbtop/src/mgmclient/mgmtclient -else - BINARY_DIST=1 - if test -x "$BASEDIR/libexec/ndb" - then - exec_ndb=$BASEDIR/libexec/ndb - exec_mgmtsrvr=$BASEDIR/libexec/mgmtsrvr - else - exec_ndb=$BASEDIR/bin/ndb - exec_mgmtsrvr=$BASEDIR/bin/mgmtsrvr - fi - exec_waiter=$BASEDIR/bin/ndb_waiter - exec_mgmtclient=$BASEDIR/bin/mgmtclient -fi - -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="$exec_mgmtclient --try-reconnect=1 $ndb_host $ndb_port" - -echo "$exec_mgmtclient" -echo "all stop" | $exec_mgmtclient - -sleep 5 - -if [ -f $pidfile ] ; then - kill `cat $pidfile` - rm $pidfile -fi - -} - -stop_default_ndbcluster - -exit 0 diff --git a/ndb/src/kernel/Makefile.am b/ndb/src/kernel/Makefile.am index bc84eda1f92..7f2f33bd8e5 100644 --- a/ndb/src/kernel/Makefile.am +++ b/ndb/src/kernel/Makefile.am @@ -2,9 +2,9 @@ SUBDIRS = error blocks vm include $(top_srcdir)/ndb/config/common.mk.am -ndbbin_PROGRAMS = ndb +ndbbin_PROGRAMS = ndbd -ndb_SOURCES = Main.cpp SimBlockList.cpp +ndbd_SOURCES = Main.cpp SimBlockList.cpp include $(top_srcdir)/ndb/config/type_kernel.mk.am diff --git a/ndb/src/kernel/blocks/backup/restore/Makefile.am b/ndb/src/kernel/blocks/backup/restore/Makefile.am index 6d928a11cc1..a3ff9402bb2 100644 --- a/ndb/src/kernel/blocks/backup/restore/Makefile.am +++ b/ndb/src/kernel/blocks/backup/restore/Makefile.am @@ -1,7 +1,7 @@ -ndbtools_PROGRAMS = restore +ndbtools_PROGRAMS = ndb_restore -restore_SOURCES = main.cpp Restore.cpp +ndb_restore_SOURCES = main.cpp Restore.cpp LDADD_LOC = $(top_srcdir)/ndb/src/libndbclient.la diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am index 65a194e75b3..9482d70eb0a 100644 --- a/ndb/src/mgmclient/Makefile.am +++ b/ndb/src/mgmclient/Makefile.am @@ -1,7 +1,7 @@ -ndbtools_PROGRAMS = mgmtclient +ndbtools_PROGRAMS = ndb_mgm -mgmtclient_SOURCES = \ +ndb_mgm_SOURCES = \ main.cpp \ CommandInterpreter.cpp \ CpcClient.cpp diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am index 3c7e289251c..143e0996103 100644 --- a/ndb/src/mgmsrv/Makefile.am +++ b/ndb/src/mgmsrv/Makefile.am @@ -1,7 +1,7 @@ -ndbbin_PROGRAMS = mgmtsrvr +ndbbin_PROGRAMS = ndb_mgmd -mgmtsrvr_SOURCES = \ +ndb_mgmd_SOURCES = \ MgmtSrvr.cpp \ MgmtSrvrGeneralSignalHandling.cpp \ main.cpp \ diff --git a/ndb/tools/Makefile.am b/ndb/tools/Makefile.am index f0e55058bc3..3ca1cf1b1da 100644 --- a/ndb/tools/Makefile.am +++ b/ndb/tools/Makefile.am @@ -1,14 +1,22 @@ -ndbtools_PROGRAMS = ndb_waiter drop_tab delete_all desc drop_index list_tables select_all select_count +ndbtools_PROGRAMS = \ + ndb_waiter \ + ndb_drop_table \ + ndb_delete_all \ + ndb_desc \ + ndb_drop_index \ + ndb_show_tables \ + ndb_select_all \ + ndb_select_count ndb_waiter_SOURCES = waiter.cpp -delete_all_SOURCES = delete_all.cpp -desc_SOURCES = desc.cpp -drop_index_SOURCES = drop_index.cpp -drop_tab_SOURCES = drop_tab.cpp -list_tables_SOURCES = listTables.cpp -select_all_SOURCES = select_all.cpp -select_count_SOURCES = select_count.cpp +ndb_delete_all_SOURCES = delete_all.cpp +ndb_desc_SOURCES = desc.cpp +ndb_drop_index_SOURCES = drop_index.cpp +ndb_drop_table_SOURCES = drop_tab.cpp +ndb_show_tables_SOURCES = listTables.cpp +ndb_select_all_SOURCES = select_all.cpp +ndb_select_count_SOURCES = select_count.cpp include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapitools.mk.am