Commit 595d467d authored by unknown's avatar unknown

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
parent fe37a147
......@@ -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@
......
......@@ -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 ---------------------------------------------------------------------------
......
......@@ -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
......
......@@ -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
};
......@@ -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
......@@ -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
......
......@@ -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
......
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