Commit a332e08e authored by unknown's avatar unknown

Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/export/space/pekka/ndb/version/my50

parents fce978c7 9aad0ae3
......@@ -156,7 +156,7 @@ $ENV{'MYSQL_TCP_PORT'}= $mysql_tcp_port= 3334 + $opt_build_thread*2;
$ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build";
$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
$slave_port=$mysql_tcp_port+16;
$ndbcluster_port= 9350 + $opt_build_thread*2;
$ndbcluster_port= 9350 + $opt_build_thread*4;
$manager_port=$mysql_tcp_port+1;
$mysqladmin_args="--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20";
......
......@@ -1531,14 +1531,11 @@ then
fi
fi
TOOLS_LIBS="$NON_THREADED_CLIENT_LIBS"
# Should we use named pthread library ?
AC_MSG_CHECKING("named thread libs:")
if test "$with_named_thread" != "no"
then
LIBS="$with_named_thread $LIBS $with_named_thread"
TOOLS_LIBS="$with_named_thread $TOOLS_LIBS $with_named_thread"
with_posix_threads="yes"
with_mit_threads="no"
AC_MSG_RESULT("$with_named_thread")
......@@ -1557,9 +1554,7 @@ else
then
AC_MSG_CHECKING("for pthread_create in -lpthread");
ac_save_LIBS="$LIBS"
ac_save_TOOLS_LIBS="$TOOLS_LIBS"
LIBS="$LIBS -lpthread"
TOOLS_LIBS="$TOOLS_LIBS -lpthread"
AC_TRY_LINK(
[#include <pthread.h>],
[ (void) pthread_create((pthread_t*) 0,(pthread_attr_t*) 0, 0, 0); ],
......@@ -1568,7 +1563,6 @@ else
if test "$with_posix_threads" = "no"
then
LIBS=" $ac_save_LIBS -lpthreads"
TOOLS_LIBS=" $ac_save_TOOLS_LIBS -lpthreads"
AC_MSG_CHECKING("for pthread_create in -lpthreads");
AC_TRY_LINK(
[#include <pthread.h>],
......@@ -1579,7 +1573,6 @@ else
then
# This is for FreeBSD
LIBS="$ac_save_LIBS -pthread"
TOOLS_LIBS="$ac_save_TOOLS_LIBS -pthread"
AC_MSG_CHECKING("for pthread_create in -pthread");
AC_TRY_LINK(
[#include <pthread.h>],
......@@ -1590,7 +1583,6 @@ else
then
with_mit_threads="yes"
LIBS="$ac_save_LIBS"
TOOLS_LIBS="$ac_save_TOOLS_LIBS"
fi
fi
fi
......@@ -2656,8 +2648,6 @@ AC_SUBST(sql_union_dirs)
# Some usefull subst
AC_SUBST(CC)
AC_SUBST(GXX)
#Remove TOOLS_LIBS, because this is included in LIBRARIES
#AC_SUBST(TOOLS_LIBS)
# Set configuration options for make_binary_distribution
case $SYSTEM_TYPE in
......
......@@ -9,6 +9,7 @@ ndb_version.h
ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
ndbapi/ndb_opt_defaults.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbTransaction.hpp \
......
......@@ -121,6 +121,7 @@
#define CFG_SHM_CHECKSUM 501
#define CFG_SHM_KEY 502
#define CFG_SHM_BUFFER_MEM 503
#define CFG_SHM_SIGNUM 504
#define CFG_SCI_HOST1_ID_0 550
#define CFG_SCI_HOST1_ID_1 551
......
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NDB_OPT_DEFAULTS_H
#define NDB_OPT_DEFAULTS_H
#ifdef SIGRTMIN
#define OPT_NDB_SHM_SIGNUM_DEFAULT SIGRTMIN+2
#else
#define OPT_NDB_SHM_SIGNUM_DEFAULT 0
#endif
#define OPT_NDB_SHM_DEFAULT 0
#endif
......@@ -77,6 +77,7 @@ struct SHM_TransporterConfiguration {
Uint32 shmKey;
Uint32 shmSize;
int signum;
};
/**
......
......@@ -22,24 +22,16 @@
#include <my_getopt.h>
#include <mysql_version.h>
#include <ndb_version.h>
#include <ndb_opt_defaults.h>
#define NDB_STD_OPTS_VARS \
const char *opt_connect_str= 0;\
my_bool opt_ndb_shm;\
my_bool opt_ndb_optimized_node_selection
#define NDB_STD_OPTS_OPTIONS \
OPT_NDB_SHM= 256,\
OPT_NDB_OPTIMIZED_NODE_SELECTION
my_bool opt_ndb_shm;
#define OPT_NDB_CONNECTSTRING 'c'
#if defined(NOT_ENOUGH_TESTED) && defined(NDB_SHM_TRANSPORTER) && MYSQL_VERSION_ID >= 50000
#define OPT_NDB_SHM_DEFAULT 1
#else
#define OPT_NDB_SHM_DEFAULT 0
#endif
#define NDB_STD_OPTS_COMMON \
{ "usage", '?', "Display this help and exit.", \
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, \
......@@ -75,4 +67,51 @@ OPT_NDB_OPTIMIZED_NODE_SELECTION
#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
#endif
static void ndb_std_print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage();
enum ndb_std_options {
OPT_NDB_SHM= 256,
OPT_NDB_SHM_SIGNUM,
OPT_NDB_OPTIMIZED_NODE_SELECTION,
NDB_STD_OPTIONS_LAST /* should always be last in this enum */
};
static my_bool
ndb_std_get_one_option(int optid,
const struct my_option *opt __attribute__((unused)),
const char *argument)
{
switch (optid) {
case '#':
if (argument)
{
DBUG_PUSH(argument);
}
break;
case 'V':
ndb_std_print_version();
exit(0);
case '?':
usage();
exit(0);
case OPT_NDB_SHM:
if (opt_ndb_shm)
{
#ifndef NDB_SHM_TRANSPORTER
printf("Warning: binary not compiled with shared memory support,\n"
"Tcp connections will now be used instead\n");
opt_ndb_shm= 0;
#endif
}
break;
}
return 0;
}
#endif /*_NDB_OPTS_H */
......@@ -14,7 +14,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "IPCConfig.hpp"
#include <ndb_global.h>
#include <ndb_opt_defaults.h>
#include <IPCConfig.hpp>
#include <NdbOut.hpp>
#include <NdbHost.h>
......@@ -381,7 +383,12 @@ IPCConfig::configureTransporters(Uint32 nodeId,
if(iter.get(CFG_SHM_KEY, &conf.shmKey)) break;
if(iter.get(CFG_SHM_BUFFER_MEM, &conf.shmSize)) break;
{
Uint32 tmp;
if(iter.get(CFG_SHM_SIGNUM, &tmp)) break;
conf.signum= tmp;
}
conf.port= server_port;
conf.localHostName = localHostName;
conf.remoteHostName = remoteHostName;
......
......@@ -24,6 +24,10 @@
/*#define USE_PTHREAD_EXTRAS*/
#ifdef NDB_SHM_TRANSPORTER
int g_ndb_shm_signum= 0;
#endif
struct NdbThread
{
pthread_t thread;
......@@ -37,14 +41,19 @@ void*
ndb_thread_wrapper(void* _ss){
void * ret;
struct NdbThread * ss = (struct NdbThread *)_ss;
DBUG_ENTER("ndb_thread_wrapper");
#ifdef NDB_SHM_TRANSPORTER
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, 0);
if (g_ndb_shm_signum)
{
sigset_t mask;
DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
sigemptyset(&mask);
sigaddset(&mask, g_ndb_shm_signum);
pthread_sigmask(SIG_BLOCK, &mask, 0);
}
#endif
ret= (* ss->func)(ss->object);
return ret;
DBUG_RETURN(ret);
}
......
......@@ -26,6 +26,8 @@
#include <InputStream.hpp>
#include <OutputStream.hpp>
extern int g_ndb_shm_signum;
SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
const char *lHostName,
const char *rHostName,
......@@ -62,7 +64,9 @@ SHM_Transporter::~SHM_Transporter(){
bool
SHM_Transporter::initTransporter(){
return true;
if (g_ndb_shm_signum)
return true;
return false;
}
void
......@@ -355,6 +359,6 @@ SHM_Transporter::doSend()
if(m_last_signal)
{
m_last_signal = 0;
kill(m_remote_pid, SIGUSR1);
kill(m_remote_pid, g_ndb_shm_signum);
}
}
......@@ -38,6 +38,7 @@
#ifdef NDB_SHM_TRANSPORTER
#include "SHM_Transporter.hpp"
extern int g_ndb_shm_signum;
#endif
#include "TransporterCallback.hpp"
......@@ -152,22 +153,13 @@ TransporterRegistry::disconnectAll(){
bool
TransporterRegistry::init(NodeId nodeId) {
DBUG_ENTER("TransporterRegistry::init");
nodeIdSpecified = true;
localNodeId = nodeId;
DEBUG("TransporterRegistry started node: " << localNodeId);
#ifdef NDB_SHM_TRANSPORTER
/**
* Make sure to block SIGUSR1
* TransporterRegistry::init is run from "main" thread
*/
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, 0);
#endif
return true;
DBUG_RETURN(true);
}
bool
......@@ -406,6 +398,7 @@ TransporterRegistry::createTransporter(SCI_TransporterConfiguration *config) {
bool
TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
DBUG_ENTER("TransporterRegistry::createTransporter SHM");
#ifdef NDB_SHM_TRANSPORTER
if(!nodeIdSpecified){
init(config->localNodeId);
......@@ -414,6 +407,22 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
if(config->localNodeId != localNodeId)
return false;
if (!g_ndb_shm_signum) {
g_ndb_shm_signum= config->signum;
DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
/**
* Make sure to block g_ndb_shm_signum
* TransporterRegistry::init is run from "main" thread
*/
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, g_ndb_shm_signum);
pthread_sigmask(SIG_BLOCK, &mask, 0);
}
if(config->signum != g_ndb_shm_signum)
return false;
if(theTransporters[config->remoteNodeId] != NULL)
return false;
......@@ -443,9 +452,9 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
nTransporters++;
nSHMTransporters++;
return true;
DBUG_RETURN(true);
#else
return false;
DBUG_RETURN(false);
#endif
}
......@@ -1337,6 +1346,7 @@ shm_sig_handler(int signo)
void
TransporterRegistry::startReceiving()
{
DBUG_ENTER("TransporterRegistry::startReceiving");
#ifdef NDB_OSE_TRANSPORTER
if(theOSEReceiver != NULL){
theOSEReceiver->createPhantom();
......@@ -1355,26 +1365,34 @@ TransporterRegistry::startReceiving()
#ifdef NDB_SHM_TRANSPORTER
m_shm_own_pid = getpid();
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, SIGUSR1);
pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
sa.sa_handler = shm_sig_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
int ret;
while((ret = sigaction(SIGUSR1, &sa, 0)) == -1 && errno == EINTR);
if(ret != 0)
if (g_ndb_shm_signum)
{
g_eventLogger.error("Failed to install signal handler for SHM transporter"
" errno: %d (%s)", errno,
DBUG_PRINT("info",("Install signal handler for signum %d",
g_ndb_shm_signum));
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, g_ndb_shm_signum);
pthread_sigmask(SIG_UNBLOCK, &sa.sa_mask, 0);
sa.sa_handler = shm_sig_handler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
int ret;
while((ret = sigaction(g_ndb_shm_signum, &sa, 0)) == -1 && errno == EINTR);
if(ret != 0)
{
DBUG_PRINT("error",("Install failed"));
g_eventLogger.error("Failed to install signal handler for"
" SHM transporter errno: %d (%s)", errno,
#ifdef HAVE_STRERROR
strerror(errno));
strerror(errno)
#else
"");
""
#endif
);
}
}
#endif
#endif // NDB_SHM_TRANSPORTER
DBUG_VOID_RETURN;
}
void
......
......@@ -15,7 +15,10 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> /* Needed for mkdir(2) */
#include <ndb_opts.h>
#include <my_sys.h>
#include <my_getopt.h>
#include <mysql_version.h>
#include <ndb_version.h>
#include "CPCD.hpp"
#include "APIService.hpp"
......
......@@ -47,8 +47,7 @@ extern "C" {
extern EventLogger g_eventLogger;
enum ndbd_options {
NDB_STD_OPTS_OPTIONS,
OPT_INITIAL,
OPT_INITIAL = NDB_STD_OPTIONS_LAST,
OPT_NODAEMON
};
......@@ -82,14 +81,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -97,18 +92,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndbd.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt,
argument ? argument : "d:t:O,/tmp/ndbd.trace");
}
bool
......
......@@ -56,9 +56,6 @@ handler(int sig){
}
}
enum ndb_mgm_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char default_prompt[]= "ndb_mgm> ";
......@@ -83,14 +80,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS] [hostname [port]]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -98,18 +91,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgm.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_mgm.trace");
}
static int
......
......@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <ndb_opt_defaults.h>
#include <NdbTCP.h>
#include "ConfigInfo.hpp"
......@@ -1765,6 +1766,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"0",
STR_VALUE(MAX_INT_RNIL) },
{
CFG_SHM_SIGNUM,
"Signum",
"SHM",
"Signum to be used for signalling",
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
UNDEFINED,
"0",
STR_VALUE(MAX_INT_RNIL) },
{
CFG_CONNECTION_NODE_1,
"NodeId1",
......@@ -3190,18 +3203,27 @@ bool
fixShmKey(InitConfigFileParser::Context & ctx, const char *)
{
DBUG_ENTER("fixShmKey");
Uint32 id1= 0, id2= 0, key= 0;
require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2));
if(ctx.m_currentSection->get("ShmKey", &key))
{
DBUG_RETURN(true);
Uint32 signum;
if(!ctx.m_currentSection->get("Signum", &signum))
{
signum= OPT_NDB_SHM_SIGNUM_DEFAULT;
ctx.m_currentSection->put("Signum", signum);
DBUG_PRINT("info",("Added Signum=%u", signum));
}
}
{
Uint32 id1= 0, id2= 0, key= 0;
require(ctx.m_currentSection->get("NodeId1", &id1));
require(ctx.m_currentSection->get("NodeId2", &id2));
if(!ctx.m_currentSection->get("ShmKey", &key))
{
require(ctx.m_userProperties.get("ShmUniqueId", &key));
key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
ctx.m_currentSection->put("ShmKey", key);
DBUG_PRINT("info",("Added ShmKey=0x%x", key));
}
}
require(ctx.m_userProperties.get("ShmUniqueId", &key));
key= key << 16 | (id1 > id2 ? id1 << 8 | id2 : id2 << 8 | id1);
ctx.m_currentSection->put("ShmKey", key);
DBUG_PRINT("info",("Added ShmKey=0x%x", key));
DBUG_RETURN(true);
}
......
......@@ -134,8 +134,7 @@ extern EventLogger g_eventLogger;
extern int global_mgmt_server_check;
enum ndb_mgmd_options {
NDB_STD_OPTS_OPTIONS,
OPT_INTERACTIVE,
OPT_INTERACTIVE = NDB_STD_OPTIONS_LAST,
OPT_NO_NODEID_CHECKS,
OPT_NO_DAEMON
};
......@@ -169,14 +168,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -184,25 +179,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_mgmd.trace");
break;
case 'V':
print_version();
exit(0);
case OPT_NDB_SHM:
#ifndef NDB_SHM_TRANSPORTER
printf("Warning: binary not compiled with shared memory support,\n"
"use configure option --with-ndb-shm to enable support.\n"
"Tcp connections will now be used instead\n");
opt_ndb_shm= 0;
#endif
break;
case '?':
usage();
exit(0);
}
ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_mgmd.trace");
return 0;
}
......
......@@ -24,9 +24,6 @@
static int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism=240);
enum ndb_delete_all {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -38,16 +35,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program will delete all records in the specified table using scan delete.\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -55,18 +48,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_delete_all.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_delete_all.trace");
}
int main(int argc, char** argv){
......
......@@ -19,9 +19,6 @@
#include <NDBT.hpp>
#include <NdbApi.hpp>
enum ndb_desc_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -37,17 +34,13 @@ static struct my_option my_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program list all properties of table(s) in NDB Cluster.\n"\
" ex: desc T1 T2 T4\n";
print_version();
" ex: desc T1 T2 T4\n";
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -55,18 +48,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_desc.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_desc.trace");
}
int main(int argc, char** argv){
......
......@@ -21,9 +21,6 @@
#include <NdbApi.hpp>
#include <NDBT.hpp>
enum ndb_drop_index_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -35,16 +32,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"<indexname>+\n"\
"This program will drop index(es) in Ndb\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -52,18 +45,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_index.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_index.trace");
}
int main(int argc, char** argv){
......
......@@ -21,9 +21,6 @@
#include <NdbApi.hpp>
#include <NDBT.hpp>
enum ndb_drop_table_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -35,16 +32,12 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program will drop one table in Ndb\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -52,18 +45,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){
......
......@@ -161,9 +161,6 @@ list(const char * tabname,
}
}
enum ndb_show_tables_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -186,20 +183,16 @@ static struct my_option my_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname\n"\
"This program list all system objects in NDB Cluster.\n"\
"Type of objects to display can be limited with -t option\n"\
" ex: list_tables -t 2 would show all UserTables\n"\
" ex: ndb_show_tables -t 2 would show all UserTables\n"\
"To show all indexes for a table write table name as final argument\n"\
" ex: list_tables T1\n";
print_version();
" ex: ndb_show_tables T1\n";
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -207,18 +200,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_show_tables.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_show_tables.trace");
}
int main(int argc, char** argv){
......
......@@ -36,9 +36,6 @@ static Vector<class BackupConsumer *> g_consumers;
static const char* ga_backupPath = "." DIR_SEPARATOR;
enum ndb_restore_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
/**
......@@ -101,14 +98,10 @@ static void short_usage_sub(void)
{
printf("Usage: %s [OPTIONS] [<path to backup files>]\n", my_progname);
}
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
short_usage_sub();
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -116,13 +109,9 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_restore.trace");
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_restore.trace");
break;
case 'V':
print_version();
exit(0);
case 'n':
if (ga_nodeId == 0)
{
......@@ -137,9 +126,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(1);
}
break;
case '?':
usage();
exit(0);
}
return 0;
}
......
......@@ -36,9 +36,6 @@ int scanReadRecords(Ndb*,
bool orderby,
bool descending);
enum ndb_select_all_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -75,10 +72,6 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
......@@ -88,7 +81,7 @@ static void usage()
"(It only print error messages if it encounters a permanent error.)\n"\
"It can also be used to dump the content of a table to file \n"\
" ex: select_all --no-header --delimiter=';' T4 > T4.data\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -96,18 +89,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_all.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_select_all.trace");
}
int main(int argc, char** argv){
......
......@@ -32,9 +32,6 @@ select_count(Ndb* pNdb, const NdbDictionary::Table* pTab,
int* count_rows,
NdbOperation::LockMode lock);
enum ndb_select_count_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -54,16 +51,12 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
char desc[] =
"tabname1 ... tabnameN\n"\
"This program will count the number of records in tables\n";
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
......@@ -71,18 +64,8 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_select_count.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_select_count.trace");
}
int main(int argc, char** argv){
......
......@@ -31,8 +31,7 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status,
unsigned int _timeout);
enum ndb_waiter_options {
NDB_STD_OPTS_OPTIONS,
OPT_WAIT_STATUS_NOT_STARTED
OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST
};
NDB_STD_OPTS_VARS;
......@@ -53,32 +52,20 @@ static struct my_option my_long_options[] =
GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage()
{
print_version();
ndb_std_print_version();
my_print_help(my_long_options);
my_print_variables(my_long_options);
}
static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument)
{
switch (optid) {
case '#':
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_drop_table.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){
......
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