corrected error in ndb programs debug switch

parent b8d46972
...@@ -33,7 +33,11 @@ const char *opt_ndb_connectstring= 0; ...@@ -33,7 +33,11 @@ const char *opt_ndb_connectstring= 0;
const char *opt_connect_str= 0; const char *opt_connect_str= 0;
const char *opt_ndb_mgmd= 0; const char *opt_ndb_mgmd= 0;
char opt_ndb_constrbuf[1024]; char opt_ndb_constrbuf[1024];
unsigned opt_ndb_constrbuf_len; unsigned opt_ndb_constrbuf_len= 0;
#ifndef DBUG_OFF
const char *opt_debug= 0;
#endif
#define OPT_NDB_CONNECTSTRING 'c' #define OPT_NDB_CONNECTSTRING 'c'
...@@ -75,7 +79,8 @@ unsigned opt_ndb_constrbuf_len; ...@@ -75,7 +79,8 @@ unsigned opt_ndb_constrbuf_len;
#ifndef DBUG_OFF #ifndef DBUG_OFF
#define NDB_STD_OPTS(prog_name) \ #define NDB_STD_OPTS(prog_name) \
{ "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \ { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \ (gptr*) &opt_debug, (gptr*) &opt_debug, \
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
NDB_STD_OPTS_COMMON NDB_STD_OPTS_COMMON
#else #else
#define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON #define NDB_STD_OPTS(prog_name) NDB_STD_OPTS_COMMON
...@@ -101,15 +106,21 @@ enum ndb_std_options { ...@@ -101,15 +106,21 @@ enum ndb_std_options {
static my_bool static my_bool
ndb_std_get_one_option(int optid, ndb_std_get_one_option(int optid,
const struct my_option *opt __attribute__((unused)), const struct my_option *opt __attribute__((unused)),
const char *argument) char *argument)
{ {
switch (optid) { switch (optid) {
#ifndef DBUG_OFF
case '#': case '#':
if (argument) if (opt_debug)
{ {
DBUG_PUSH(argument); DBUG_PUSH(opt_debug);
}
else
{
DBUG_PUSH("d:t");
} }
break; break;
#endif
case 'V': case 'V':
ndb_std_print_version(); ndb_std_print_version();
exit(0); exit(0);
......
...@@ -88,13 +88,6 @@ static void usage() ...@@ -88,13 +88,6 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt,
argument ? argument : "d:t:O,/tmp/ndbd.trace");
}
bool bool
Configuration::init(int argc, char** argv) Configuration::init(int argc, char** argv)
...@@ -103,7 +96,11 @@ Configuration::init(int argc, char** argv) ...@@ -103,7 +96,11 @@ Configuration::init(int argc, char** argv)
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndbd.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
exit(ho_error); exit(ho_error);
if (_no_daemon) { if (_no_daemon) {
......
...@@ -87,13 +87,6 @@ static void usage() ...@@ -87,13 +87,6 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_mgm.trace");
}
static int static int
read_and_execute(int _try_reconnect) read_and_execute(int _try_reconnect)
...@@ -136,7 +129,11 @@ int main(int argc, char** argv){ ...@@ -136,7 +129,11 @@ int main(int argc, char** argv){
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_mgm.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
exit(ho_error); exit(ho_error);
char buf[MAXHOSTNAMELEN+10]; char buf[MAXHOSTNAMELEN+10];
......
...@@ -175,14 +175,6 @@ static void usage() ...@@ -175,14 +175,6 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_mgmd.trace");
return 0;
}
/* /*
* MAIN * MAIN
...@@ -206,7 +198,11 @@ int main(int argc, char** argv) ...@@ -206,7 +198,11 @@ int main(int argc, char** argv)
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_mgmd.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
exit(ho_error); exit(ho_error);
if (glob.interactive || if (glob.interactive ||
......
...@@ -8,35 +8,16 @@ ...@@ -8,35 +8,16 @@
static const char* _dbname = "TEST_DB"; static const char* _dbname = "TEST_DB";
static int g_loops = 7; static int g_loops = 7;
static void print_version()
{
printf("MySQL distrib %s, for %s (%s)\n",
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
}
static void usage() static void usage()
{ {
char desc[] = ndb_std_print_version();
"tabname\n"\
"This program list all properties of table(s) in NDB Cluster.\n"\
" ex: desc T1 T2 T4\n";
print_version();
} }
static my_bool static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument)
{ {
switch (optid) { return ndb_std_get_one_option(optid, opt, argument ? argument :
case '#': "d:t:O,/tmp/testBitfield.trace");
DBUG_PUSH(argument ? argument : "d:t:O,/tmp/ndb_desc.trace");
break;
case 'V':
print_version();
exit(0);
case '?':
usage();
exit(0);
}
return 0;
} }
static const NdbDictionary::Table* create_random_table(Ndb*); static const NdbDictionary::Table* create_random_table(Ndb*);
......
...@@ -44,20 +44,17 @@ static void usage() ...@@ -44,20 +44,17 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_delete_all.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "mysql_cluster",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_delete_all.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
Ndb_cluster_connection con(opt_connect_str); Ndb_cluster_connection con(opt_connect_str);
......
...@@ -44,20 +44,17 @@ static void usage() ...@@ -44,20 +44,17 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_desc.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "mysql_cluster",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_desc.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
Ndb_cluster_connection con(opt_connect_str); Ndb_cluster_connection con(opt_connect_str);
......
...@@ -41,20 +41,17 @@ static void usage() ...@@ -41,20 +41,17 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_index.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "mysql_cluster",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
"d:t:O,/tmp/ndb_drop_index.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
if (argc < 1) { if (argc < 1) {
usage(); usage();
......
...@@ -41,20 +41,17 @@ static void usage() ...@@ -41,20 +41,17 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "mysql_cluster",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
"d:t:O,/tmp/ndb_drop_table.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
if (argc < 1) { if (argc < 1) {
usage(); usage();
......
...@@ -196,13 +196,6 @@ static void usage() ...@@ -196,13 +196,6 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_show_tables.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
...@@ -210,7 +203,11 @@ int main(int argc, char** argv){ ...@@ -210,7 +203,11 @@ int main(int argc, char** argv){
const char *load_default_groups[]= { "mysql_cluster",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_show_tables.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
_tabname = argv[0]; _tabname = argv[0];
......
...@@ -109,8 +109,10 @@ static my_bool ...@@ -109,8 +109,10 @@ static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument)
{ {
ndb_std_get_one_option(optid, opt, argument ? argument : #ifndef DBUG_OFF
"d:t:O,/tmp/ndb_restore.trace"); opt_debug= "d:t:O,/tmp/ndb_restore.trace";
#endif
ndb_std_get_one_option(optid, opt, argument);
switch (optid) { switch (optid) {
case 'n': case 'n':
if (ga_nodeId == 0) if (ga_nodeId == 0)
......
...@@ -85,13 +85,6 @@ static void usage() ...@@ -85,13 +85,6 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_select_all.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
...@@ -99,7 +92,11 @@ int main(int argc, char** argv){ ...@@ -99,7 +92,11 @@ int main(int argc, char** argv){
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
const char* _tabname; const char* _tabname;
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_select_all.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
if ((_tabname = argv[0]) == 0) { if ((_tabname = argv[0]) == 0) {
usage(); usage();
......
...@@ -60,20 +60,17 @@ static void usage() ...@@ -60,20 +60,17 @@ static void usage()
my_print_help(my_long_options); my_print_help(my_long_options);
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_select_count.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "mysql_cluster",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_select_count.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
if (argc < 1) { if (argc < 1) {
usage(); usage();
......
...@@ -60,24 +60,19 @@ static void usage() ...@@ -60,24 +60,19 @@ static void usage()
my_print_variables(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)
{
return ndb_std_get_one_option(optid, opt, argument ? argument :
"d:t:O,/tmp/ndb_drop_table.trace");
}
int main(int argc, char** argv){ int main(int argc, char** argv){
NDB_INIT(argv[0]); NDB_INIT(argv[0]);
const char *load_default_groups[]= { "mysql_cluster",0 }; const char *load_default_groups[]= { "mysql_cluster",0 };
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
const char* _hostName = NULL; const char* _hostName = NULL;
int ho_error; int ho_error;
if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) #ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_waiter.trace";
#endif
if ((ho_error=handle_options(&argc, &argv, my_long_options,
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS); return NDBT_ProgramExit(NDBT_WRONGARGS);
char buf[255];
_hostName = argv[0]; _hostName = argv[0];
if (_hostName == 0) if (_hostName == 0)
......
...@@ -298,7 +298,7 @@ my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam, opt_ndbcluster; ...@@ -298,7 +298,7 @@ my_bool opt_console= 0, opt_bdb, opt_innodb, opt_isam, opt_ndbcluster;
const char *opt_ndbcluster_connectstring= 0; const char *opt_ndbcluster_connectstring= 0;
const char *opt_ndb_connectstring= 0; const char *opt_ndb_connectstring= 0;
char opt_ndb_constrbuf[1024]; char opt_ndb_constrbuf[1024];
unsigned opt_ndb_constrbuf_len; unsigned opt_ndb_constrbuf_len= 0;
my_bool opt_ndb_shm, opt_ndb_optimized_node_selection; my_bool opt_ndb_shm, opt_ndb_optimized_node_selection;
ulong opt_ndb_cache_check_time; ulong opt_ndb_cache_check_time;
const char *opt_ndb_mgmd; const char *opt_ndb_mgmd;
......
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