Commit c5922fcc authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.ndb.mysql.com:/home/tomas/mysql-4.1

parents b485ed7b df7bb879
......@@ -8,6 +8,7 @@ ndb_version.h
ndbapiinclude_HEADERS = \
ndbapi/ndbapi_limits.h \
ndbapi/ndb_opt_defaults.h \
ndbapi/Ndb.hpp \
ndbapi/NdbApi.hpp \
ndbapi/NdbConnection.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(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;
......@@ -35,16 +39,21 @@ struct NdbThread
static
void*
ndb_thread_wrapper(void* _ss){
DBUG_ENTER("ndb_thread_wrapper");
void * ret;
struct NdbThread * ss = (struct NdbThread *)_ss;
#ifdef NDB_SHM_TRANSPORTER
sigset_t mask;
sigemptyset(&mask);
sigaddset(&mask, SIGUSR1);
pthread_sigmask(SIG_BLOCK, &mask, 0);
if (g_ndb_shm_signum)
{
DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
sigset_t mask;
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"
......@@ -148,22 +149,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
......@@ -402,6 +394,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);
......@@ -410,6 +403,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;
......@@ -439,9 +448,9 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
nTransporters++;
nSHMTransporters++;
return true;
DBUG_RETURN(true);
#else
return false;
DBUG_RETURN(false);
#endif
}
......@@ -1311,6 +1320,7 @@ shm_sig_handler(int signo)
void
TransporterRegistry::startReceiving()
{
DBUG_ENTER("TransporterRegistry::startReceiving");
#ifdef NDB_OSE_TRANSPORTER
if(theOSEReceiver != NULL){
theOSEReceiver->createPhantom();
......@@ -1329,26 +1339,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"
......@@ -1753,6 +1754,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",
......@@ -3178,18 +3191,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);
}
......
......@@ -91,8 +91,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
};
......@@ -139,14 +138,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);
}
......@@ -154,30 +149,15 @@ 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);
ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_mgmd.trace");
#if NDB_VERSION_MAJOR <= 4
switch (optid) {
case 'c':
printf("Warning: -c will be removed in 5.0, use -f instead\n");
break;
#endif
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);
}
#endif
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*,
char delim,
bool orderby);
enum ndb_select_all_options {
NDB_STD_OPTS_OPTIONS
};
NDB_STD_OPTS_VARS;
static const char* _dbname = "TEST_DB";
......@@ -72,10 +69,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[] =
......@@ -85,7 +78,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);
}
......@@ -93,18 +86,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,
UtilTransactions::ScanLock 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