Commit c6150949 authored by unknown's avatar unknown

added switch to mysqld to specify connectstring

parent 80d924d9
...@@ -1451,12 +1451,10 @@ then ...@@ -1451,12 +1451,10 @@ then
then then
echo "Starting ndbcluster" echo "Starting ndbcluster"
./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1 ./ndb/ndbcluster --port-base=$NDBCLUSTER_PORT --small --diskless --initial --data-dir=$MYSQL_TEST_DIR/var || exit 1
NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT" USE_NDBCLUSTER="--ndb-connectstring=\"host=localhost:$NDBCLUSTER_PORT\""
export NDB_CONNECTSTRING
else else
NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER" USE_NDBCLUSTER="--ndb-connectstring=\"$USE_RUNNING_NDBCLUSTER\""
export NDB_CONNECTSTRING echo "Using ndbcluster at $USE_NDBCLUSTER"
echo "Using ndbcluster at $NDB_CONNECTSTRING"
fi fi
fi fi
......
...@@ -46,6 +46,9 @@ static const int max_transactions= 256; ...@@ -46,6 +46,9 @@ static const int max_transactions= 256;
// Default value for prefetch of autoincrement values // Default value for prefetch of autoincrement values
static const ha_rows autoincrement_prefetch= 32; static const ha_rows autoincrement_prefetch= 32;
// connectstring to cluster if given by mysqld
const char *ndbcluster_connectstring = 0;
#define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8 #define NDB_HIDDEN_PRIMARY_KEY_LENGTH 8
...@@ -3375,6 +3378,11 @@ int ndb_discover_tables() ...@@ -3375,6 +3378,11 @@ int ndb_discover_tables()
bool ndbcluster_init() bool ndbcluster_init()
{ {
DBUG_ENTER("ndbcluster_init"); DBUG_ENTER("ndbcluster_init");
// Set connectstring if specified
if (ndbcluster_connectstring != 0) {
DBUG_PRINT("connectstring", ("%s", ndbcluster_connectstring));
Ndb::setConnectString(ndbcluster_connectstring);
}
// Create a Ndb object to open the connection to NDB // Create a Ndb object to open the connection to NDB
g_ndb= new Ndb("sys"); g_ndb= new Ndb("sys");
if (g_ndb->init() != 0) if (g_ndb->init() != 0)
......
...@@ -37,6 +37,8 @@ class NdbScanOperation; ...@@ -37,6 +37,8 @@ class NdbScanOperation;
class NdbIndexScanOperation; class NdbIndexScanOperation;
class NdbBlob; class NdbBlob;
// connectstring to cluster if given by mysqld
extern const char *ndbcluster_connectstring;
typedef enum ndb_index_type { typedef enum ndb_index_type {
UNDEFINED_INDEX = 0, UNDEFINED_INDEX = 0,
......
...@@ -3893,7 +3893,7 @@ enum options_mysqld ...@@ -3893,7 +3893,7 @@ enum options_mysqld
OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB, OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG, OPT_INNODB_LOCKS_UNSAFE_FOR_BINLOG,
OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG, OPT_SAFE_SHOW_DB, OPT_INNODB_SAFE_BINLOG,
OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_SKIP_SAFEMALLOC, OPT_INNODB, OPT_ISAM, OPT_NDBCLUSTER, OPT_NDB_CONNECTSTRING, OPT_SKIP_SAFEMALLOC,
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_TEMP_POOL, OPT_TX_ISOLATION,
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS, OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL, OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
...@@ -4318,6 +4318,11 @@ master-ssl", ...@@ -4318,6 +4318,11 @@ master-ssl",
Disable with --skip-ndbcluster (will save memory).", Disable with --skip-ndbcluster (will save memory).",
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0, (gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 0, 0,
0, 0, 0}, 0, 0, 0},
#ifdef HAVE_NDBCLUSTER_DB
{"ndb-connectstring", OPT_NDB_CONNECTSTRING, "Connect string for ndbcluster.",
(gptr*) &ndbcluster_connectstring, (gptr*) &ndbcluster_connectstring, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"new", 'n', "Use very new possible 'unsafe' functions.", {"new", 'n', "Use very new possible 'unsafe' functions.",
(gptr*) &global_system_variables.new_mode, (gptr*) &global_system_variables.new_mode,
(gptr*) &max_system_variables.new_mode, (gptr*) &max_system_variables.new_mode,
...@@ -5997,6 +6002,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -5997,6 +6002,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_ndbcluster=SHOW_OPTION_YES; have_ndbcluster=SHOW_OPTION_YES;
else else
have_ndbcluster=SHOW_OPTION_DISABLED; have_ndbcluster=SHOW_OPTION_DISABLED;
#endif
break;
case OPT_NDB_CONNECTSTRING:
#ifdef HAVE_NDBCLUSTER_DB
have_ndbcluster=SHOW_OPTION_YES;
#endif #endif
break; break;
case OPT_INNODB: case OPT_INNODB:
......
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