3524 Magnus Blåudd 2010-05-05 [merge]
Merge
modified:
sql/ha_ndbcluster_connection.cc
sql/mysqld.cc
sql/set_var.cc
storage/ndb/include/mgmcommon/ConfigRetriever.hpp
storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
storage/ndb/include/ndbapi/ndb_opt_defaults.h
storage/ndb/include/util/ndb_opts.h
storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp
storage/ndb/src/common/util/ndb_opts.c
storage/ndb/src/kernel/angel.cpp
storage/ndb/src/kernel/main.cpp
storage/ndb/src/kernel/vm/Configuration.cpp
storage/ndb/src/kernel/vm/Configuration.hpp
storage/ndb/src/mgmclient/main.cpp
storage/ndb/src/mgmsrv/ConfigInfo.cpp
storage/ndb/src/mgmsrv/ConfigManager.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
storage/ndb/src/mgmsrv/main.cpp
storage/ndb/src/mgmsrv/testConfig.cpp
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
storage/ndb/test/ndbapi/testBitfield.cpp
storage/ndb/test/ndbapi/testIndexStat.cpp
storage/ndb/test/ndbapi/testNdbApi.cpp
storage/ndb/test/ndbapi/test_event_merge.cpp
storage/ndb/test/run-test/main.cpp
storage/ndb/test/src/NDBT_Test.cpp
storage/ndb/test/tools/connect.cpp
storage/ndb/test/tools/log_listner.cpp
storage/ndb/tools/delete_all.cpp
storage/ndb/tools/desc.cpp
storage/ndb/tools/drop_index.cpp
storage/ndb/tools/drop_tab.cpp
storage/ndb/tools/listTables.cpp
storage/ndb/tools/ndb_config.cpp
storage/ndb/tools/restore/Restore.hpp
storage/ndb/tools/restore/consumer_restore.cpp
storage/ndb/tools/restore/consumer_restore.hpp
storage/ndb/tools/restore/restore_main.cpp
storage/ndb/tools/select_all.cpp
storage/ndb/tools/select_count.cpp
storage/ndb/tools/waiter.cpp
3523 Magnus Blåudd 2010-05-04
ndb
- remove two debug printouts using AttributeMask::getText
which is now blowing the buffer when the AttributeMask is bigger.
modified:
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
=== modified file 'sql/ha_ndbcluster_connection.cc'
--- a/sql/ha_ndbcluster_connection.cc 2009-11-17 15:57:14 +0000
+++ b/sql/ha_ndbcluster_connection.cc 2010-05-04 14:34:54 +0000
@@ -29,6 +29,7 @@
/* options from from mysqld.cc */
extern "C" const char *opt_ndb_connectstring;
+extern "C" int opt_ndb_nodeid;
extern ulong opt_ndb_wait_connected;
Ndb* g_ndb= NULL;
@@ -65,7 +66,7 @@ int ndbcluster_connect(int (*connect_cal
if (opt_ndb_connectstring != 0)
DBUG_PRINT("connectstring", ("%s", opt_ndb_connectstring));
if ((g_ndb_cluster_connection=
- new Ndb_cluster_connection(opt_ndb_connectstring)) == 0)
+ new Ndb_cluster_connection(opt_ndb_connectstring, opt_ndb_nodeid)) == 0)
{
sql_print_error("NDB: failed to allocate global "
"ndb cluster connection object");
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-04-13 16:03:22 +0000
+++ b/sql/mysqld.cc 2010-05-04 14:34:54 +0000
@@ -39,15 +39,6 @@
#include <sys/prctl.h>
#endif
-#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-#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
-#endif
-
#ifndef DEFAULT_SKIP_THREAD_PRIORITY
#define DEFAULT_SKIP_THREAD_PRIORITY 0
#endif
@@ -475,11 +466,7 @@ my_bool opt_ndb_log_bin= FALSE;
my_bool opt_ndb_log_empty_epochs= FALSE;
-extern "C" char opt_ndb_constrbuf[1024];
-extern "C" my_bool opt_ndb_shm;
extern "C" const char *opt_ndb_connectstring;
-extern "C" unsigned opt_ndb_constrbuf_len;
-extern "C" const char *opt_ndb_mgmd;
extern "C" ulong opt_ndb_nodeid;
extern const char *ndb_distribution_names[];
extern TYPELIB ndb_distribution_typelib;
@@ -5676,7 +5663,7 @@ enum options_mysqld
OPT_ENGINE_CONDITION_PUSHDOWN, OPT_NDB_CONNECTSTRING,
OPT_NDB_USE_EXACT_COUNT, OPT_NDB_USE_TRANSACTIONS,
OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
- OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
+ OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
OPT_NDB_BATCH_SIZE,
OPT_NDB_OPTIMIZATION_DELAY,
OPT_NDB_TABLE_TEMPORARY,
@@ -6239,12 +6226,13 @@ master-ssl",
(uchar**) &opt_ndb_connectstring,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-mgmd-host", OPT_NDB_MGMD,
- "Set host and port for ndb_mgmd. Syntax: hostname[:port]",
- (uchar**) &opt_ndb_mgmd,
- (uchar**) &opt_ndb_mgmd,
+ "same as --ndb-connectstring.",
+ (uchar**) &opt_ndb_connectstring,
+ (uchar**) &opt_ndb_connectstring,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-nodeid", OPT_NDB_NODEID,
- "Nodeid for this mysqlserver in the cluster.",
+ "Set node id for this node. Overrides node id specified "
+ "in --ndb-connectstring.",
(uchar**) &opt_ndb_nodeid,
(uchar**) &opt_ndb_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -6344,11 +6332,6 @@ master-ssl",
(uchar**) &global_system_variables.ndb_use_transactions,
(uchar**) &global_system_variables.ndb_use_transactions,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
- {"ndb-shm", OPT_NDB_SHM,
- "Use shared memory connections when available.",
- (uchar**) &opt_ndb_shm,
- (uchar**) &opt_ndb_shm,
- 0, GET_BOOL, OPT_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0},
{"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,
"Select nodes for transactions in a more optimal way.",
(uchar**) &global_system_variables.ndb_optimized_node_selection,
@@ -8527,29 +8510,6 @@ mysqld_get_one_option(int optid,
break;
}
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
- case OPT_NDB_MGMD:
- case OPT_NDB_NODEID:
- {
- int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
- sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
- "%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"",
- optid == OPT_NDB_NODEID ? "nodeid=" : "",
- argument);
- opt_ndb_constrbuf_len+= len;
- }
- /* fall through to add the connectstring to the end
- * and set opt_ndb_connectstring
- */
- case OPT_NDB_CONNECTSTRING:
- if (opt_ndb_connectstring && opt_ndb_connectstring[0])
- my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
- sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
- "%s%s", opt_ndb_constrbuf_len > 0 ? ",":"",
- opt_ndb_connectstring);
- else
- opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0;
- opt_ndb_connectstring= opt_ndb_constrbuf;
- break;
case OPT_NDB_DISTRIBUTION:
int id;
id= find_type_or_exit(argument, &ndb_distribution_typelib, opt->name);
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2010-03-23 08:41:15 +0000
+++ b/sql/set_var.cc 2010-05-04 14:34:54 +0000
@@ -68,7 +68,7 @@
/* WITH_NDBCLUSTER_STORAGE_ENGINE */
#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
extern ulong ndb_cache_check_time;
-extern "C" char opt_ndb_constrbuf[];
+extern "C" char *opt_ndb_connectstring;
extern ulong ndb_extra_logging;
extern ulong ndb_report_thresh_binlog_epoch_slip;
extern ulong ndb_report_thresh_binlog_mem_usage;
@@ -741,7 +741,7 @@ sys_ndb_batch_size(&vars, "ndb_batch_siz
static sys_var_long_ptr
sys_ndb_cache_check_time(&vars, "ndb_cache_check_time", &ndb_cache_check_time);
static sys_var_const_str
-sys_ndb_connectstring(&vars, "ndb_connectstring", opt_ndb_constrbuf);
+sys_ndb_connectstring(&vars, "ndb_connectstring", opt_ndb_connectstring);
static sys_var_thd_bool
sys_ndb_index_stat_enable(&vars, "ndb_index_stat_enable",
&SV::ndb_index_stat_enable);
=== modified file 'storage/ndb/include/mgmcommon/ConfigRetriever.hpp'
--- a/storage/ndb/include/mgmcommon/ConfigRetriever.hpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/include/mgmcommon/ConfigRetriever.hpp 2010-05-04 14:34:54 +0000
@@ -29,7 +29,7 @@
*/
class ConfigRetriever {
public:
- ConfigRetriever(const char * _connect_string,
+ ConfigRetriever(const char * _connect_string, int force_nodeid,
Uint32 version, ndb_mgm_node_type nodeType,
const char * _bind_address = 0,
int timeout_ms = 30000);
=== modified file 'storage/ndb/include/ndbapi/ndb_cluster_connection.hpp'
--- a/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp 2009-07-03 06:34:01 +0000
+++ b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp 2010-05-04 14:34:54 +0000
@@ -56,6 +56,18 @@ public:
* management server
*/
Ndb_cluster_connection(const char * connectstring = 0);
+
+ /**
+ * Create a connection to a cluster of storage nodes
+ *
+ * @param connectstring The connectstring for where to find the
+ * management server
+ * @param force_api_node The nodeid to use for this API node, will
+ * override any nodeid=<nodeid> specified in
+ * connectstring
+ */
+ Ndb_cluster_connection(const char * connectstring, int force_api_nodeid);
+
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
Ndb_cluster_connection(const char * connectstring,
Ndb_cluster_connection *main_connection);
=== modified file 'storage/ndb/include/ndbapi/ndb_opt_defaults.h'
--- a/storage/ndb/include/ndbapi/ndb_opt_defaults.h 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/include/ndbapi/ndb_opt_defaults.h 2010-05-05 09:30:08 +0000
@@ -19,7 +19,4 @@
#ifndef NDB_OPT_DEFAULTS_H
#define NDB_OPT_DEFAULTS_H
-#define OPT_NDB_SHM_SIGNUM_DEFAULT 0
-#define OPT_NDB_SHM_DEFAULT 0
-
#endif
=== modified file 'storage/ndb/include/util/ndb_opts.h'
--- a/storage/ndb/include/util/ndb_opts.h 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/include/util/ndb_opts.h 2010-05-04 14:34:54 +0000
@@ -25,9 +25,6 @@ extern "C" {
#include <ndb_global.h>
#include <my_sys.h>
#include <my_getopt.h>
-#include <mysql_version.h>
-#include <ndb_version.h>
-#include <ndbapi/ndb_opt_defaults.h>
#ifdef OPTEXPORT
#define OPT_EXTERN(T,V,I) T V I
@@ -38,20 +35,14 @@ extern "C" {
#define NONE
OPT_EXTERN(int,opt_ndb_nodeid,NONE);
OPT_EXTERN(my_bool,opt_ndb_endinfo,=0);
-OPT_EXTERN(my_bool,opt_ndb_shm,NONE);
OPT_EXTERN(my_bool,opt_core,NONE);
OPT_EXTERN(my_bool,opt_ndb_optimized_node_selection,NONE);
OPT_EXTERN(const char *,opt_ndb_connectstring,=0);
-OPT_EXTERN(const char *,opt_connect_str,=0);
-OPT_EXTERN(const char *,opt_ndb_mgmd,=0);
-OPT_EXTERN(char,opt_ndb_constrbuf[1024],={0});
-OPT_EXTERN(unsigned,opt_ndb_constrbuf_len,=0);
#ifndef DBUG_OFF
OPT_EXTERN(const char *,opt_debug,= 0);
#endif
-#define OPT_NDB_CONNECTSTRING 'c'
#if defined VM_TRACE
#define OPT_WANT_CORE_DEFAULT 1
#else
@@ -71,20 +62,16 @@ OPT_EXTERN(const char *,opt_debug,= 0);
"Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \
(uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
- { "ndb-mgmd-host", OPT_NDB_MGMD, \
- "Set host and port for connecting to ndb_mgmd. " \
- "Syntax: <hostname>[:<port>].", \
- (uchar**) &opt_ndb_mgmd, (uchar**) &opt_ndb_mgmd, 0, \
+ { "ndb-mgmd-host", NDB_OPT_NOSHORT, \
+ "same as --ndb-connectstring", \
+ (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
- { "ndb-nodeid", OPT_NDB_NODEID, \
- "Set node id for this node.", \
+ { "ndb-nodeid", NDB_OPT_NOSHORT, \
+ "Set node id for this node. Overrides node id specified " \
+ "in --ndb-connectstring.", \
(uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
- { "ndb-shm", OPT_NDB_SHM,\
- "Allow optimizing using shared memory connections when available",\
- (uchar**) &opt_ndb_shm, (uchar**) &opt_ndb_shm, 0,\
- GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\
- {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\
+ {"ndb-optimized-node-selection", NDB_OPT_NOSHORT,\
"Select nodes for transactions in a more optimal way",\
(uchar**) &opt_ndb_optimized_node_selection,\
(uchar**) &opt_ndb_optimized_node_selection, 0,\
@@ -92,10 +79,10 @@ OPT_EXTERN(const char *,opt_debug,= 0);
{ "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
(uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
- { "core-file", OPT_WANT_CORE, "Write core on errors.",\
+ { "core-file", NDB_OPT_NOSHORT, "Write core on errors.",\
(uchar**) &opt_core, (uchar**) &opt_core, 0,\
GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\
- {"character-sets-dir", OPT_CHARSETS_DIR,\
+ {"character-sets-dir", NDB_OPT_NOSHORT,\
"Directory where character sets are.", (uchar**) &charsets_dir,\
(uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
@@ -112,14 +99,23 @@ OPT_EXTERN(const char *,opt_debug,= 0);
void ndb_std_print_version();
enum ndb_std_options {
- OPT_NDB_SHM= 256,
- OPT_NDB_SHM_SIGNUM,
- OPT_NDB_OPTIMIZED_NODE_SELECTION,
- OPT_WANT_CORE,
- OPT_NDB_MGMD,
- OPT_NDB_NODEID,
- OPT_CHARSETS_DIR,
- NDB_STD_OPTIONS_LAST /* should always be last in this enum */
+ /*
+ --ndb-connectstring=<connectstring> has short form 'c'
+ */
+ OPT_NDB_CONNECTSTRING = 'c',
+
+ /*
+ For arguments that have neither a short form option or need
+ special processing in 'get_one_option' callback
+ */
+ NDB_OPT_NOSHORT = 256,
+
+ /*
+ should always be last in this enum and will be used as the
+ start value by programs which use 'ndb_std_get_one_option' and
+ need to define their own arguments with special processing
+ */
+ NDB_STD_OPTIONS_LAST
};
void ndb_opt_set_usage_funcs(const char* my_progname,
=== modified file 'storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp'
--- a/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/common/mgmcommon/ConfigRetriever.cpp 2010-05-04 14:34:54 +0000
@@ -34,6 +34,7 @@
//****************************************************************************
ConfigRetriever::ConfigRetriever(const char * _connect_string,
+ int force_nodeid,
Uint32 version,
ndb_mgm_node_type node_type,
const char * _bindaddress,
@@ -43,7 +44,8 @@ ConfigRetriever::ConfigRetriever(const c
m_node_type(node_type)
{
DBUG_ENTER("ConfigRetriever::ConfigRetriever");
- DBUG_PRINT("enter", ("connect_string: '%s'", _connect_string));
+ DBUG_PRINT("enter", ("connect_string: '%s', force_nodeid: %d",
+ _connect_string, force_nodeid));
DBUG_PRINT("enter", ("version: %d, node_type: %d, bind: %s, timeout: %d",
version, node_type,_bindaddress, timeout_ms));
@@ -65,6 +67,13 @@ ConfigRetriever::ConfigRetriever(const c
DBUG_VOID_RETURN;
}
+ if (force_nodeid &&
+ ndb_mgm_set_configuration_nodeid(m_handle, force_nodeid))
+ {
+ setError(CR_ERROR, "Failed to set forced nodeid");
+ DBUG_VOID_RETURN;
+ }
+
if (_bindaddress)
{
if (ndb_mgm_set_bindaddress(m_handle, _bindaddress))
=== modified file 'storage/ndb/src/common/util/ndb_opts.c'
--- a/storage/ndb/src/common/util/ndb_opts.c 2009-01-07 09:55:03 +0000
+++ b/storage/ndb/src/common/util/ndb_opts.c 2010-05-05 09:30:08 +0000
@@ -2,6 +2,9 @@
#define OPTEXPORT
#include <ndb_opts.h>
+#include <mysql_version.h>
+#include <ndb_version.h>
+
static const char* g_ndb_opt_progname= "ndbapi_program";
static void default_ndb_opt_short(void)
@@ -54,10 +57,11 @@ void ndb_usage(void (*usagefunc)(void),
my_print_variables(my_long_options);
}
+
my_bool
ndb_std_get_one_option(int optid,
const struct my_option *opt __attribute__((unused)),
- char *argument)
+ char *argument __attribute__((unused)))
{
switch (optid) {
#ifndef DBUG_OFF
@@ -74,39 +78,6 @@ ndb_std_get_one_option(int optid,
case '?':
(*g_ndb_opt_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;
- case OPT_NDB_MGMD:
- case OPT_NDB_NODEID:
- {
- int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
- sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
- "%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"",
- optid == OPT_NDB_NODEID ? "nodeid=" : "",
- argument);
- opt_ndb_constrbuf_len+= len;
- }
- /* fall through to add the connectstring to the end
- * and set opt_ndb_connectstring
- */
- case OPT_NDB_CONNECTSTRING:
- if (opt_ndb_connectstring && opt_ndb_connectstring[0])
- my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
- sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
- "%s%s", opt_ndb_constrbuf_len > 0 ? ",":"",
- opt_ndb_connectstring);
- else
- opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0;
- opt_connect_str= opt_ndb_constrbuf;
- break;
}
return 0;
}
=== modified file 'storage/ndb/src/kernel/angel.cpp'
--- a/storage/ndb/src/kernel/angel.cpp 2009-06-04 19:10:46 +0000
+++ b/storage/ndb/src/kernel/angel.cpp 2010-05-04 14:34:54 +0000
@@ -390,7 +390,9 @@ angel_run(const char* connect_str,
failed_startup_flag=false;
reportShutdown(theConfig, error_exit, 1);
g_eventLogger->info("Ndb has terminated (pid %d) restarting", child);
- theConfig->fetch_configuration(connect_str, bind_address);
+ theConfig->fetch_configuration(connect_str,
+ globalData.ownId, // Force same nodeid again
+ bind_address);
}
if (child >= 0)
=== modified file 'storage/ndb/src/kernel/main.cpp'
--- a/storage/ndb/src/kernel/main.cpp 2010-04-28 12:21:54 +0000
+++ b/storage/ndb/src/kernel/main.cpp 2010-05-05 09:30:08 +0000
@@ -48,7 +48,7 @@ extern NdbNodeBitmask g_nowait_nodes;
static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndbd"),
- { "initial", 256,
+ { "initial", NDB_OPT_NOSHORT,
"Perform initial start of ndbd, including cleaning the file system. "
"Consult documentation before using this",
(uchar**) &opt_initial, (uchar**) &opt_initial, 0,
@@ -60,25 +60,25 @@ static struct my_option my_long_options[
{ "daemon", 'd', "Start ndbd as daemon (default)",
(uchar**) &opt_daemon, (uchar**) &opt_daemon, 0,
GET_BOOL, NO_ARG, IF_WIN(0,1), 0, 0, 0, 0, 0 },
- { "nodaemon", 256,
+ { "nodaemon", NDB_OPT_NOSHORT,
"Do not start ndbd as daemon, provided for testing purposes",
(uchar**) &opt_no_daemon, (uchar**) &opt_no_daemon, 0,
GET_BOOL, NO_ARG, IF_WIN(1,0), 0, 0, 0, 0, 0 },
- { "foreground", 256,
+ { "foreground", NDB_OPT_NOSHORT,
"Run real ndbd in foreground, provided for debugging purposes"
" (implies --nodaemon)",
(uchar**) &opt_foreground, (uchar**) &opt_foreground, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "nowait-nodes", 256,
+ { "nowait-nodes", NDB_OPT_NOSHORT,
"Nodes that will not be waited for during start",
(uchar**) &opt_nowait_nodes, (uchar**) &opt_nowait_nodes, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "initial-start", 256,
+ { "initial-start", NDB_OPT_NOSHORT,
"Perform a partial initial start of the cluster. "
"Each node should be started with this option, as well as --nowait-nodes",
(uchar**) &opt_initialstart, (uchar**) &opt_initialstart, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "bind-address", 256,
+ { "bind-address", NDB_OPT_NOSHORT,
"Local bind address",
(uchar**) &opt_bind_address, (uchar**) &opt_bind_address, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -144,7 +144,8 @@ int main(int argc, char** argv)
DBUG_PRINT("info", ("initial=%d", opt_initial));
DBUG_PRINT("info", ("daemon=%d", opt_daemon));
DBUG_PRINT("info", ("foreground=%d", opt_foreground));
- DBUG_PRINT("info", ("connect_str=%s", opt_connect_str));
+ DBUG_PRINT("info", ("ndb_connectstring=%s", opt_ndb_connectstring));
+ DBUG_PRINT("info", ("ndb_nodeid=%d", opt_ndb_nodeid));
if (opt_nowait_nodes)
{
@@ -183,7 +184,9 @@ int main(int argc, char** argv)
globalData.ownId= z;
}
{ // Do configuration
- theConfig->fetch_configuration(opt_connect_str, opt_bind_address);
+ theConfig->fetch_configuration(opt_ndb_connectstring,
+ opt_ndb_nodeid,
+ opt_bind_address);
}
my_setwd(NdbConfig_get_path(0), MYF(0));
@@ -191,7 +194,7 @@ int main(int argc, char** argv)
#ifndef NDB_WIN32
if (!opt_foreground)
{
- if (angel_run(opt_connect_str,
+ if (angel_run(opt_ndb_connectstring,
opt_bind_address,
opt_initialstart,
opt_daemon))
=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp 2010-03-09 14:16:11 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp 2010-05-04 14:34:54 +0000
@@ -116,6 +116,7 @@ Configuration::closeConfiguration(bool e
void
Configuration::fetch_configuration(const char* _connect_string,
+ int force_nodeid,
const char* _bind_address){
/**
* Fetch configuration from management server
@@ -125,6 +126,7 @@ Configuration::fetch_configuration(const
}
m_config_retriever= new ConfigRetriever(_connect_string,
+ force_nodeid,
NDB_VERSION,
NDB_MGM_NODE_TYPE_NDB,
_bind_address);
@@ -152,14 +154,6 @@ Configuration::fetch_configuration(const
}
ConfigRetriever &cr= *m_config_retriever;
-
- /**
- * if we have a nodeid set (e.g in a restart situation)
- * reuse it
- */
- if (globalData.ownId)
- cr.setNodeId(globalData.ownId);
-
globalData.ownId = cr.allocNodeId(globalData.ownId ? 10 : 2 /*retry*/,
3 /*delay*/);
=== modified file 'storage/ndb/src/kernel/vm/Configuration.hpp'
--- a/storage/ndb/src/kernel/vm/Configuration.hpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.hpp 2010-05-04 14:34:54 +0000
@@ -60,7 +60,7 @@ public:
bool init(int _no_start, int _initial,
int _initialstart, int _daemon);
- void fetch_configuration(const char* _connect_string,
+ void fetch_configuration(const char* _connect_string, int force_nodeid,
const char* _bind_adress);
void setupConfiguration();
void closeConfiguration(bool end_session= true);
=== modified file 'storage/ndb/src/mgmclient/main.cpp'
--- a/storage/ndb/src/mgmclient/main.cpp 2010-03-04 12:32:16 +0000
+++ b/storage/ndb/src/mgmclient/main.cpp 2010-05-04 14:34:54 +0000
@@ -33,7 +33,6 @@ extern "C" int write_history(const char
}
#include <NdbMain.h>
-#include <NdbHost.h>
#include <BaseString.hpp>
#include <NdbOut.hpp>
#include <mgmapi.h>
@@ -126,13 +125,11 @@ int main(int argc, char** argv){
ndb_std_get_one_option)))
exit(ho_error);
- char buf[MAXHOSTNAMELEN+10];
+ BaseString connect_str(opt_ndb_connectstring);
if(argc == 1) {
- BaseString::snprintf(buf, sizeof(buf), "%s", argv[0]);
- opt_connect_str= buf;
+ connect_str.assfmt("%s", argv[0]);
} else if (argc >= 2) {
- BaseString::snprintf(buf, sizeof(buf), "%s:%s", argv[0], argv[1]);
- opt_connect_str= buf;
+ connect_str.assfmt("%s:%s", argv[0], argv[1]);
}
if (!isatty(0) || opt_execute_str)
@@ -140,7 +137,7 @@ int main(int argc, char** argv){
prompt= 0;
}
- com = new Ndb_mgmclient(opt_connect_str,opt_verbose);
+ com = new Ndb_mgmclient(connect_str.c_str(), opt_verbose);
int ret= 0;
BaseString histfile;
if (!opt_execute_str)
=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2010-03-10 07:43:06 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2010-04-30 09:09:19 +0000
@@ -18,7 +18,6 @@
#include <ndb_global.h>
#ifndef NDB_MGMAPI
-#include <ndb_opt_defaults.h>
#include <NdbTCP.h>
#include "ConfigInfo.hpp"
@@ -4217,10 +4216,9 @@ fixShmKey(InitConfigFileParser::Context
DBUG_ENTER("fixShmKey");
{
static int last_signum= -1;
- Uint32 signum;
+ Uint32 signum = 0;
if(!ctx.m_currentSection->get("Signum", &signum))
{
- signum= OPT_NDB_SHM_SIGNUM_DEFAULT;
if (signum <= 0)
{
ctx.reportError("Unable to set default parameter for [SHM]Signum"
@@ -4811,7 +4809,7 @@ add_node_connections(Vector<ConfigInfo::
if(!p_db_nodes.get("", j, &nodeId2)) break;
if(!p_connections2.get("", nodeId1+(nodeId2<<16), &dummy))
{
- if (!add_a_connection(sections,ctx,nodeId1,nodeId2,opt_ndb_shm))
+ if (!add_a_connection(sections,ctx,nodeId1,nodeId2,false))
goto err;
}
}
@@ -4822,7 +4820,7 @@ add_node_connections(Vector<ConfigInfo::
if(!p_connections.get("", nodeId1, &dummy)) {
for (Uint32 j= 0;; j++){
if(!p_db_nodes.get("", j, &nodeId2)) break;
- if (!add_a_connection(sections,ctx,nodeId1,nodeId2,opt_ndb_shm))
+ if (!add_a_connection(sections,ctx,nodeId1,nodeId2,false))
goto err;
}
}
=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp 2010-01-29 10:38:28 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp 2010-05-04 14:34:54 +0000
@@ -28,7 +28,8 @@
#include <ndb_version.h>
-extern "C" const char* opt_connect_str;
+extern "C" const char* opt_ndb_connectstring;
+extern "C" int opt_ndb_nodeid;
ConfigManager::ConfigManager(const MgmtSrvr::MgmtOpts& opts,
const char* configdir) :
@@ -39,7 +40,8 @@ ConfigManager::ConfigManager(const MgmtS
m_config_mutex(NULL),
m_config(NULL),
m_new_config(NULL),
- m_config_retriever(opt_connect_str,
+ m_config_retriever(opt_ndb_connectstring,
+ opt_ndb_nodeid,
NDB_VERSION,
NDB_MGM_NODE_TYPE_MGM,
opts.bind_address),
@@ -2316,7 +2318,7 @@ ConfigManager::ConfigChecker::ConfigChec
NodeId nodeid) :
MgmtThread("ConfigChecker"),
m_manager(manager),
- m_config_retriever(connect_string, NDB_VERSION,
+ m_config_retriever(opt_ndb_connectstring, opt_ndb_nodeid, NDB_VERSION,
NDB_MGM_NODE_TYPE_MGM, bindaddress),
m_connect_string(connect_string),
m_nodeid(nodeid)
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2010-04-27 16:09:07 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2010-05-05 09:30:08 +0000
@@ -223,8 +223,7 @@ translateStopRef(Uint32 errCode)
}
-MgmtSrvr::MgmtSrvr(const MgmtOpts& opts,
- const char* connect_str) :
+MgmtSrvr::MgmtSrvr(const MgmtOpts& opts) :
m_opts(opts),
_blockNumber(-1),
_ownNodeId(0),
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2010-04-09 11:24:12 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2010-05-04 14:34:54 +0000
@@ -128,7 +128,7 @@ public:
MgmtSrvr(); // Not implemented
MgmtSrvr(const MgmtSrvr&); // Not implemented
- MgmtSrvr(const MgmtOpts&, const char* connect_str);
+ MgmtSrvr(const MgmtOpts&);
~MgmtSrvr();
=== modified file 'storage/ndb/src/mgmsrv/main.cpp'
--- a/storage/ndb/src/mgmsrv/main.cpp 2010-04-07 09:14:43 +0000
+++ b/storage/ndb/src/mgmsrv/main.cpp 2010-05-04 14:34:54 +0000
@@ -99,31 +99,31 @@ static struct my_option my_long_options[
{ "daemon", 'd', "Run ndb_mgmd in daemon mode (default)",
(uchar**) &opts.daemon, (uchar**) &opts.daemon, 0,
GET_BOOL, NO_ARG, IF_WIN(0,1), 0, 0, 0, 0, 0 },
- { "interactive", 256,
+ { "interactive", NDB_OPT_NOSHORT,
"Run interactive. Not supported but provided for testing purposes",
(uchar**) &opts.interactive, (uchar**) &opts.interactive, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "no-nodeid-checks", 256,
+ { "no-nodeid-checks", NDB_OPT_NOSHORT,
"Do not provide any node id checks",
(uchar**) &opts.no_nodeid_checks, (uchar**) &opts.no_nodeid_checks, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "nodaemon", 256,
+ { "nodaemon", NDB_OPT_NOSHORT,
"Don't run as daemon, but don't read from stdin",
(uchar**) &opts.non_interactive, (uchar**) &opts.non_interactive, 0,
GET_BOOL, NO_ARG, IF_WIN(1,0), 0, 0, 0, 0, 0 },
- { "mycnf", 256,
+ { "mycnf", NDB_OPT_NOSHORT,
"Read cluster config from my.cnf",
(uchar**) &opts.mycnf, (uchar**) &opts.mycnf, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "bind-address", 256,
+ { "bind-address", NDB_OPT_NOSHORT,
"Local bind address",
(uchar**) &opts.bind_address, (uchar**) &opts.bind_address, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "configdir", 256,
+ { "configdir", NDB_OPT_NOSHORT,
"Directory for the binary configuration files (alias for --config-dir)",
(uchar**) &opts.configdir, (uchar**) &opts.configdir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "config-dir", 256,
+ { "config-dir", NDB_OPT_NOSHORT,
"Directory for the binary configuration files",
(uchar**) &opts.configdir, (uchar**) &opts.configdir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -131,19 +131,19 @@ static struct my_option my_long_options[
"Write more log messages",
(uchar**) &opts.verbose, (uchar**) &opts.verbose, 0,
GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
- { "reload", 256,
+ { "reload", NDB_OPT_NOSHORT,
"Reload config from config.ini or my.cnf if it has changed on startup",
(uchar**) &opts.reload, (uchar**) &opts.reload, 0,
GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
- { "initial", 256,
+ { "initial", NDB_OPT_NOSHORT,
"Delete all binary config files and start from config.ini or my.cnf",
(uchar**) &opts.initial, (uchar**) &opts.initial, 0,
GET_BOOL, NO_ARG, 0, 0, 1, 0, 0, 0 },
- { "log-name", 256,
+ { "log-name", NDB_OPT_NOSHORT,
"Name to use when logging messages for this node",
(uchar**) &opt_logname, (uchar**) &opt_logname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "nowait-nodes", 256,
+ { "nowait-nodes", NDB_OPT_NOSHORT,
"Nodes that will not be waited for during start",
(uchar**) &opt_nowait_nodes, (uchar**) &opt_nowait_nodes, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -250,7 +250,7 @@ static int mgmd_main(int argc, char** ar
g_eventLogger->info("NDB Cluster Management Server. %s",
NDB_VERSION_STRING);
- mgm= new MgmtSrvr(opts, opt_connect_str);
+ mgm= new MgmtSrvr(opts);
if (mgm == NULL) {
g_eventLogger->critical("Out of memory, couldn't create MgmtSrvr");
mgmd_exit(1);
=== modified file 'storage/ndb/src/mgmsrv/testConfig.cpp'
--- a/storage/ndb/src/mgmsrv/testConfig.cpp 2009-11-17 18:13:29 +0000
+++ b/storage/ndb/src/mgmsrv/testConfig.cpp 2010-04-30 09:09:19 +0000
@@ -23,7 +23,6 @@
#include "Config.hpp"
my_bool opt_core= 1;
-my_bool opt_ndb_shm= 0;
#define CHECK(x) \
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2009-11-17 16:26:09 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2010-05-04 14:34:54 +0000
@@ -47,16 +47,23 @@ static int g_ndb_connection_count = 0;
/*
* Ndb_cluster_connection
*/
-
Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string)
- : m_impl(* new Ndb_cluster_connection_impl(connect_string, 0))
+ : m_impl(* new Ndb_cluster_connection_impl(connect_string, 0, 0))
+{
+}
+
+Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string,
+ int force_api_nodeid)
+ : m_impl(* new Ndb_cluster_connection_impl(connect_string, 0,
+ force_api_nodeid))
{
}
Ndb_cluster_connection::Ndb_cluster_connection(const char *connect_string,
Ndb_cluster_connection *
main_connection)
- : m_impl(* new Ndb_cluster_connection_impl(connect_string, main_connection))
+ : m_impl(* new Ndb_cluster_connection_impl(connect_string,
+ main_connection, 0))
{
}
@@ -286,7 +293,8 @@ const char *Ndb_cluster_connection::get_
Ndb_cluster_connection_impl::
Ndb_cluster_connection_impl(const char * connect_string,
- Ndb_cluster_connection *main_connection)
+ Ndb_cluster_connection *main_connection,
+ int force_api_nodeid)
: Ndb_cluster_connection(*this),
m_main_connection(main_connection),
m_optimized_node_selection(1),
@@ -326,7 +334,8 @@ Ndb_cluster_connection_impl(const char *
ndb_print_state_mutex= NdbMutex_Create();
#endif
m_config_retriever=
- new ConfigRetriever(connect_string, NDB_VERSION, NDB_MGM_NODE_TYPE_API);
+ new ConfigRetriever(connect_string, force_api_nodeid,
+ NDB_VERSION, NDB_MGM_NODE_TYPE_API);
if (m_config_retriever->hasError())
{
m_latest_error= 1;
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2009-11-17 16:15:19 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2010-05-04 14:34:54 +0000
@@ -40,7 +40,8 @@ extern "C" {
class Ndb_cluster_connection_impl : public Ndb_cluster_connection
{
Ndb_cluster_connection_impl(const char *connectstring,
- Ndb_cluster_connection *main_connection);
+ Ndb_cluster_connection *main_connection,
+ int force_api_nodeid);
~Ndb_cluster_connection_impl();
void do_test();
=== modified file 'storage/ndb/test/ndbapi/testBitfield.cpp'
--- a/storage/ndb/test/ndbapi/testBitfield.cpp 2010-04-29 14:52:05 +0000
+++ b/storage/ndb/test/ndbapi/testBitfield.cpp 2010-05-05 09:30:08 +0000
@@ -16,21 +16,6 @@ struct my_option my_long_options[] =
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-#if 0
-static void usage()
-{
- ndb_std_print_version();
-}
-
-static my_bool
-get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
- const char *argument)
-{
- return ndb_std_get_one_option(optid, opt, argument ? argument :
- "d:t:O,/tmp/testBitfield.trace");
-}
-#endif
-
static const NdbDictionary::Table* create_random_table(Ndb*);
static int transactions(Ndb*, const NdbDictionary::Table* tab);
static int unique_indexes(Ndb*, const NdbDictionary::Table* tab);
@@ -59,7 +44,7 @@ main(int argc, char** argv){
return NDBT_ProgramExit(res);
}
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
if(con.connect(12, 5, 1))
{
return NDBT_ProgramExit(NDBT_FAILED);
=== modified file 'storage/ndb/test/ndbapi/testIndexStat.cpp'
--- a/storage/ndb/test/ndbapi/testIndexStat.cpp 2009-09-25 14:08:15 +0000
+++ b/storage/ndb/test/ndbapi/testIndexStat.cpp 2010-04-30 09:09:19 +0000
@@ -1484,43 +1484,47 @@ static struct my_option
my_long_options[] =
{
NDB_STD_OPTS("testIndexStat"),
- { "loglevel", 1001, "Logging level in this program 0-3 (default 0)",
+ { "loglevel", NDB_OPT_NOSHORT,
+ "Logging level in this program 0-3 (default 0)",
(uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "seed", 1002, "Random seed (0=loop number, default -1=random)",
+ { "seed", NDB_OPT_NOSHORT, "Random seed (0=loop number, default -1=random)",
(uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0,
GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 },
- { "loop", 1003, "Number of test loops (default 1, 0=forever)",
+ { "loop", NDB_OPT_NOSHORT, "Number of test loops (default 1, 0=forever)",
(uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0,
GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 },
- { "rows", 1004, "Number of rows (default 100000)",
+ { "rows", NDB_OPT_NOSHORT, "Number of rows (default 100000)",
(uchar **)&g_opts.rows, (uchar **)&g_opts.rows, 0,
GET_UINT, REQUIRED_ARG, 100000, 0, 0, 0, 0, 0 },
- { "ops", 1005, "Number of index scans per loop (default 1000)",
+ { "ops", NDB_OPT_NOSHORT,"Number of index scans per loop (default 1000)",
(uchar **)&g_opts.ops, (uchar **)&g_opts.ops, 0,
GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 },
- { "dupkeys", 1006, "Pct records per key (min 100, default 1000)",
+ { "dupkeys", NDB_OPT_NOSHORT, "Pct records per key (min 100, default 1000)",
(uchar **)&g_opts.dupkeys, (uchar **)&g_opts.dupkeys, 0,
GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 },
- { "scanpct", 1007, "Preferred max pct of total rows per scan (default 5)",
+ { "scanpct", NDB_OPT_NOSHORT,
+ "Preferred max pct of total rows per scan (default 5)",
(uchar **)&g_opts.scanpct, (uchar **)&g_opts.scanpct, 0,
GET_UINT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 },
- { "nullkeys", 1008, "Pct nulls in each key attribute (default 10)",
+ { "nullkeys", NDB_OPT_NOSHORT, "Pct nulls in each key attribute (default 10)",
(uchar **)&g_opts.nullkeys, (uchar **)&g_opts.nullkeys, 0,
GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
- { "eqscans", 1009, "Pct scans for partial/full equality (default 50)",
+ { "eqscans", NDB_OPT_NOSHORT,
+ "Pct scans for partial/full equality (default 50)",
(uchar **)&g_opts.eqscans, (uchar **)&g_opts.eqscans, 0,
GET_UINT, REQUIRED_ARG, 50, 0, 0, 0, 0, 0 },
- { "dupscans", 1010, "Pct scans using same bounds (default 10)",
+ { "dupscans", NDB_OPT_NOSHORT, "Pct scans using same bounds (default 10)",
(uchar **)&g_opts.dupscans, (uchar **)&g_opts.dupscans, 0,
GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
- { "keeptable", 1011, "Use existing table and data if any and do not drop",
+ { "keeptable", NDB_OPT_NOSHORT,
+ "Use existing table and data if any and do not drop",
(uchar **)&g_opts.keeptable, (uchar **)&g_opts.keeptable, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "no-extra-checks", 1012, "Omit expensive consistency checks",
+ { "no-extra-checks", NDB_OPT_NOSHORT, "Omit expensive consistency checks",
(uchar **)&g_opts.nochecks, (uchar **)&g_opts.nochecks, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "abort-on-error", 1013, "Dump core on any error",
+ { "abort-on-error", NDB_OPT_NOSHORT, "Dump core on any error",
(uchar **)&g_opts.abort, (uchar **)&g_opts.abort, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0,
=== modified file 'storage/ndb/test/ndbapi/testNdbApi.cpp'
--- a/storage/ndb/test/ndbapi/testNdbApi.cpp 2010-03-19 14:15:57 +0000
+++ b/storage/ndb/test/ndbapi/testNdbApi.cpp 2010-05-04 14:34:54 +0000
@@ -2874,10 +2874,9 @@ int testApiFailReqImpl(NDBT_Context* ctx
return NDBT_FAILED;
}
- const Uint32 MaxConnectStringSize= 256;
- char connectString[ MaxConnectStringSize ];
- ctx->m_cluster_connection.get_connectstring(connectString,
- MaxConnectStringSize);
+ char connectString[256];
+ ctx->m_cluster_connection.get_connectstring(connectString,
+ sizeof(connectString));
otherConnection= new Ndb_cluster_connection(connectString);
@@ -3286,10 +3285,9 @@ int testFragmentedApiFailImpl(NDBT_Conte
return NDBT_FAILED;
}
- const Uint32 MaxConnectStringSize= 256;
- char connectString[ MaxConnectStringSize ];
- ctx->m_cluster_connection.get_connectstring(connectString,
- MaxConnectStringSize);
+ char connectString[256];
+ ctx->m_cluster_connection.get_connectstring(connectString,
+ sizeof(connectString));
otherConnection= new Ndb_cluster_connection(connectString);
=== modified file 'storage/ndb/test/ndbapi/test_event_merge.cpp'
--- a/storage/ndb/test/ndbapi/test_event_merge.cpp 2010-03-11 19:47:09 +0000
+++ b/storage/ndb/test/ndbapi/test_event_merge.cpp 2010-04-30 09:09:19 +0000
@@ -2240,60 +2240,60 @@ static struct my_option
my_long_options[] =
{
NDB_STD_OPTS("test_event_merge"),
- { "abort-on-error", 1001, "Do abort() on any error",
+ { "abort-on-error", NDB_OPT_NOSHORT, "Do abort() on any error",
(uchar **)&g_opts.abort_on_error, (uchar **)&g_opts.abort_on_error, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "loglevel", 1002, "Logging level in this program 0-3 (default 0)",
+ { "loglevel", NDB_OPT_NOSHORT, "Logging level in this program 0-3 (default 0)",
(uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0,
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "loop", 1003, "Number of test loops (default 5, 0=forever)",
+ { "loop", NDB_OPT_NOSHORT, "Number of test loops (default 5, 0=forever)",
(uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0,
GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 },
- { "maxops", 1004, "Approx number of PK operations per table (default 1000)",
+ { "maxops", NDB_OPT_NOSHORT, "Approx number of PK operations per table (default 1000)",
(uchar **)&g_opts.maxops, (uchar **)&g_opts.maxops, 0,
GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 },
- { "maxpk", 1005, "Number of different PK values (default 10, max 1000)",
+ { "maxpk", NDB_OPT_NOSHORT, "Number of different PK values (default 10, max 1000)",
(uchar **)&g_opts.maxpk, (uchar **)&g_opts.maxpk, 0,
GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
- { "maxtab", 1006, "Number of tables (default 10, max 100)",
+ { "maxtab", NDB_OPT_NOSHORT, "Number of tables (default 10, max 100)",
(uchar **)&g_opts.maxtab, (uchar **)&g_opts.maxtab, 0,
GET_INT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
- { "no-blobs", 1007, "Omit blob attributes (5.0: true)",
+ { "no-blobs", NDB_OPT_NOSHORT, "Omit blob attributes (5.0: true)",
(uchar **)&g_opts.no_blobs, (uchar **)&g_opts.no_blobs, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "no-implicit-nulls", 1008, "Insert must include all attrs"
+ { "no-implicit-nulls", NDB_OPT_NOSHORT, "Insert must include all attrs"
" i.e. no implicit NULLs",
(uchar **)&g_opts.no_implicit_nulls, (uchar **)&g_opts.no_implicit_nulls, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "no-missing-update", 1009, "Update must include all non-PK attrs",
+ { "no-missing-update", NDB_OPT_NOSHORT, "Update must include all non-PK attrs",
(uchar **)&g_opts.no_missing_update, (uchar **)&g_opts.no_missing_update, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "no-multiops", 1010, "Allow only 1 operation per commit",
+ { "no-multiops", NDB_OPT_NOSHORT, "Allow only 1 operation per commit",
(uchar **)&g_opts.no_multiops, (uchar **)&g_opts.no_multiops, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "no-nulls", 1011, "Create no NULL values",
+ { "no-nulls", NDB_OPT_NOSHORT, "Create no NULL values",
(uchar **)&g_opts.no_nulls, (uchar **)&g_opts.no_nulls, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "one-blob", 1012, "Only one blob attribute (default 2)",
+ { "one-blob", NDB_OPT_NOSHORT, "Only one blob attribute (default 2)",
(uchar **)&g_opts.one_blob, (uchar **)&g_opts.one_blob, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "opstring", 1013, "Operations to run e.g. idiucdc (c is commit) or"
+ { "opstring", NDB_OPT_NOSHORT, "Operations to run e.g. idiucdc (c is commit) or"
" iuuc:uudc (the : separates loops)",
(uchar **)&g_opts.opstring, (uchar **)&g_opts.opstring, 0,
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "seed", 1014, "Random seed (0=loop number, default -1=random)",
+ { "seed", NDB_OPT_NOSHORT, "Random seed (0=loop number, default -1=random)",
(uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0,
GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 },
- { "separate-events", 1015, "Do not combine events per GCI (5.0: true)",
+ { "separate-events", NDB_OPT_NOSHORT, "Do not combine events per GCI (5.0: true)",
(uchar **)&g_opts.separate_events, (uchar **)&g_opts.separate_events, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "tweak", 1016, "Whatever the source says",
+ { "tweak", NDB_OPT_NOSHORT, "Whatever the source says",
(uchar **)&g_opts.tweak, (uchar **)&g_opts.tweak, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "use-table", 1017, "Use existing tables",
+ { "use-table", NDB_OPT_NOSHORT, "Use existing tables",
(uchar **)&g_opts.use_table, (uchar **)&g_opts.use_table, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "blob-version", 1018, "Blob version 1 or 2 (default 2)",
+ { "blob-version", NDB_OPT_NOSHORT, "Blob version 1 or 2 (default 2)",
(uchar**)&g_opts.blob_version, (uchar**)&g_opts.blob_version, 0,
GET_INT, REQUIRED_ARG, 2, 0, 0, 0, 0, 0 },
{ 0, 0, 0,
@@ -2301,13 +2301,6 @@ my_long_options[] =
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }
};
-#if 0
-static void
-usage()
-{
- my_print_help(my_long_options);
-}
-#endif
static int
checkopts()
=== modified file 'storage/ndb/test/run-test/main.cpp'
--- a/storage/ndb/test/run-test/main.cpp 2010-04-16 08:53:12 +0000
+++ b/storage/ndb/test/run-test/main.cpp 2010-05-05 09:30:08 +0000
@@ -82,7 +82,7 @@ char * g_env_path = 0;
const char* g_mysqld_host = 0;
/** Dummy, extern declared in ndb_opts.h */
-int g_print_full_config = 0, opt_ndb_shm;
+int g_print_full_config = 0;
my_bool opt_core;
static struct my_option g_options[] =
=== modified file 'storage/ndb/test/src/NDBT_Test.cpp'
--- a/storage/ndb/test/src/NDBT_Test.cpp 2010-03-11 09:44:08 +0000
+++ b/storage/ndb/test/src/NDBT_Test.cpp 2010-05-04 14:34:54 +0000
@@ -1270,14 +1270,6 @@ int NDBT_TestSuite::reportAllTables(cons
return result;
}
-enum test_options {
- OPT_INTERACTIVE = NDB_STD_OPTIONS_LAST,
- OPT_PRINT,
- OPT_PRINT_HTML,
- OPT_PRINT_CASES
-
-};
-
static int opt_print = false;
static int opt_print_html = false;
static int opt_print_cases = false;
@@ -1295,13 +1287,13 @@ static int opt_forceShort = 0;
static struct my_option my_long_options[] =
{
NDB_STD_OPTS(""),
- { "print", OPT_PRINT, "Print execution tree",
+ { "print", NDB_OPT_NOSHORT, "Print execution tree",
(uchar **) &opt_print, (uchar **) &opt_print, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "print_html", OPT_PRINT_HTML, "Print execution tree in html table format",
+ { "print_html", NDB_OPT_NOSHORT, "Print execution tree in html table format",
(uchar **) &opt_print_html, (uchar **) &opt_print_html, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "print_cases", OPT_PRINT_CASES, "Print list of test cases",
+ { "print_cases", NDB_OPT_NOSHORT, "Print list of test cases",
(uchar **) &opt_print_cases, (uchar **) &opt_print_cases, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "records", 'r', "Number of records",
@@ -1310,7 +1302,7 @@ static struct my_option my_long_options[
{ "loops", 'l', "Number of loops",
(uchar **) &opt_loops, (uchar **) &opt_loops, 0,
GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 },
- { "seed", 1024, "Random seed",
+ { "seed", NDB_OPT_NOSHORT, "Random seed",
(uchar **) &opt_seed, (uchar **) &opt_seed, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "testname", 'n', "Name of test to run",
@@ -1325,13 +1317,14 @@ static struct my_option my_long_options[
{ "temporary-tables", 'T', "Create temporary table(s)",
(uchar **) &opt_temporary, (uchar **) &opt_temporary, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "nologging", 0, "Create table(s) wo/ logging",
+ { "nologging", NDB_OPT_NOSHORT, "Create table(s) wo/ logging",
(uchar **) &opt_nologging, (uchar **) &opt_nologging, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "noddl", 0, "Don't create/drop tables as part of running tests",
+ { "noddl", NDB_OPT_NOSHORT,
+ "Don't create/drop tables as part of running tests",
(uchar**) &opt_noddl, (uchar**) &opt_noddl, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "forceshortreqs", 0, "Use short signals for NdbApi requests",
+ { "forceshortreqs", NDB_OPT_NOSHORT, "Use short signals for NdbApi requests",
(uchar**) &opt_forceShort, (uchar**) &opt_forceShort, 0,
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}
@@ -1484,7 +1477,7 @@ int NDBT_TestSuite::execute(int argc, co
return 0;
}
- Ndb_cluster_connection con;
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
if(m_connect_cluster && con.connect(12, 5, 1))
{
return NDBT_ProgramExit(NDBT_FAILED);
=== modified file 'storage/ndb/test/tools/connect.cpp'
--- a/storage/ndb/test/tools/connect.cpp 2009-09-25 14:08:15 +0000
+++ b/storage/ndb/test/tools/connect.cpp 2010-05-04 14:34:54 +0000
@@ -43,27 +43,17 @@ static struct my_option my_long_options[
"Drop event operations before disconnect (0 = no, 1 = yes, else rand",
(gptr*) &_drop, (gptr*) &_drop, 0,
GET_INT, REQUIRED_ARG, _drop, 0, 0, 0, 0, 0 },
- { "subscribe-loop", 256,
+ { "subscribe-loop", NDB_OPT_NOSHORT,
"Loop in subscribe/unsubscribe",
(uchar**) &_subloop, (uchar**) &_subloop, 0,
GET_INT, REQUIRED_ARG, _subloop, 0, 0, 0, 0, 0 },
- { "wait-all", 256,
+ { "wait-all", NDB_OPT_NOSHORT,
"Wait for all ndb-nodes (i.e not only some)",
(uchar**) &_wait_all, (uchar**) &_wait_all, 0,
GET_INT, REQUIRED_ARG, _wait_all, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-#if 0
-static void usage()
-{
- char desc[] = "This program connects to ndbd, and then disconnects\n";
- ndb_std_print_version();
- my_print_help(my_long_options);
- my_print_variables(my_long_options);
-}
-#endif
-
int main(int argc, char** argv){
NDB_INIT(argv[0]);
@@ -79,7 +69,7 @@ int main(int argc, char** argv){
for (int i = 0; i<_loop; i++)
{
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
if(con.connect(12, 5, 1) != 0)
{
ndbout << "Unable to connect to management server." << endl;
=== modified file 'storage/ndb/test/tools/log_listner.cpp'
--- a/storage/ndb/test/tools/log_listner.cpp 2009-09-25 14:08:15 +0000
+++ b/storage/ndb/test/tools/log_listner.cpp 2010-05-04 14:34:54 +0000
@@ -9,15 +9,6 @@ static struct my_option my_long_options[
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-#if 0
-static void usage()
-{
- ndb_std_print_version();
- my_print_help(my_long_options);
- my_print_variables(my_long_options);
-}
-#endif
-
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP,
15, NDB_MGM_EVENT_CATEGORY_CONNECTION,
15, NDB_MGM_EVENT_CATEGORY_NODE_RESTART,
@@ -44,7 +35,7 @@ main(int argc, char** argv)
return NDBT_ProgramExit(NDBT_WRONGARGS);
NdbMgmHandle handle= ndb_mgm_create_handle();
- ndb_mgm_set_connectstring(handle, opt_connect_str);
+ ndb_mgm_set_connectstring(handle, opt_ndb_connectstring);
while (true)
{
=== modified file 'storage/ndb/tools/delete_all.cpp'
--- a/storage/ndb/tools/delete_all.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/tools/delete_all.cpp 2010-05-04 14:34:54 +0000
@@ -43,10 +43,10 @@ static struct my_option my_long_options[
{ "transactional", 't', "Single transaction (may run out of operations)",
(uchar**) &_transactional, (uchar**) &_transactional, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "tupscan", 999, "Run tupscan",
+ { "tupscan", NDB_OPT_NOSHORT, "Run tupscan",
(uchar**) &_tupscan, (uchar**) &_tupscan, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "diskscan", 999, "Run diskcan",
+ { "diskscan", NDB_OPT_NOSHORT, "Run diskcan",
(uchar**) &_diskscan, (uchar**) &_diskscan, 0,
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}
@@ -74,7 +74,7 @@ int main(int argc, char** argv){
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS);
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
con.set_name("ndb_delete_all");
if(con.connect(12, 5, 1) != 0)
{
=== modified file 'storage/ndb/tools/desc.cpp'
--- a/storage/ndb/tools/desc.cpp 2010-03-01 14:13:01 +0000
+++ b/storage/ndb/tools/desc.cpp 2010-05-04 14:34:54 +0000
@@ -89,7 +89,7 @@ int main(int argc, char** argv){
ndb_std_get_one_option)))
return NDBT_ProgramExit(NDBT_WRONGARGS);
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
con.set_name("ndb_desc");
if(con.connect(12, 5, 1) != 0)
{
=== modified file 'storage/ndb/tools/drop_index.cpp'
--- a/storage/ndb/tools/drop_index.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/tools/drop_index.cpp 2010-05-04 14:34:54 +0000
@@ -59,7 +59,7 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
con.set_name("ndb_drop_index");
if(con.connect(12, 5, 1) != 0)
{
=== modified file 'storage/ndb/tools/drop_tab.cpp'
--- a/storage/ndb/tools/drop_tab.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/tools/drop_tab.cpp 2010-05-04 14:34:54 +0000
@@ -59,7 +59,7 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
con.set_name("ndb_drop_table");
if(con.connect(12, 5, 1) != 0)
{
=== modified file 'storage/ndb/tools/listTables.cpp'
--- a/storage/ndb/tools/listTables.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/tools/listTables.cpp 2010-05-04 14:34:54 +0000
@@ -255,10 +255,6 @@ list(const char * tabname,
static const char* _dbname = "TEST_DB";
static int _loops;
static int _type;
-enum options_ndb_show_tables
-{
- OPT_SHOW_TMP_STATUS=256
-};
static struct my_option my_long_options[] =
{
@@ -278,7 +274,7 @@ static struct my_option my_long_options[
{ "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE",
(uchar**) &_parsable, (uchar**) &_parsable, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "show-temp-status", OPT_SHOW_TMP_STATUS, "Show table temporary flag",
+ { "show-temp-status", NDB_OPT_NOSHORT, "Show table temporary flag",
(uchar**) &show_temp_status, (uchar**) &show_temp_status, 0,
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}
@@ -308,7 +304,11 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
_tabname = argv[0];
- ndb_cluster_connection = new Ndb_cluster_connection(opt_connect_str);
+ ndb_cluster_connection = new Ndb_cluster_connection(opt_ndb_connectstring,
+ opt_ndb_nodeid);
+ if (ndb_cluster_connection == NULL)
+ fatal("Unable to create cluster connection");
+
ndb_cluster_connection->set_name("ndb_show_tables");
if (ndb_cluster_connection->connect(12,5,1))
fatal("Unable to connect to management server.");
=== modified file 'storage/ndb/tools/ndb_config.cpp'
--- a/storage/ndb/tools/ndb_config.cpp 2010-04-13 16:01:38 +0000
+++ b/storage/ndb/tools/ndb_config.cpp 2010-05-04 14:34:54 +0000
@@ -57,25 +57,25 @@ typedef ndb_mgm_configuration_iterator I
static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndb_config"),
- { "nodes", 256, "Print nodes",
+ { "nodes", NDB_OPT_NOSHORT, "Print nodes",
(uchar**) &g_nodes, (uchar**) &g_nodes,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- { "connections", 256, "Print connections",
+ { "connections", NDB_OPT_NOSHORT, "Print connections",
(uchar**) &g_connections, (uchar**) &g_connections,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ "query", 'q', "Query option(s)",
(uchar**) &g_query, (uchar**) &g_query,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "host", 256, "Host",
+ { "host", NDB_OPT_NOSHORT, "Host",
(uchar**) &g_host, (uchar**) &g_host,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "type", 258, "Type of node/connection",
+ { "type", NDB_OPT_NOSHORT, "Type of node/connection",
(uchar**) &g_type, (uchar**) &g_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "id", 258, "Nodeid",
+ { "id", NDB_OPT_NOSHORT, "Nodeid",
(uchar**) &g_nodeid, (uchar**) &g_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "nodeid", 258, "Nodeid",
+ { "nodeid", NDB_OPT_NOSHORT, "Nodeid",
(uchar**) &g_nodeid, (uchar**) &g_nodeid,
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "fields", 'f', "Field separator",
@@ -84,16 +84,16 @@ static struct my_option my_long_options[
{ "rows", 'r', "Row separator",
(uchar**) &g_row_delimiter, (uchar**) &g_row_delimiter,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "config-file", 256, "Path to config.ini",
+ { "config-file", NDB_OPT_NOSHORT, "Path to config.ini",
(uchar**) &g_config_file, (uchar**) &g_config_file,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "mycnf", 256, "Read config from my.cnf",
+ { "mycnf", NDB_OPT_NOSHORT, "Read config from my.cnf",
(uchar**) &g_mycnf, (uchar**) &g_mycnf,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- { "configinfo", 256, "Print configinfo",
+ { "configinfo", NDB_OPT_NOSHORT, "Print configinfo",
(uchar**) &g_configinfo, (uchar**) &g_configinfo,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- { "xml", 256, "Print configinfo in xml format",
+ { "xml", NDB_OPT_NOSHORT, "Print configinfo in xml format",
(uchar**) &g_xml, (uchar**) &g_xml,
0, 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}
@@ -508,7 +508,7 @@ fetch_configuration()
ndb_mgm_set_error_stream(mgm, stderr);
- if (ndb_mgm_set_connectstring(mgm, opt_connect_str))
+ if (ndb_mgm_set_connectstring(mgm, opt_ndb_connectstring))
{
fprintf(stderr, "* %5d: %s\n",
ndb_mgm_get_latest_error(mgm),
=== modified file 'storage/ndb/tools/restore/Restore.hpp'
--- a/storage/ndb/tools/restore/Restore.hpp 2009-12-01 10:15:25 +0000
+++ b/storage/ndb/tools/restore/Restore.hpp 2010-05-04 14:34:54 +0000
@@ -290,8 +290,7 @@ public:
TableS& operator=(TableS& org) ;
- inline
- const bool isSYSTAB_0() const {
+ bool isSYSTAB_0() const {
return m_isSYSTAB_0;
}
}; // TableS;
=== modified file 'storage/ndb/tools/restore/consumer_restore.cpp'
--- a/storage/ndb/tools/restore/consumer_restore.cpp 2010-03-10 07:43:06 +0000
+++ b/storage/ndb/tools/restore/consumer_restore.cpp 2010-05-04 14:34:54 +0000
@@ -34,7 +34,6 @@ static void callback(int, NdbTransaction
static Uint32 get_part_id(const NdbDictionary::Table *table,
Uint32 hash_value);
-extern const char * g_connect_string;
extern BaseString g_options;
extern unsigned int opt_no_binlog;
@@ -90,7 +89,13 @@ BackupRestore::init(Uint32 tableChangesM
return true;
m_tableChangesMask = tableChangesMask;
- m_cluster_connection = new Ndb_cluster_connection(g_connect_string);
+ m_cluster_connection = new Ndb_cluster_connection(m_ndb_connectstring,
+ m_ndb_nodeid);
+ if (m_cluster_connection == NULL)
+ {
+ err << "Failed to create cluster connection!!" << endl;
+ return false;
+ }
m_cluster_connection->set_name(g_options.c_str());
if(m_cluster_connection->connect(12, 5, 1) != 0)
{
=== modified file 'storage/ndb/tools/restore/consumer_restore.hpp'
--- a/storage/ndb/tools/restore/consumer_restore.hpp 2010-01-13 13:28:03 +0000
+++ b/storage/ndb/tools/restore/consumer_restore.hpp 2010-05-04 14:34:54 +0000
@@ -50,12 +50,16 @@ struct PromotionRules {
class BackupRestore : public BackupConsumer
{
public:
- BackupRestore(NODE_GROUP_MAP *ng_map,
+ BackupRestore(const char* ndb_connectstring,
+ int ndb_nodeid,
+ NODE_GROUP_MAP *ng_map,
uint ng_map_len,
- Uint32 parallelism=1)
+ Uint32 parallelism=1) :
+ m_ndb(NULL),
+ m_cluster_connection(NULL),
+ m_ndb_connectstring(ndb_connectstring),
+ m_ndb_nodeid(ndb_nodeid)
{
- m_ndb = 0;
- m_cluster_connection = 0;
m_nodegroup_map = ng_map;
m_nodegroup_map_len = ng_map_len;
m_n_tablespace = 0;
@@ -168,6 +172,8 @@ public:
Ndb * m_ndb;
Ndb_cluster_connection * m_cluster_connection;
+ const char* m_ndb_connectstring;
+ int m_ndb_nodeid;
bool m_restore;
bool m_restore_meta;
bool m_no_restore_disk;
=== modified file 'storage/ndb/tools/restore/restore_main.cpp'
--- a/storage/ndb/tools/restore/restore_main.cpp 2010-03-10 07:43:06 +0000
+++ b/storage/ndb/tools/restore/restore_main.cpp 2010-05-04 14:34:54 +0000
@@ -98,27 +98,11 @@ BaseString g_options("ndb_restore");
const char *load_default_groups[]= { "mysql_cluster","ndb_restore",0 };
enum ndb_restore_options {
- OPT_PRINT= NDB_STD_OPTIONS_LAST,
- OPT_PRINT_DATA,
- OPT_PRINT_LOG,
- OPT_PRINT_META,
- OPT_BACKUP_PATH,
- OPT_HEX_FORMAT,
- OPT_FIELDS_ENCLOSED_BY,
- OPT_FIELDS_TERMINATED_BY,
- OPT_FIELDS_OPTIONALLY_ENCLOSED_BY,
- OPT_LINES_TERMINATED_BY,
- OPT_APPEND,
- OPT_PROGRESS_FREQUENCY,
- OPT_NO_BINLOG,
- OPT_VERBOSE,
+ OPT_VERBOSE = NDB_STD_OPTIONS_LAST,
OPT_INCLUDE_TABLES,
OPT_EXCLUDE_TABLES,
OPT_INCLUDE_DATABASES,
- OPT_EXCLUDE_DATABASES,
- OPT_EXCLUDE_MISSING_COLUMNS,
- OPT_DISABLE_INDEXES,
- OPT_REBUILD_INDEXES
+ OPT_EXCLUDE_DATABASES
};
static const char *opt_fields_enclosed_by= NULL;
static const char *opt_fields_terminated_by= NULL;
@@ -136,7 +120,7 @@ static struct my_option my_long_options[
{
NDB_STD_OPTS("ndb_restore"),
{ "connect", 'c', "same as --connect-string",
- (uchar**) &opt_connect_str, (uchar**) &opt_connect_str, 0,
+ (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "nodeid", 'n', "Backup files from node with id",
(uchar**) &ga_nodeId, (uchar**) &ga_nodeId, 0,
@@ -182,19 +166,19 @@ static struct my_option my_long_options[
"(parallelism can be 1 to 1024)",
(uchar**) &ga_nParallelism, (uchar**) &ga_nParallelism, 0,
GET_INT, REQUIRED_ARG, 128, 1, 1024, 0, 1, 0 },
- { "print", OPT_PRINT, "Print metadata, data and log to stdout",
+ { "print", NDB_OPT_NOSHORT, "Print metadata, data and log to stdout",
(uchar**) &_print, (uchar**) &_print, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "print_data", OPT_PRINT_DATA, "Print data to stdout",
+ { "print_data", NDB_OPT_NOSHORT, "Print data to stdout",
(uchar**) &_print_data, (uchar**) &_print_data, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "print_meta", OPT_PRINT_META, "Print meta data to stdout",
+ { "print_meta", NDB_OPT_NOSHORT, "Print meta data to stdout",
(uchar**) &_print_meta, (uchar**) &_print_meta, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "print_log", OPT_PRINT_LOG, "Print log to stdout",
+ { "print_log", NDB_OPT_NOSHORT, "Print log to stdout",
(uchar**) &_print_log, (uchar**) &_print_log, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "backup_path", OPT_BACKUP_PATH, "Path to backup files",
+ { "backup_path", NDB_OPT_NOSHORT, "Path to backup files",
(uchar**) &ga_backupPath, (uchar**) &ga_backupPath, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{ "dont_ignore_systab_0", 'f',
@@ -207,38 +191,38 @@ static struct my_option my_long_options[
(uchar**) &opt_nodegroup_map_str,
0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "fields-enclosed-by", OPT_FIELDS_ENCLOSED_BY,
+ { "fields-enclosed-by", NDB_OPT_NOSHORT,
"Fields are enclosed by ...",
(uchar**) &opt_fields_enclosed_by, (uchar**) &opt_fields_enclosed_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "fields-terminated-by", OPT_FIELDS_TERMINATED_BY,
+ { "fields-terminated-by", NDB_OPT_NOSHORT,
"Fields are terminated by ...",
(uchar**) &opt_fields_terminated_by,
(uchar**) &opt_fields_terminated_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "fields-optionally-enclosed-by", OPT_FIELDS_OPTIONALLY_ENCLOSED_BY,
+ { "fields-optionally-enclosed-by", NDB_OPT_NOSHORT,
"Fields are optionally enclosed by ...",
(uchar**) &opt_fields_optionally_enclosed_by,
(uchar**) &opt_fields_optionally_enclosed_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "hex", OPT_HEX_FORMAT, "print binary types in hex format",
+ { "hex", NDB_OPT_NOSHORT, "print binary types in hex format",
(uchar**) &opt_hex_format, (uchar**) &opt_hex_format, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tab", 'T', "Creates tab separated textfile for each table to "
"given path. (creates .txt files)",
(uchar**) &tab_path, (uchar**) &tab_path, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- { "append", OPT_APPEND, "for --tab append data to file",
+ { "append", NDB_OPT_NOSHORT, "for --tab append data to file",
(uchar**) &opt_append, (uchar**) &opt_append, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "lines-terminated-by", OPT_LINES_TERMINATED_BY, "",
+ { "lines-terminated-by", NDB_OPT_NOSHORT, "",
(uchar**) &opt_lines_terminated_by, (uchar**) &opt_lines_terminated_by, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "progress-frequency", OPT_PROGRESS_FREQUENCY,
+ { "progress-frequency", NDB_OPT_NOSHORT,
"Print status uf restore periodically in given seconds",
(uchar**) &opt_progress_frequency, (uchar**) &opt_progress_frequency, 0,
GET_INT, REQUIRED_ARG, 0, 0, 65535, 0, 0, 0 },
- { "no-binlog", OPT_NO_BINLOG,
+ { "no-binlog", NDB_OPT_NOSHORT,
"If a mysqld is connected and has binary log, do not log the restored data",
(uchar**) &opt_no_binlog, (uchar**) &opt_no_binlog, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
@@ -263,17 +247,17 @@ static struct my_option my_long_options[
"Example: db1.t1,db3.t1",
(uchar**) &opt_exclude_tables, (uchar**) &opt_exclude_tables, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "exclude-missing-columns", OPT_EXCLUDE_MISSING_COLUMNS,
+ { "exclude-missing-columns", NDB_OPT_NOSHORT,
"Ignore columns present in backup but not in database",
(uchar**) &ga_exclude_missing_columns,
(uchar**) &ga_exclude_missing_columns, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "disable-indexes", OPT_DISABLE_INDEXES,
+ { "disable-indexes", NDB_OPT_NOSHORT,
"Disable indexes",
(uchar**) &ga_disable_indexes,
(uchar**) &ga_disable_indexes, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "rebuild-indexes", OPT_REBUILD_INDEXES,
+ { "rebuild-indexes", NDB_OPT_NOSHORT,
"Rebuild indexes",
(uchar**) &ga_rebuild_indexes,
(uchar**) &ga_rebuild_indexes, 0,
@@ -565,7 +549,9 @@ o verify nodegroup mapping
if (g_printer == NULL)
return false;
- BackupRestore* restore = new BackupRestore(opt_nodegroup_map,
+ BackupRestore* restore = new BackupRestore(opt_ndb_connectstring,
+ opt_ndb_nodeid,
+ opt_nodegroup_map,
opt_nodegroup_map_len,
ga_nParallelism);
if (restore == NULL)
@@ -1000,7 +986,6 @@ free_data_callback()
g_consumers[i]->tuple_free();
}
-const char * g_connect_string = 0;
static void exitHandler(int code)
{
NDBT_ProgramExit(code);
@@ -1078,8 +1063,6 @@ main(int argc, char** argv)
g_options.append(" --rebuild-indexes");
g_options.appfmt(" -p %d", ga_nParallelism);
- g_connect_string = opt_connect_str;
-
init_progress();
/**
=== modified file 'storage/ndb/tools/select_all.cpp'
--- a/storage/ndb/tools/select_all.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/tools/select_all.cpp 2010-05-04 14:34:54 +0000
@@ -53,7 +53,7 @@ static int use_gci = 0;
static struct my_option my_long_options[] =
{
- NDB_STD_OPTS("ndb_desc"),
+ NDB_STD_OPTS("ndb_select_all"),
{ "database", 'd', "Name of database table is in",
(uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -78,19 +78,19 @@ static struct my_option my_long_options[
{ "delimiter", 'D', "Column delimiter",
(uchar**) &_delimiter, (uchar**) &_delimiter, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "disk", 256, "Dump disk ref",
+ { "disk", NDB_OPT_NOSHORT, "Dump disk ref",
(uchar**) &_dumpDisk, (uchar**) &_dumpDisk, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "rowid", 256, "Dump rowid",
+ { "rowid", NDB_OPT_NOSHORT, "Dump rowid",
(uchar**) &use_rowid, (uchar**) &use_rowid, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "gci", 256, "Dump gci",
+ { "gci", NDB_OPT_NOSHORT, "Dump gci",
(uchar**) &use_gci, (uchar**) &use_gci, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
{ "tupscan", 't', "Scan in tup order",
(uchar**) &_tup, (uchar**) &_tup, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "nodata", 256, "Dont print data",
+ { "nodata", NDB_OPT_NOSHORT, "Dont print data",
(uchar**) &nodata, (uchar**) &nodata, 0,
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}
@@ -124,7 +124,7 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
con.set_name("ndb_select_all");
if(con.connect(12, 5, 1) != 0)
{
=== modified file 'storage/ndb/tools/select_count.cpp'
--- a/storage/ndb/tools/select_count.cpp 2009-05-27 15:21:45 +0000
+++ b/storage/ndb/tools/select_count.cpp 2010-05-04 14:34:54 +0000
@@ -42,7 +42,7 @@ const char *load_default_groups[]= { "my
static struct my_option my_long_options[] =
{
- NDB_STD_OPTS("ndb_desc"),
+ NDB_STD_OPTS("ndb_select_count"),
{ "database", 'd', "Name of database table is in",
(uchar**) &_dbname, (uchar**) &_dbname, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -81,7 +81,7 @@ int main(int argc, char** argv){
return NDBT_ProgramExit(NDBT_WRONGARGS);
}
- Ndb_cluster_connection con(opt_connect_str);
+ Ndb_cluster_connection con(opt_ndb_connectstring, opt_ndb_nodeid);
con.set_name("ndb_select_count");
if(con.connect(12, 5, 1) != 0)
{
=== modified file 'storage/ndb/tools/waiter.cpp'
--- a/storage/ndb/tools/waiter.cpp 2010-03-29 14:16:24 +0000
+++ b/storage/ndb/tools/waiter.cpp 2010-05-04 14:34:54 +0000
@@ -33,12 +33,6 @@
static int
waitClusterStatus(const char* _addr, ndb_mgm_node_status _status);
-enum ndb_waiter_options {
- OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST,
- OPT_WAIT_STATUS_SINGLE_USER
- ,OPT_NOWAIT_NODES
-};
-
static int _no_contact = 0;
static int _not_started = 0;
static int _single_user = 0;
@@ -51,14 +45,14 @@ const char *load_default_groups[]= { "my
static struct my_option my_long_options[] =
{
- NDB_STD_OPTS("ndb_desc"),
+ NDB_STD_OPTS("ndb_waiter"),
{ "no-contact", 'n', "Wait for cluster no contact",
(uchar**) &_no_contact, (uchar**) &_no_contact, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
+ { "not-started", NDB_OPT_NOSHORT, "Wait for cluster not started",
(uchar**) &_not_started, (uchar**) &_not_started, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
- { "single-user", OPT_WAIT_STATUS_SINGLE_USER,
+ { "single-user", NDB_OPT_NOSHORT,
"Wait for cluster to enter single user mode",
(uchar**) &_single_user, (uchar**) &_single_user, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
@@ -68,7 +62,7 @@ static struct my_option my_long_options[
{ "wait-nodes", 'w', "Node ids to wait on, e.g. '1,2-4'",
(uchar**) &_wait_nodes, (uchar**) &_wait_nodes, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "nowait-nodes", OPT_NOWAIT_NODES,
+ { "nowait-nodes", NDB_OPT_NOSHORT,
"Nodes that will not be waited for, e.g. '2,3,4-7'",
(uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
@@ -89,7 +83,6 @@ int main(int argc, char** argv){
NDB_INIT(argv[0]);
ndb_opt_set_usage_funcs(NULL, short_usage_sub, usage);
load_defaults("my",load_default_groups,&argc,&argv);
- const char* _hostName = NULL;
#ifndef DBUG_OFF
opt_debug= "d:t:O,/tmp/ndb_waiter.trace";
@@ -99,10 +92,9 @@ int main(int argc, char** argv){
ndb_std_get_one_option))
return NDBT_ProgramExit(NDBT_WRONGARGS);
- _hostName = argv[0];
-
- if (_hostName == 0)
- _hostName= opt_connect_str;
+ const char* connect_string = argv[0];
+ if (connect_string == 0)
+ connect_string = opt_ndb_connectstring;
enum ndb_mgm_node_status wait_status;
if (_no_contact)
@@ -165,7 +157,7 @@ int main(int argc, char** argv){
nowait_nodes_bitmask.bitNOT();
}
- if (waitClusterStatus(_hostName, wait_status) != 0)
+ if (waitClusterStatus(connect_string, wait_status) != 0)
return NDBT_ProgramExit(NDBT_FAILED);
return NDBT_ProgramExit(NDBT_OK);
}
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20100505093008-81x1i3vzcyrq1y4o.bundle
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:3523 to 3524) | Magnus Blåudd | 5 May |