changed switch name from --ndb-mgmd-host to --ndb-mgmd

+ simplified code
parent e5c71dd0
...@@ -31,7 +31,7 @@ int opt_ndb_nodeid; ...@@ -31,7 +31,7 @@ int opt_ndb_nodeid;
my_bool opt_ndb_shm; my_bool opt_ndb_shm;
const char *opt_ndb_connectstring= 0; const char *opt_ndb_connectstring= 0;
const char *opt_connect_str= 0; const char *opt_connect_str= 0;
const char *opt_ndb_mgmd_host= 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;
...@@ -50,10 +50,10 @@ unsigned opt_ndb_constrbuf_len; ...@@ -50,10 +50,10 @@ unsigned opt_ndb_constrbuf_len;
"Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \ "Overides specifying entries in NDB_CONNECTSTRING and Ndb.cfg", \
(gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \ (gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring, \
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-mgmd-host", OPT_NDB_MGMD_HOST, \ { "ndb-mgmd-host", OPT_NDB_MGMD, \
"Set host and port for connecting to ndb_mgmd. " \ "Set host and port for connecting to ndb_mgmd. " \
"Syntax: <hostname>[:<port>].", \ "Syntax: <hostname>[:<port>].", \
(gptr*) &opt_ndb_mgmd_host, (gptr*) &opt_ndb_mgmd_host, 0, \ (gptr*) &opt_ndb_mgmd, (gptr*) &opt_ndb_mgmd, 0, \
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
{ "ndb-nodeid", OPT_NDB_NODEID, \ { "ndb-nodeid", OPT_NDB_NODEID, \
"Set node id for this node.", \ "Set node id for this node.", \
...@@ -93,7 +93,7 @@ enum ndb_std_options { ...@@ -93,7 +93,7 @@ enum ndb_std_options {
OPT_NDB_SHM= 256, OPT_NDB_SHM= 256,
OPT_NDB_SHM_SIGNUM, OPT_NDB_SHM_SIGNUM,
OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_OPTIMIZED_NODE_SELECTION,
OPT_NDB_MGMD_HOST, OPT_NDB_MGMD,
OPT_NDB_NODEID, OPT_NDB_NODEID,
NDB_STD_OPTIONS_LAST /* should always be last in this enum */ NDB_STD_OPTIONS_LAST /* should always be last in this enum */
}; };
...@@ -126,16 +126,14 @@ ndb_std_get_one_option(int optid, ...@@ -126,16 +126,14 @@ ndb_std_get_one_option(int optid,
#endif #endif
} }
break; break;
case OPT_NDB_MGMD_HOST: case OPT_NDB_MGMD:
case OPT_NDB_NODEID: case OPT_NDB_NODEID:
{ {
const char *tmp="";
if (optid == OPT_NDB_NODEID)
tmp= "nodeid=";
int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len, int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
"%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"", "%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"",
tmp, argument); optid == OPT_NDB_NODEID ? "nodeid=" : "",
argument);
opt_ndb_constrbuf_len+= len; opt_ndb_constrbuf_len+= len;
} }
/* fall through to add the connectstring to the end /* fall through to add the connectstring to the end
...@@ -147,6 +145,8 @@ ndb_std_get_one_option(int optid, ...@@ -147,6 +145,8 @@ ndb_std_get_one_option(int optid,
sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
"%s%s", opt_ndb_constrbuf_len > 0 ? ",":"", "%s%s", opt_ndb_constrbuf_len > 0 ? ",":"",
opt_ndb_connectstring); opt_ndb_connectstring);
else
opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0;
opt_connect_str= opt_ndb_constrbuf; opt_connect_str= opt_ndb_constrbuf;
break; break;
} }
......
...@@ -148,7 +148,7 @@ const char *nodeIdTokens[] = { ...@@ -148,7 +148,7 @@ const char *nodeIdTokens[] = {
const char *hostNameTokens[] = { const char *hostNameTokens[] = {
"host://%[^:]:%i", "host://%[^:]:%i",
"host=%[^:]:%i", "host=%[^:]:%i",
"mgmd-host=%[^:]:%i", "mgmd=%[^:]:%i",
"%[^:^=^ ]:%i", "%[^:^=^ ]:%i",
"%s %i", "%s %i",
0 0
......
...@@ -296,7 +296,7 @@ char opt_ndb_constrbuf[1024]; ...@@ -296,7 +296,7 @@ char opt_ndb_constrbuf[1024];
unsigned opt_ndb_constrbuf_len; unsigned opt_ndb_constrbuf_len;
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_host; const char *opt_ndb_mgmd;
ulong opt_ndb_nodeid; ulong opt_ndb_nodeid;
#endif #endif
my_bool opt_readonly, use_temp_pool, relay_log_purge; my_bool opt_readonly, use_temp_pool, relay_log_purge;
...@@ -4178,7 +4178,7 @@ enum options_mysqld ...@@ -4178,7 +4178,7 @@ enum options_mysqld
OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_NDB_USE_EXACT_COUNT,
OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ, OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME, OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
OPT_NDB_MGMD_HOST, OPT_NDB_NODEID, OPT_NDB_MGMD, OPT_NDB_NODEID,
OPT_SKIP_SAFEMALLOC, OPT_SKIP_SAFEMALLOC,
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE, OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
...@@ -4673,10 +4673,10 @@ Disable with --skip-ndbcluster (will save memory).", ...@@ -4673,10 +4673,10 @@ Disable with --skip-ndbcluster (will save memory).",
(gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring,
(gptr*) &opt_ndb_connectstring, (gptr*) &opt_ndb_connectstring,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-mgmd-host", OPT_NDB_MGMD_HOST, {"ndb-mgmd-host", OPT_NDB_MGMD,
"Set host and port for ndb_mgmd. Syntax: hostname[:port]", "Set host and port for ndb_mgmd. Syntax: hostname[:port]",
(gptr*) &opt_ndb_mgmd_host, (gptr*) &opt_ndb_mgmd,
(gptr*) &opt_ndb_mgmd_host, (gptr*) &opt_ndb_mgmd,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ndb-nodeid", OPT_NDB_NODEID, {"ndb-nodeid", OPT_NDB_NODEID,
"Nodeid for this mysqlserver in the cluster.", "Nodeid for this mysqlserver in the cluster.",
...@@ -6522,16 +6522,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -6522,16 +6522,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif #endif
break; break;
#ifdef HAVE_NDBCLUSTER_DB #ifdef HAVE_NDBCLUSTER_DB
case OPT_NDB_MGMD_HOST: case OPT_NDB_MGMD:
case OPT_NDB_NODEID: case OPT_NDB_NODEID:
{ {
const char *tmp="";
if (optid == OPT_NDB_NODEID)
tmp= "nodeid=";
int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len, int len= my_snprintf(opt_ndb_constrbuf+opt_ndb_constrbuf_len,
sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
"%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"", "%s%s%s",opt_ndb_constrbuf_len > 0 ? ",":"",
tmp, argument); optid == OPT_NDB_NODEID ? "nodeid=" : "",
argument);
opt_ndb_constrbuf_len+= len; opt_ndb_constrbuf_len+= len;
} }
/* fall through to add the connectstring to the end /* fall through to add the connectstring to the end
...@@ -6543,6 +6541,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -6543,6 +6541,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len, sizeof(opt_ndb_constrbuf)-opt_ndb_constrbuf_len,
"%s%s", opt_ndb_constrbuf_len > 0 ? ",":"", "%s%s", opt_ndb_constrbuf_len > 0 ? ",":"",
opt_ndb_connectstring); opt_ndb_connectstring);
else
opt_ndb_constrbuf[opt_ndb_constrbuf_len]= 0;
opt_ndbcluster_connectstring= opt_ndb_constrbuf; opt_ndbcluster_connectstring= opt_ndb_constrbuf;
break; break;
#endif #endif
......
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