summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.ndb.mysql.com>2004-11-15 12:40:32 +0000
committerunknown <tomas@poseidon.ndb.mysql.com>2004-11-15 12:40:32 +0000
commitc60412e708ca8aa9fceb148d2cde80ab702e23c0 (patch)
treeee9f6698fecd6c7653b7fc0f8668138e23025c75
parent166671ccac00134b80a76833879b15290905539e (diff)
downloadmariadb-git-c60412e708ca8aa9fceb148d2cde80ab702e23c0.tar.gz
changed compile order, mysqladmin with ndbcluster extensions needs ndb to be compiled first
added libs variable for ndbmgmclient used by mysqladmin add linkage with @ndb_mgmclient_libs@ additional options for ndbcluster added support for managing the cluster to mysqladmin added DEFINE_CXA_PURE_VIRTUAL flag to CFLAGS to enable linkage with c++ libs use macros for C_MODE_START/END so that define of FIX_GCC_LINKING_PROBLEM works in c-programs Makefile.am: changed compile order, mysqladming with ndbcluster extensions needs ndb to be compiled first acinclude.m4: added libs variable for ndbmgmclient used by mysqladmin client/Makefile.am: add linkage with @ndb_mgmclient_libs@ client/client_priv.h: additional options for ndbcluster client/mysqladmin.c: added support for managing the cluster to mysqladmin configure.in: added DEFINE_CXA_PURE_VIRTUAL flag to CFLAGS to enable linkage with c++ libs include/my_global.h: use macros for C_MODE_START/END so that define of FIX_GCC_LINKING_PROBLEM works in c-programs
-rw-r--r--Makefile.am8
-rw-r--r--acinclude.m43
-rw-r--r--client/Makefile.am3
-rw-r--r--client/client_priv.h3
-rw-r--r--client/mysqladmin.c47
-rw-r--r--configure.in1
-rw-r--r--include/my_global.h4
7 files changed, 61 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am
index 0dbb5032e15..0770854f176 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,15 +22,15 @@ AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT
SUBDIRS = . include @docs_dirs@ @zlib_dir@ \
@readline_topdir@ sql-common \
- @thread_dirs@ pstack @sql_client_dirs@ \
- @sql_server_dirs@ scripts man tests \
+ @thread_dirs@ pstack \
+ @sql_server_dirs@ @sql_client_dirs@ scripts man tests \
netware @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
DIST_SUBDIRS = . include @docs_dirs@ zlib \
@readline_topdir@ sql-common \
- @thread_dirs@ pstack @sql_client_dirs@ \
- @sql_server_dirs@ scripts @man_dirs@ tests SSL\
+ @thread_dirs@ pstack \
+ @sql_server_dirs@ @sql_client_dirs@ scripts @man_dirs@ tests SSL\
BUILD netware os2 @libmysqld_dirs@ \
@bench_dirs@ support-files @fs_dirs@ @tools_dirs@
diff --git a/acinclude.m4 b/acinclude.m4
index 448bf7a2653..81917372206 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1678,6 +1678,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
have_ndbcluster=no
ndbcluster_includes=
ndbcluster_libs=
+ ndb_mgmclient_libs=
case "$ndbcluster" in
yes )
AC_MSG_RESULT([Using NDB Cluster])
@@ -1686,6 +1687,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
ndbcluster_includes="-I../ndb/include -I../ndb/include/ndbapi"
ndbcluster_libs="\$(top_builddir)/ndb/src/.libs/libndbclient.a"
ndbcluster_system_libs=""
+ ndb_mgmclient_libs="\$(top_builddir)/ndb/src/mgmclient/libndbmgmclient.la"
MYSQL_CHECK_NDB_OPTIONS
;;
* )
@@ -1697,6 +1699,7 @@ AC_DEFUN([MYSQL_CHECK_NDBCLUSTER], [
AC_SUBST(ndbcluster_includes)
AC_SUBST(ndbcluster_libs)
AC_SUBST(ndbcluster_system_libs)
+ AC_SUBST(ndb_mgmclient_libs)
])
dnl ---------------------------------------------------------------------------
diff --git a/client/Makefile.am b/client/Makefile.am
index a9da284a753..58398548b75 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -20,7 +20,8 @@
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \
$(openssl_includes)
LIBS = @CLIENT_LIBS@
-DEPLIB= ../libmysql/libmysqlclient.la
+DEPLIB= ../libmysql/libmysqlclient.la \
+ @ndb_mgmclient_libs@
LDADD = @CLIENT_EXTRA_LDFLAGS@ $(DEPLIB)
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog mysqlmanagerc mysqlmanager-pwgen
diff --git a/client/client_priv.h b/client/client_priv.h
index f16ec0e802b..184eed241ed 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -46,4 +46,7 @@ enum options_client
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS,
OPT_START_POSITION, OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_SIGINT_IGNORE, OPT_HEXBLOB
+#ifdef HAVE_NDBCLUSTER_DB
+ ,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING
+#endif
};
diff --git a/client/mysqladmin.c b/client/mysqladmin.c
index 6258b9685a5..a32dfa14d28 100644
--- a/client/mysqladmin.c
+++ b/client/mysqladmin.c
@@ -16,7 +16,6 @@
/* maintaince of mysql databases */
-
#include "client_priv.h"
#include <signal.h>
#ifdef THREAD
@@ -25,6 +24,10 @@
#include <sys/stat.h>
#include <mysql.h>
+#ifdef HAVE_NDBCLUSTER_DB
+#include "../ndb/src/mgmclient/ndb_mgmclient.h"
+#endif
+
#define ADMIN_VERSION "8.41"
#define MAX_MYSQL_VAR 256
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
@@ -42,6 +45,10 @@ static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations,
opt_count_iterations= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
static my_string unix_port=0;
+#ifdef HAVE_NDBCLUSTER_DB
+static my_bool opt_ndbcluster=0;
+static char *opt_ndb_connectstring=0;
+#endif
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
@@ -94,6 +101,9 @@ enum commands {
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD
+#ifdef HAVE_NDBCLUSTER_DB
+ ,ADMIN_NDB_MGM
+#endif
};
static const char *command_names[]= {
"create", "drop", "shutdown",
@@ -104,6 +114,9 @@ static const char *command_names[]= {
"ping", "extended-status", "flush-status",
"flush-privileges", "start-slave", "stop-slave",
"flush-threads","old-password",
+#ifdef HAVE_NDBCLUSTER_DB
+ "ndb-mgm",
+#endif
NullS
};
@@ -184,6 +197,14 @@ static struct my_option my_long_options[] =
{"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (gptr*) &opt_shutdown_timeout,
(gptr*) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
+#ifdef HAVE_NDBCLUSTER_DB
+ {"ndbcluster", OPT_NDBCLUSTER, ""
+ "", (gptr*) &opt_ndbcluster,
+ (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"ndb-connectstring", OPT_NDB_CONNECTSTRING, ""
+ "", (gptr*) &opt_ndb_connectstring,
+ (gptr*) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+#endif
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -882,6 +903,24 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
mysql->reconnect=1; /* Automatic reconnect is default */
break;
+#ifdef HAVE_NDBCLUSTER_DB
+ case ADMIN_NDB_MGM:
+ {
+ if (argc < 2)
+ {
+ my_printf_error(0,"Too few arguments to ndb-mgm",MYF(ME_BELL));
+ return 1;
+ }
+ {
+ Ndb_mgmclient_handle cmd=
+ ndb_mgmclient_handle_create(opt_ndb_connectstring);
+ ndb_mgmclient_execute(cmd, --argc, ++argv);
+ ndb_mgmclient_handle_destroy(cmd);
+ }
+ argc= 0;
+ }
+ break;
+#endif
default:
my_printf_error(0,"Unknown command: '%-.60s'",MYF(ME_BELL),argv[0]);
return 1;
@@ -1248,3 +1287,9 @@ static my_bool wait_pidfile(char *pidfile, time_t last_modified,
}
DBUG_RETURN(error);
}
+#ifdef HAVE_NDBCLUSTER_DB
+/* lib linked in contains c++ code */
+#ifdef __GNUC__
+FIX_GCC_LINKING_PROBLEM
+#endif
+#endif
diff --git a/configure.in b/configure.in
index 1fcba6b8f5f..f360ee46453 100644
--- a/configure.in
+++ b/configure.in
@@ -399,6 +399,7 @@ then
then
if $CXX -v 2>&1 | grep 'version 3' > /dev/null 2>&1
then
+ CFLAGS="$CFLAGS -DDEFINE_CXA_PURE_VIRTUAL"
CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL"
fi
fi
diff --git a/include/my_global.h b/include/my_global.h
index 07d4d8dc1cc..ff59f7bfc55 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -194,10 +194,10 @@ C_MODE_END
/* Fix problem when linking c++ programs with gcc 3.x */
#ifdef DEFINE_CXA_PURE_VIRTUAL
#define FIX_GCC_LINKING_PROBLEM \
-extern "C" { int __cxa_pure_virtual() {\
+C_MODE_START int __cxa_pure_virtual() {\
DBUG_ASSERT("Pure virtual method called." == "Aborted");\
return 0;\
-} }
+} C_MODE_END
#else
#define FIX_GCC_LINKING_PROBLEM
#endif