diff options
author | tomas@poseidon.ndb.mysql.com <> | 2005-01-28 00:42:41 +0100 |
---|---|---|
committer | tomas@poseidon.ndb.mysql.com <> | 2005-01-28 00:42:41 +0100 |
commit | 732d1a5e81037407067c345f5f6f33ee95210e6e (patch) | |
tree | b49b8c43f32032d4eac08d9789796e546970efec /ndb/tools | |
parent | 42531336f0b3e79c9b58c41cf46831f30977e359 (diff) | |
download | mariadb-git-732d1a5e81037407067c345f5f6f33ee95210e6e.tar.gz |
Bug#8167 signal usage clash between mysql server and ndb shared memory
added shared memory config parameter, signum for use in signalling
added global variable for holdign signum to be used for shared memory connection
only fiddle with signals if it is set
simplified common ndb client option handling
Diffstat (limited to 'ndb/tools')
-rw-r--r-- | ndb/tools/delete_all.cpp | 23 | ||||
-rw-r--r-- | ndb/tools/desc.cpp | 25 | ||||
-rw-r--r-- | ndb/tools/drop_index.cpp | 23 | ||||
-rw-r--r-- | ndb/tools/drop_tab.cpp | 23 | ||||
-rw-r--r-- | ndb/tools/listTables.cpp | 27 | ||||
-rw-r--r-- | ndb/tools/restore/restore_main.cpp | 20 | ||||
-rw-r--r-- | ndb/tools/select_all.cpp | 23 | ||||
-rw-r--r-- | ndb/tools/select_count.cpp | 23 | ||||
-rw-r--r-- | ndb/tools/waiter.cpp | 25 |
9 files changed, 33 insertions, 179 deletions
diff --git a/ndb/tools/delete_all.cpp b/ndb/tools/delete_all.cpp index cdfaf2134ff..21e0c2ac089 100644 --- a/ndb/tools/delete_all.cpp +++ b/ndb/tools/delete_all.cpp @@ -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){ diff --git a/ndb/tools/desc.cpp b/ndb/tools/desc.cpp index 4bca51ee903..4287a771694 100644 --- a/ndb/tools/desc.cpp +++ b/ndb/tools/desc.cpp @@ -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){ diff --git a/ndb/tools/drop_index.cpp b/ndb/tools/drop_index.cpp index 2b7f8c1bce9..2fcba41bd11 100644 --- a/ndb/tools/drop_index.cpp +++ b/ndb/tools/drop_index.cpp @@ -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){ diff --git a/ndb/tools/drop_tab.cpp b/ndb/tools/drop_tab.cpp index 2b0b6908449..091db5cc4b7 100644 --- a/ndb/tools/drop_tab.cpp +++ b/ndb/tools/drop_tab.cpp @@ -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){ diff --git a/ndb/tools/listTables.cpp b/ndb/tools/listTables.cpp index 710af66f4de..064ec299ef9 100644 --- a/ndb/tools/listTables.cpp +++ b/ndb/tools/listTables.cpp @@ -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){ diff --git a/ndb/tools/restore/restore_main.cpp b/ndb/tools/restore/restore_main.cpp index c24ed620b71..84f9511fe2f 100644 --- a/ndb/tools/restore/restore_main.cpp +++ b/ndb/tools/restore/restore_main.cpp @@ -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; } diff --git a/ndb/tools/select_all.cpp b/ndb/tools/select_all.cpp index 9c65750094b..23fd2290349 100644 --- a/ndb/tools/select_all.cpp +++ b/ndb/tools/select_all.cpp @@ -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){ diff --git a/ndb/tools/select_count.cpp b/ndb/tools/select_count.cpp index 516eebda91d..a9a3e71da67 100644 --- a/ndb/tools/select_count.cpp +++ b/ndb/tools/select_count.cpp @@ -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){ diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index dfdb11524e3..cc6a21428c8 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -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){ |