summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <tomas@poseidon.(none)>2004-08-20 16:10:47 +0000
committerunknown <tomas@poseidon.(none)>2004-08-20 16:10:47 +0000
commitc6150949bf5b6bbfadc8cd568f7f3ad69a7dd84f (patch)
tree22c043a8b3828e611f157a0f22ca67a638ad328d /sql
parent80d924d9349a240d27da82bb19a6af520471c2f8 (diff)
downloadmariadb-git-c6150949bf5b6bbfadc8cd568f7f3ad69a7dd84f.tar.gz
added switch to mysqld to specify connectstring
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc8
-rw-r--r--sql/ha_ndbcluster.h2
-rw-r--r--sql/mysqld.cc12
3 files changed, 21 insertions, 1 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 0545645b1fa..2c066c8da1c 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -46,6 +46,9 @@ static const int max_transactions= 256;
// Default value for prefetch of autoincrement values
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
@@ -3375,6 +3378,11 @@ int ndb_discover_tables()
bool 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
g_ndb= new Ndb("sys");
if (g_ndb->init() != 0)
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 7eb1b8dbefb..0d9c28723ce 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -37,6 +37,8 @@ class NdbScanOperation;
class NdbIndexScanOperation;
class NdbBlob;
+// connectstring to cluster if given by mysqld
+extern const char *ndbcluster_connectstring;
typedef enum ndb_index_type {
UNDEFINED_INDEX = 0,
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7050929d6ed..bf305b2a8c3 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3893,7 +3893,7 @@ enum options_mysqld
OPT_INNODB_FILE_PER_TABLE, OPT_CRASH_BINLOG_INNODB,
OPT_INNODB_LOCKS_UNSAFE_FOR_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_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
@@ -4318,6 +4318,11 @@ master-ssl",
Disable with --skip-ndbcluster (will save memory).",
(gptr*) &opt_ndbcluster, (gptr*) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 1, 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.",
(gptr*) &global_system_variables.new_mode,
(gptr*) &max_system_variables.new_mode,
@@ -5999,6 +6004,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
have_ndbcluster=SHOW_OPTION_DISABLED;
#endif
break;
+ case OPT_NDB_CONNECTSTRING:
+#ifdef HAVE_NDBCLUSTER_DB
+ have_ndbcluster=SHOW_OPTION_YES;
+#endif
+ break;
case OPT_INNODB:
#ifdef HAVE_INNOBASE_DB
if (opt_innodb)