Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-09-24 16:02:00+02:00, jonas@stripped +6 -0
ndb - atrt
add db to keep state about process(es) and the options
storage/ndb/test/run-test/Makefile.am@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +4 -3
Add db.sql (atrt db definition)
db.cpp (atrt db layer)
storage/ndb/test/run-test/atrt.hpp@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +9 -2
Add MYSQL connectivity
storage/ndb/test/run-test/db.cpp@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +459 -0
New BitKeeper file ``storage/ndb/test/run-test/db.cpp''
storage/ndb/test/run-test/db.cpp@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +0 -0
storage/ndb/test/run-test/db.sql@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +36 -0
New BitKeeper file ``storage/ndb/test/run-test/db.sql''
storage/ndb/test/run-test/db.sql@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +0 -0
storage/ndb/test/run-test/main.cpp@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +30 -4
add atrt db
storage/ndb/test/run-test/setup.cpp@stripped, 2007-09-24 16:01:55+02:00, jonas@stripped +28 -2
add host definition for client(s)
diff -Nrup a/storage/ndb/test/run-test/Makefile.am b/storage/ndb/test/run-test/Makefile.am
--- a/storage/ndb/test/run-test/Makefile.am 2007-08-31 16:12:49 +02:00
+++ b/storage/ndb/test/run-test/Makefile.am 2007-09-24 16:01:55 +02:00
@@ -23,19 +23,20 @@ include $(top_srcdir)/storage/ndb/config
test_PROGRAMS = atrt
test_DATA=daily-basic-tests.txt daily-devel-tests.txt 16node-tests.txt \
conf-ndbmaster.cnf \
- conf-dl145a.cnf test-tests.txt conf-test.cnf
+ conf-dl145a.cnf test-tests.txt conf-test.cnf db.sql
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
atrt-clear-result.sh autotest-run.sh
-atrt_SOURCES = main.cpp setup.cpp files.cpp
+atrt_SOURCES = main.cpp setup.cpp files.cpp db.cpp
INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/test/include
LDADD_LOC = $(top_builddir)/storage/ndb/test/src/libNDBT.a \
$(top_builddir)/storage/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \
- $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
+ $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@ \
+ $(top_builddir)/libmysql_r/libmysqlclient_r.la
atrt_CXXFLAGS = -I$(top_srcdir)/ndb/src/mgmapi \
-I$(top_srcdir)/ndb/src/mgmsrv \
diff -Nrup a/storage/ndb/test/run-test/atrt.hpp b/storage/ndb/test/run-test/atrt.hpp
--- a/storage/ndb/test/run-test/atrt.hpp 2007-07-04 08:58:49 +02:00
+++ b/storage/ndb/test/run-test/atrt.hpp 2007-09-24 16:01:55 +02:00
@@ -23,6 +23,7 @@
#include <mgmapi.h>
#include <CpcClient.hpp>
#include <Properties.hpp>
+#include <mysql.h>
enum ErrorCodes
{
@@ -76,7 +77,7 @@ struct atrt_process
atrt_process * m_mysqld; // if type == client
atrt_process * m_rep_src; // if type == mysqld
Vector<atrt_process*> m_rep_dst; // if type == mysqld
-
+ MYSQL m_mysql; // if type == mysqld
atrt_options m_options;
};
@@ -112,7 +113,7 @@ extern Logger g_logger;
void require(bool x);
bool parse_args(int argc, char** argv);
-bool setup_config(atrt_config&);
+bool setup_config(atrt_config&, const char * mysqld);
bool configure(atrt_config&, int setup);
bool setup_directories(atrt_config&, int setup);
bool setup_files(atrt_config&, int setup, int sshx);
@@ -135,6 +136,12 @@ bool read_test_case(FILE *, atrt_testcas
bool setup_test_case(atrt_config&, const atrt_testcase&);
bool setup_hosts(atrt_config&);
+
+/**
+ * SQL
+ */
+bool setup_db(atrt_config&);
+const char* find(const atrt_process* proc, const char * name);
/**
* Global variables...
diff -Nrup a/storage/ndb/test/run-test/db.cpp b/storage/ndb/test/run-test/db.cpp
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/storage/ndb/test/run-test/db.cpp 2007-09-24 16:01:55 +02:00
@@ -0,0 +1,459 @@
+/* Copyright (C) 2003 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "atrt.hpp"
+#include <NdbSleep.h>
+
+static bool run_sql(atrt_process*, const char * str);
+static bool connect_mysqld(atrt_process* proc);
+static bool populate_db(atrt_config&, atrt_process*);
+static bool setup_repl(atrt_config&);
+
+static atrt_process* f_mysqld = 0;
+
+bool
+setup_db(atrt_config& config)
+{
+ /**
+ * Install atrt db
+ */
+ atrt_process* atrt_client = 0;
+ {
+ atrt_cluster* cluster = 0;
+ for (size_t i = 0; i<config.m_clusters.size(); i++)
+ {
+ if (strcmp(config.m_clusters[i]->m_name.c_str(), ".atrt") == 0)
+ {
+ cluster = config.m_clusters[i];
+
+ for (size_t i = 0; i<cluster->m_processes.size(); i++)
+ {
+ if (cluster->m_processes[i]->m_type == atrt_process::AP_CLIENT)
+ {
+ atrt_client = cluster->m_processes[i];
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * connect to all mysqld's
+ */
+ for (size_t i = 0; i<config.m_processes.size(); i++)
+ {
+ atrt_process * proc = config.m_processes[i];
+ if (proc->m_type == atrt_process::AP_MYSQLD)
+ {
+ if (!connect_mysqld(config.m_processes[i]))
+ return false;
+ }
+ }
+
+ if (atrt_client)
+ {
+ f_mysqld = atrt_client->m_mysqld;
+ assert(f_mysqld);
+
+ BaseString tmp;
+ tmp.assfmt("%s/bin/mysql -uroot < %s/mysql-test/ndb/db.sql",
+ g_prefix, g_prefix);
+ if (!run_sql(atrt_client, tmp.c_str()))
+ return false;
+
+ if (mysql_query(&f_mysqld->m_mysql, "USE atrt"))
+ {
+ g_logger.error("Failed to change db to atrt");
+ return false;
+ }
+
+ if (!populate_db(config, f_mysqld))
+ {
+ return false;
+ }
+ }
+
+ /**
+ * setup replication
+ */
+ if (setup_repl(config) != true)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+const char*
+find(atrt_process* proc, const char * key)
+{
+ const char * res = 0;
+ if (proc->m_options.m_loaded.get(key, &res))
+ return res;
+
+ proc->m_options.m_generated.get(key, &res);
+ return res;
+}
+
+bool
+connect_mysqld(atrt_process* proc)
+{
+ if ( !mysql_init(&proc->m_mysql))
+ {
+ g_logger.error("Failed to init mysql");
+ return false;
+ }
+
+ const char * port = find(proc, "--port=");
+ const char * socket = find(proc, "--socket=");
+ assert(port);
+
+ for (size_t i = 0; i<20; i++)
+ {
+ if (mysql_real_connect(&proc->m_mysql,
+ proc->m_host->m_hostname.c_str(),
+ "root", "", "test",
+ atoi(port),
+ socket,
+ 0))
+ {
+ return true;
+ }
+ g_logger.info("Retrying connect to %s:%u 3s",
+ proc->m_host->m_hostname.c_str(),atoi(port));
+ NdbSleep_SecSleep(3);
+ }
+
+ g_logger.error("Failed to connect to mysqld err: >%s< >%s:%u:%s<",
+ mysql_error(&proc->m_mysql),
+ proc->m_host->m_hostname.c_str(),atoi(port),
+ socket);
+ return false;
+}
+
+bool
+run_sql(atrt_process * proc, const char * sql)
+{
+ bool res = true;
+ if (chdir(proc->m_proc.m_cwd.c_str()))
+ {
+ g_logger.error("Failed to chdir to %s!!", proc->m_proc.m_cwd.c_str());
+ return false;
+ }
+
+ BaseString tmp;
+ tmp.assfmt(". env.sh ; %s", sql);
+
+ g_logger.debug("%s-system(%s)", proc->m_proc.m_cwd.c_str(), tmp.c_str());
+ if (system(tmp.c_str()) != 0)
+ {
+ g_logger.error("Failed to run sql: %s", sql);
+ res = false;
+ abort();
+ }
+
+ if (chdir(g_cwd))
+ {
+ g_logger.error("Failed to chdir (back) %s", g_cwd);
+ }
+
+ return res;
+}
+
+void
+BINDI(MYSQL_BIND& bind, int * i, unsigned long * len)
+{
+ bind.buffer_type= MYSQL_TYPE_LONG;
+ bind.buffer= (char*)i;
+ bind.buffer_length= * len = sizeof(int);
+ bind.length= len;
+ bind.is_null= 0;
+}
+
+void
+BINDS(MYSQL_BIND& bind, const char * s, unsigned long * len)
+{
+ bind.buffer_type= MYSQL_TYPE_STRING;
+ bind.buffer= (char*)s;
+ bind.buffer_length= * len = strlen(s);
+ bind.length= len;
+ bind.is_null= 0;
+}
+
+template <typename T>
+static
+int
+find(T* obj, Vector<T*>& arr)
+{
+ for (size_t i = 0; i<arr.size(); i++)
+ if (arr[i] == obj)
+ return (int)i;
+ abort();
+ return -1;
+}
+
+static
+bool
+populate_options(MYSQL* mysql, MYSQL_STMT* stmt, int* option_id,
+ int process_id, Properties* p)
+{
+ int kk = *option_id;
+ Properties::Iterator it(p);
+ const char * name = it.first();
+ for (; name; name = it.next())
+ {
+ int optid = kk;
+ int proc_id = process_id;
+ unsigned long l0, l1, l2, l3;
+ const char * value;
+ p->get(name, &value);
+ MYSQL_BIND bind2[4];
+ bzero(bind2, sizeof(bind2));
+ BINDI(bind2[0], &optid, &l0);
+ BINDI(bind2[1], &proc_id, &l1);
+ BINDS(bind2[2], name, &l2);
+ BINDS(bind2[3], value, &l3);
+
+ if (mysql_stmt_bind_param(stmt, bind2))
+ {
+ g_logger.error("Failed to bind: %s", mysql_error(mysql));
+ return false;
+ }
+
+ if (mysql_stmt_execute(stmt))
+ {
+ g_logger.error("Failed to execute: %s", mysql_error(mysql));
+ return false;
+ }
+ kk++;
+ }
+ *option_id = kk;
+ return true;
+}
+
+static
+bool
+populate_db(atrt_config& config, atrt_process* mysqld)
+{
+ {
+ const char * sql = "INSERT INTO host (id, name, port) values (?, ?, ?)";
+ MYSQL_STMT * stmt = mysql_stmt_init(&mysqld->m_mysql);
+ if (mysql_stmt_prepare(stmt, sql, strlen(sql)))
+ {
+ g_logger.error("Failed to prepare: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ for (size_t i = 0; i<config.m_hosts.size(); i++)
+ {
+ unsigned long l0, l1, l2;
+ MYSQL_BIND bind[3];
+ bzero(bind, sizeof(bind));
+ int id = i;
+ int port = config.m_hosts[i]->m_cpcd->getPort();
+ BINDI(bind[0], &id, &l0);
+ BINDS(bind[1], config.m_hosts[i]->m_hostname.c_str(), &l1);
+ BINDI(bind[2], &port, &l2);
+ if (mysql_stmt_bind_param(stmt, bind))
+ {
+ g_logger.error("Failed to bind: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ if (mysql_stmt_execute(stmt))
+ {
+ g_logger.error("Failed to execute: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+ mysql_stmt_close(stmt);
+ }
+ }
+
+ {
+ const char * sql = "INSERT INTO cluster (id, name) values (?, ?)";
+ MYSQL_STMT * stmt = mysql_stmt_init(&mysqld->m_mysql);
+ if (mysql_stmt_prepare(stmt, sql, strlen(sql)))
+ {
+ g_logger.error("Failed to prepare: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ for (size_t i = 0; i<config.m_clusters.size(); i++)
+ {
+ unsigned long l0, l1;
+ MYSQL_BIND bind[2];
+ bzero(bind, sizeof(bind));
+ int id = i;
+ BINDI(bind[0], &id, &l0);
+ BINDS(bind[1], config.m_clusters[i]->m_name.c_str(), &l1);
+ if (mysql_stmt_bind_param(stmt, bind))
+ {
+ g_logger.error("Failed to bind: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ if (mysql_stmt_execute(stmt))
+ {
+ g_logger.error("Failed to execute: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+ }
+ mysql_stmt_close(stmt);
+ }
+
+ {
+ const char * sql =
+ "INSERT INTO process (id, host_id, cluster_id, type, state) values (?,?,?,?, ?)";
+
+ const char * sqlopt =
+ "INSERT INTO options (id, process_id, name, value) values (?,?,?,?)";
+
+ MYSQL_STMT * stmt = mysql_stmt_init(&mysqld->m_mysql);
+ if (mysql_stmt_prepare(stmt, sql, strlen(sql)))
+ {
+ g_logger.error("Failed to prepare: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ MYSQL_STMT * stmtopt = mysql_stmt_init(&mysqld->m_mysql);
+ if (mysql_stmt_prepare(stmtopt, sqlopt, strlen(sqlopt)))
+ {
+ g_logger.error("Failed to prepare: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ int option_id = 0;
+ for (size_t i = 0; i<config.m_processes.size(); i++)
+ {
+ unsigned long l0, l1, l2, l3, l4;
+ MYSQL_BIND bind[5];
+ bzero(bind, sizeof(bind));
+ int id = i;
+ atrt_process* proc = config.m_processes[i];
+ int host_id = find(proc->m_host, config.m_hosts);
+ int cluster_id = find(proc->m_cluster, config.m_clusters);
+
+ const char * type = 0;
+ const char * state = "started";
+ switch(proc->m_type){
+ case atrt_process::AP_NDBD: type = "ndbd"; break;
+ case atrt_process::AP_NDB_API: type = "ndbapi"; state = "stopped";break;
+ case atrt_process::AP_NDB_MGMD: type = "ndb_mgmd"; break;
+ case atrt_process::AP_MYSQLD: type = "mysqld"; break;
+ case atrt_process::AP_CLIENT: type = "mysql"; state = "stopped";break;
+ default:
+ abort();
+ }
+
+ BINDI(bind[0], &id, &l0);
+ BINDI(bind[1], &host_id, &l1);
+ BINDI(bind[2], &cluster_id, &l2);
+ BINDS(bind[3], type, &l3);
+ BINDS(bind[4], state, &l4);
+
+ if (mysql_stmt_bind_param(stmt, bind))
+ {
+ g_logger.error("Failed to bind: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ if (mysql_stmt_execute(stmt))
+ {
+ g_logger.error("Failed to execute: %s", mysql_error(&mysqld->m_mysql));
+ return false;
+ }
+
+ if (populate_options(&mysqld->m_mysql, stmtopt, &option_id, i,
+ &proc->m_options.m_loaded) == false)
+ return false;
+
+ if (populate_options(&mysqld->m_mysql, stmtopt, &option_id, i,
+ &proc->m_cluster->m_options.m_loaded) == false)
+ return false;
+
+ }
+ mysql_stmt_close(stmt);
+ mysql_stmt_close(stmtopt);
+ }
+
+ return true;
+}
+
+static
+bool
+setup_repl(atrt_process* src, atrt_process* dst)
+{
+ if (mysql_query(&src->m_mysql, "STOP SLAVE"))
+ {
+ g_logger.error("Failed to stop slave: %s",
+ mysql_error(&src->m_mysql));
+ return false;
+ }
+
+ if (mysql_query(&src->m_mysql, "RESET SLAVE"))
+ {
+ g_logger.error("Failed to reset slave: %s",
+ mysql_error(&src->m_mysql));
+ return false;
+ }
+
+ BaseString tmp;
+ tmp.assfmt("CHANGE MASTER TO "
+ " MASTER_HOST='%s', "
+ " MASTER_PORT=%u ",
+ dst->m_host->m_hostname.c_str(),
+ atoi(find(dst, "--port=")));
+
+ if (mysql_query(&src->m_mysql, tmp.c_str()))
+ {
+ g_logger.error("Failed to setup repl from %s to %s: %s",
+ src->m_host->m_hostname.c_str(),
+ dst->m_host->m_hostname.c_str(),
+ mysql_error(&src->m_mysql));
+ return false;
+ }
+
+ if (mysql_query(&src->m_mysql, "START SLAVE"))
+ {
+ g_logger.error("Failed to start slave: %s",
+ mysql_error(&src->m_mysql));
+ return false;
+ }
+
+ g_logger.info("Replication from %s(%s) to %s(%s) setup",
+ src->m_host->m_hostname.c_str(),
+ src->m_cluster->m_name.c_str(),
+ dst->m_host->m_hostname.c_str(),
+ dst->m_cluster->m_name.c_str());
+
+ return true;
+}
+
+bool
+setup_repl(atrt_config& config)
+{
+ for (size_t i = 0; i<config.m_processes.size(); i++)
+ {
+ atrt_process * dst = config.m_processes[i];
+ if (dst->m_rep_src)
+ {
+ if (setup_repl(dst->m_rep_src, dst) != true)
+ return false;
+ }
+ }
+ return true;
+}
diff -Nrup a/storage/ndb/test/run-test/db.sql b/storage/ndb/test/run-test/db.sql
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/storage/ndb/test/run-test/db.sql 2007-09-24 16:01:55 +02:00
@@ -0,0 +1,36 @@
+create database atrt;
+use atrt;
+
+create table host (
+ id int primary key,
+ name varchar(255),
+ port int unsigned,
+ unique(name, port)
+ ) engine = myisam;
+
+create table cluster (
+ id int primary key,
+ name varchar(255),
+ unique(name)
+ ) engine = myisam;
+
+create table process (
+ id int primary key,
+ host_id int not null,
+ cluster_id int not null,
+ type enum ('ndbd', 'ndbapi', 'ndb_mgmd', 'mysqld', 'mysql') not null,
+ state enum ('starting', 'started', 'stopping', 'stopped') not null
+ ) engine = myisam;
+
+create table options (
+ id int primary key,
+ process_id int not null,
+ name varchar(255) not null,
+ value varchar(255) not null
+ ) engine = myisam;
+
+create table repl (
+ id int auto_increment primary key,
+ master_id int not null,
+ slave_id int not null
+ ) engine = myisam;
diff -Nrup a/storage/ndb/test/run-test/main.cpp b/storage/ndb/test/run-test/main.cpp
--- a/storage/ndb/test/run-test/main.cpp 2007-08-21 15:37:54 +02:00
+++ b/storage/ndb/test/run-test/main.cpp 2007-09-24 16:01:55 +02:00
@@ -69,6 +69,7 @@ char *save_extra_file = 0;
const char *save_group_suffix = 0;
const char * g_dummy;
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;
@@ -84,6 +85,9 @@ static struct my_option g_options[] =
{ "clusters", 256, "Cluster",
(uchar **) &g_clusters, (uchar **) &g_clusters,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ { "mysqld", 256, "atrt mysqld",
+ (uchar **) &g_mysqld_host, (uchar **) &g_mysqld_host,
+ 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "replicate", 1024, "replicate",
(uchar **) &g_dummy, (uchar **) &g_dummy,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -159,7 +163,7 @@ main(int argc, char ** argv)
g_logger.info("Starting...");
g_config.m_generated = false;
g_config.m_replication = g_replicate;
- if (!setup_config(g_config))
+ if (!setup_config(g_config, g_mysqld_host))
goto end;
if (!configure(g_config, g_do_setup))
@@ -216,6 +220,9 @@ main(int argc, char ** argv)
if (!start(g_config, g_do_start))
goto end;
+ if (!setup_db(g_config))
+ goto end;
+
g_logger.info("Done...sleeping");
while(true)
{
@@ -250,6 +257,10 @@ main(int argc, char ** argv)
if (!start(g_config, p_ndb | p_servers))
goto end;
+
+ if (!setup_db(g_config))
+ goto end;
+
g_logger.info("All servers start completed");
}
@@ -673,6 +684,16 @@ wait_ndb(atrt_config& config, int goal){
for (size_t i = 0; i<config.m_clusters.size(); i++)
{
atrt_cluster* cluster = config.m_clusters[i];
+
+ if (strcmp(cluster->m_name.c_str(), ".atrt") == 0)
+ {
+ /**
+ * skip atrt mysql
+ */
+ cnt++;
+ continue;
+ }
+
/**
* Get mgm handle for cluster
*/
@@ -790,7 +811,8 @@ start_process(atrt_process & proc){
g_logger.debug("system(%s)", tmp.c_str());
const int r1 = system(tmp.c_str());
- if(r1 != 0){
+ if(r1 != 0)
+ {
g_logger.critical("Failed to setup process");
return false;
}
@@ -1042,7 +1064,9 @@ setup_test_case(atrt_config& config, con
for(; i<config.m_processes.size(); i++)
{
atrt_process & proc = *config.m_processes[i];
- if(proc.m_type == atrt_process::AP_NDB_API || proc.m_type == atrt_process::AP_CLIENT){
+ if(proc.m_type == atrt_process::AP_NDB_API ||
+ proc.m_type == atrt_process::AP_CLIENT)
+ {
proc.m_proc.m_path = "";
if (tc.m_command.c_str()[0] != '/')
{
@@ -1056,7 +1080,9 @@ setup_test_case(atrt_config& config, con
}
for(i++; i<config.m_processes.size(); i++){
atrt_process & proc = *config.m_processes[i];
- if(proc.m_type == atrt_process::AP_NDB_API || proc.m_type == atrt_process::AP_CLIENT){
+ if(proc.m_type == atrt_process::AP_NDB_API ||
+ proc.m_type == atrt_process::AP_CLIENT)
+ {
proc.m_proc.m_path.assign("");
proc.m_proc.m_args.assign("");
}
diff -Nrup a/storage/ndb/test/run-test/setup.cpp b/storage/ndb/test/run-test/setup.cpp
--- a/storage/ndb/test/run-test/setup.cpp 2007-02-13 02:38:48 +01:00
+++ b/storage/ndb/test/run-test/setup.cpp 2007-09-24 16:01:55 +02:00
@@ -32,6 +32,7 @@ struct proc_option f_options[] = {
,{ "--datadir=", atrt_process::AP_MYSQLD, 0 }
,{ "--socket=", atrt_process::AP_MYSQLD | atrt_process::AP_CLIENT, 0 }
,{ "--port=", atrt_process::AP_MYSQLD | atrt_process::AP_CLIENT, 0 }
+ ,{ "--host=", atrt_process::AP_CLIENT, 0 }
,{ "--server-id=", atrt_process::AP_MYSQLD, PO_REP }
,{ "--log-bin", atrt_process::AP_MYSQLD, PO_REP_MASTER }
,{ "--master-host=", atrt_process::AP_MYSQLD, PO_REP_SLAVE }
@@ -46,12 +47,17 @@ struct proc_option f_options[] = {
const char * ndbcs = "--ndb-connectstring=";
bool
-setup_config(atrt_config& config)
+setup_config(atrt_config& config, const char* atrt_mysqld)
{
BaseString tmp(g_clusters);
Vector<BaseString> clusters;
tmp.split(clusters, ",");
+ if (atrt_mysqld)
+ {
+ clusters.push_back(BaseString(".atrt"));
+ }
+
bool fqpn = clusters.size() > 1 || g_fqpn;
size_t j,k;
@@ -61,6 +67,7 @@ setup_config(atrt_config& config)
config.m_clusters.push_back(cluster);
cluster->m_name = clusters[i];
+ cluster->m_options.m_features = 0;
if (fqpn)
{
cluster->m_dir.assfmt("cluster%s/", cluster->m_name.c_str());
@@ -115,6 +122,17 @@ setup_config(atrt_config& config)
}
}
+ if (strcmp(clusters[i].c_str(), ".atrt") == 0)
+ {
+ /**
+ * Only use a mysqld...
+ */
+ proc_args[0].value = 0;
+ proc_args[1].value = 0;
+ proc_args[2].value = 0;
+ proc_args[3].value = 0;
+ }
+
/**
* Load each process
*/
@@ -605,6 +623,15 @@ static
bool
pr_fix_client(Properties& props, proc_rule_ctx& ctx, int)
{
+ atrt_process& proc = *ctx.m_process;
+ const char * val, *name = "--host=";
+ if (!proc.m_options.m_loaded.get(name, &val))
+ {
+ val = proc.m_mysqld->m_host->m_hostname.c_str();
+ proc.m_options.m_loaded.put(name, val);
+ proc.m_options.m_generated.put(name, val);
+ }
+
for (size_t i = 0; f_options[i].name; i++)
{
proc_option& opt = f_options[i];
@@ -612,7 +639,6 @@ pr_fix_client(Properties& props, proc_ru
if (opt.type & atrt_process::AP_CLIENT)
{
const char * val;
- atrt_process& proc = *ctx.m_process;
if (!proc.m_options.m_loaded.get(name, &val))
{
require(proc.m_mysqld->m_options.m_loaded.get(name, &val));
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2630) | jonas | 24 Sep |