#At file:///home/jonas/src/telco-6.4/
3173 Jonas Oreland 2008-12-12 [merge]
merge 63 to 64
added:
storage/ndb/test/run-test/conf-upgrade.cnf
storage/ndb/test/run-test/upgrade-tests.txt
modified:
sql/sql_yacc.yy
storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp
storage/ndb/src/kernel/vm/Configuration.cpp
storage/ndb/test/include/DbUtil.hpp
storage/ndb/test/ndbapi/testUpgrade.cpp
storage/ndb/test/run-test/Makefile.am
storage/ndb/test/run-test/atrt-gather-result.sh
storage/ndb/test/run-test/atrt.hpp
storage/ndb/test/run-test/autotest-boot.sh
storage/ndb/test/run-test/autotest-run.sh
storage/ndb/test/run-test/command.cpp
storage/ndb/test/run-test/files.cpp
storage/ndb/test/run-test/main.cpp
storage/ndb/test/run-test/setup.cpp
storage/ndb/test/src/DbUtil.cpp
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2008-12-10 15:35:47 +0000
+++ b/sql/sql_yacc.yy 2008-12-12 10:25:31 +0000
@@ -1639,8 +1639,9 @@ master_def:
if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
Lex->mi.heartbeat_period < 0.0)
{
- char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD*4)];
- my_sprintf(buf, (buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD));
+ const char format[]= "%d seconds";
+ char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD)*4 + sizeof(format)];
+ my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD));
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
MYF(0),
" is negative or exceeds the maximum ",
=== modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2008-12-08 13:58:15 +0000
+++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2008-12-12 14:44:00 +0000
@@ -17140,10 +17140,16 @@ Dbdih::sendDictUnlockOrd(Signal* signal,
return;
}
}
-
+
+ Uint32 len = DictUnlockOrd::SignalLength;
+ if (unlikely(getNodeInfo(cmasterNodeId).m_version < NDB_MAKE_VERSION(6,3,0)))
+ {
+ jam();
+ len = 2;
+ }
+
BlockReference dictMasterRef = calcDictBlockRef(cmasterNodeId);
- sendSignal(dictMasterRef, GSN_DICT_UNLOCK_ORD, signal,
- DictUnlockOrd::SignalLength, JBB);
+ sendSignal(dictMasterRef, GSN_DICT_UNLOCK_ORD, signal, len, JBB);
}
#ifdef ERROR_INSERT
=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp 2008-11-13 15:22:59 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp 2008-12-12 14:44:00 +0000
@@ -458,20 +458,14 @@ Configuration::setupConfiguration(){
"TimeBetweenWatchDogCheck missing");
}
- if(iter.get(CFG_DB_SCHED_EXEC_TIME, &_schedulerExecutionTimer)){
- ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
- "SchedulerExecutionTimer missing");
- }
+ _schedulerExecutionTimer = 50;
+ iter.get(CFG_DB_SCHED_EXEC_TIME, &_schedulerExecutionTimer);
- if(iter.get(CFG_DB_SCHED_SPIN_TIME, &_schedulerSpinTimer)){
- ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
- "SchedulerSpinTimer missing");
- }
+ _schedulerSpinTimer = 0;
+ iter.get(CFG_DB_SCHED_SPIN_TIME, &_schedulerSpinTimer);
- if(iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler)){
- ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
- "RealtimeScheduler missing");
- }
+ _realtimeScheduler = 0;
+ iter.get(CFG_DB_REALTIME_SCHEDULER, &_realtimeScheduler);
const char * mask;
if(iter.get(CFG_DB_EXECUTE_LOCK_CPU, &mask) == 0)
@@ -485,11 +479,12 @@ Configuration::setupConfiguration(){
_maintLockCPU = NO_LOCK_CPU;
iter.get(CFG_DB_MAINT_LOCK_CPU, &_maintLockCPU);
- if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL, &_timeBetweenWatchDogCheckInitial)){
+ if(iter.get(CFG_DB_WATCHDOG_INTERVAL_INITIAL,
+ &_timeBetweenWatchDogCheckInitial)){
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
"TimeBetweenWatchDogCheckInitial missing");
}
-
+
/**
* Get paths
*/
@@ -504,14 +499,14 @@ Configuration::setupConfiguration(){
ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, "Invalid configuration fetched",
"RestartOnErrorInsert missing");
}
-
+
/**
* Create the watch dog thread
*/
{
if (_timeBetweenWatchDogCheckInitial < _timeBetweenWatchDogCheck)
_timeBetweenWatchDogCheckInitial = _timeBetweenWatchDogCheck;
-
+
Uint32 t = _timeBetweenWatchDogCheckInitial;
t = globalEmulatorData.theWatchDog ->setCheckInterval(t);
_timeBetweenWatchDogCheckInitial = t;
=== modified file 'storage/ndb/test/include/DbUtil.hpp'
--- a/storage/ndb/test/include/DbUtil.hpp 2008-10-30 15:15:48 +0000
+++ b/storage/ndb/test/include/DbUtil.hpp 2008-12-12 14:14:52 +0000
@@ -104,7 +104,7 @@ public:
bool doQuery(BaseString& str, const Properties& args, SqlResultSet&
result);
bool doQuery(BaseString& str, const Properties& args);
- bool waitConnected(int timeout);
+ bool waitConnected(int timeout = 120);
bool databaseLogin(const char * host,
const char * user,
=== modified file 'storage/ndb/test/ndbapi/testUpgrade.cpp'
--- a/storage/ndb/test/ndbapi/testUpgrade.cpp 2008-08-04 13:40:17 +0000
+++ b/storage/ndb/test/ndbapi/testUpgrade.cpp 2008-12-12 14:44:00 +0000
@@ -45,7 +45,7 @@ int runUpgrade_NR1(NDBT_Context* ctx, ND
g_err << "Cluster '" << clusters.column("name")
<< "@" << tmp_result.column("connectstring") << "'" <<
endl;
- if (restarter.waitClusterStarted(1))
+ if (restarter.waitClusterStarted())
return NDBT_FAILED;
// Restart ndb_mgmd(s)
@@ -65,7 +65,7 @@ int runUpgrade_NR1(NDBT_Context* ctx, ND
}
ndbout << "Waiting for started"<< endl;
- if (restarter.waitClusterStarted(1))
+ if (restarter.waitClusterStarted())
return NDBT_FAILED;
ndbout << "Started"<< endl;
@@ -126,7 +126,7 @@ int runUpgrade_NR2(NDBT_Context* ctx, ND
g_err << "Cluster '" << clusters.column("name")
<< "@" << tmp_result.column("connectstring") << "'" <<
endl;
- if(restarter.waitClusterStarted(1))
+ if(restarter.waitClusterStarted())
return NDBT_FAILED;
// Restart ndb_mgmd(s)
@@ -144,6 +144,8 @@ int runUpgrade_NR2(NDBT_Context* ctx, ND
return NDBT_FAILED;
}
+ NdbSleep_SecSleep(5); // TODO, handle arbitration
+
// Restart one ndbd in each node group
SqlResultSet ndbds;
if (!atrt.getNdbds(clusterId, ndbds))
@@ -239,7 +241,7 @@ int runUpgrade_NR3(NDBT_Context* ctx, ND
g_err << "Cluster '" << clusters.column("name")
<< "@" << tmp_result.column("connectstring") << "'" <<
endl;
- if(restarter.waitClusterStarted(1))
+ if(restarter.waitClusterStarted())
return NDBT_FAILED;
// Restart ndb_mgmd(s)
@@ -257,6 +259,8 @@ int runUpgrade_NR3(NDBT_Context* ctx, ND
return NDBT_FAILED;
}
+ NdbSleep_SecSleep(5); // TODO, handle arbitration
+
// Restart one ndbd in each node group
SqlResultSet ndbds;
if (!atrt.getNdbds(clusterId, ndbds))
@@ -338,14 +342,14 @@ int runCheckStarted(NDBT_Context* ctx, N
// Check cluster is started
NdbRestarter restarter;
- if(restarter.waitClusterStarted(1) != 0){
+ if(restarter.waitClusterStarted() != 0){
g_err << "All nodes was not started " << endl;
return NDBT_FAILED;
}
// Check atrtclient is started
AtrtClient atrt;
- if(!atrt.waitConnected(60)){
+ if(!atrt.waitConnected()){
g_err << "atrt server was not started " << endl;
return NDBT_FAILED;
}
@@ -357,7 +361,7 @@ int runCheckStarted(NDBT_Context* ctx, N
while (procs.next())
{
- if (procs.columnAsInt("node_id") == -1){
+ if (procs.columnAsInt("node_id") == (unsigned)-1){
ndbout << "Found one process with node_id -1, "
<< "use --fix-nodeid=1 to atrt to fix this" << endl;
return NDBT_FAILED;
@@ -367,118 +371,21 @@ int runCheckStarted(NDBT_Context* ctx, N
return NDBT_OK;
}
-
-int runRestoreProcs(NDBT_Context* ctx, NDBT_Step* step){
- AtrtClient atrt;
- g_err << "Starting to reset..." << endl;
-
- SqlResultSet clusters;
- if (!atrt.getClusters(clusters))
- return NDBT_FAILED;
-
- while (clusters.next())
- {
- uint clusterId= clusters.columnAsInt("id");
- SqlResultSet tmp_result;
- if (!atrt.getConnectString(clusterId, tmp_result))
- return NDBT_FAILED;
-
- NdbRestarter restarter(tmp_result.column("connectstring"));
- restarter.setReconnect(true); // Restarting mgmd
- g_err << "Cluster '" << clusters.column("name")
- << "@" << tmp_result.column("connectstring") << "'" <<
endl;
-
- if(restarter.waitClusterStarted(1))
- return NDBT_FAILED;
-
- // Reset ndb_mgmd(s)
- SqlResultSet mgmds;
- if (!atrt.getMgmds(clusterId, mgmds))
- return NDBT_FAILED;
-
- while (mgmds.next())
- {
- ndbout << "Reset mgmd" << mgmds.columnAsInt("node_id") << endl;
- if (!atrt.resetProc(mgmds.columnAsInt("id")))
- return NDBT_FAILED;
-
- if(restarter.waitConnected() != 0)
- return NDBT_FAILED;
- }
-
- if(restarter.waitClusterStarted(1))
- return NDBT_FAILED;
-
- // Reset ndbd(s)
- SqlResultSet ndbds;
- if (!atrt.getNdbds(clusterId, ndbds))
- return NDBT_FAILED;
-
- while(ndbds.next())
- {
- int nodeId = ndbds.columnAsInt("node_id");
- int processId = ndbds.columnAsInt("id");
- ndbout << "Reset node " << nodeId << endl;
-
- if (!atrt.resetProc(processId))
- return NDBT_FAILED;
-
- }
-
- if (restarter.waitClusterNoStart())
- return NDBT_FAILED;
-
- }
-
-
- // All nodes are in no start, start them up again
- clusters.reset();
- while (clusters.next())
- {
- uint clusterId= clusters.columnAsInt("id");
- SqlResultSet tmp_result;
- if (!atrt.getConnectString(clusterId, tmp_result))
- return NDBT_FAILED;
-
- NdbRestarter restarter(tmp_result.column("connectstring"));
- g_err << "Cluster '" << clusters.column("name")
- << "@" << tmp_result.column("connectstring") << "'" <<
endl;
-
- if (restarter.waitClusterNoStart())
- return NDBT_FAILED;
-
- ndbout << "Starting and wait for started..." << endl;
- if (restarter.startAll())
- return NDBT_FAILED;
-
- if (restarter.waitClusterStarted())
- return NDBT_FAILED;
- }
-
- ctx->stopTest();
- return NDBT_OK;
-}
-
-
-
NDBT_TESTSUITE(testUpgrade);
TESTCASE("Upgrade_NR1",
"Test that one node at a time can be upgraded"){
INITIALIZER(runCheckStarted);
STEP(runUpgrade_NR1);
- FINALIZER(runRestoreProcs);
}
TESTCASE("Upgrade_NR2",
"Test that one node in each nodegroup can be upgradde simultaneously"){
INITIALIZER(runCheckStarted);
STEP(runUpgrade_NR2);
- FINALIZER(runRestoreProcs);
}
TESTCASE("Upgrade_NR3",
"Test that one node in each nodegroup can be upgrade simultaneously"){
INITIALIZER(runCheckStarted);
STEP(runUpgrade_NR3);
- FINALIZER(runRestoreProcs);
}
NDBT_TESTSUITE_END(testUpgrade);
=== modified file 'storage/ndb/test/run-test/Makefile.am'
--- a/storage/ndb/test/run-test/Makefile.am 2008-10-21 12:41:59 +0000
+++ b/storage/ndb/test/run-test/Makefile.am 2008-12-12 14:44:00 +0000
@@ -23,8 +23,8 @@ 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-fimafeng08.cnf conf-dl145a.cnf test-tests.txt conf-test.cnf db.sql
-# conf-dl145a.cnf test-tests.txt conf-test.cnf db.sql
+ conf-fimafeng08.cnf conf-dl145a.cnf test-tests.txt conf-test.cnf db.sql \
+ conf-upgrade.cnf upgrade-tests.txt
test_SCRIPTS=atrt-analyze-result.sh atrt-gather-result.sh atrt-setup.sh \
autotest-run.sh atrt-backtrace.sh
=== modified file 'storage/ndb/test/run-test/atrt-gather-result.sh'
--- a/storage/ndb/test/run-test/atrt-gather-result.sh 2007-02-16 20:09:38 +0000
+++ b/storage/ndb/test/run-test/atrt-gather-result.sh 2008-12-12 09:40:06 +0000
@@ -12,5 +12,18 @@ do
shift
done
-
-
+#
+# clean tables...not to make results too large
+#
+lst=$(find . -name '*.frm')
+if [ "$lst" ]
+then
+ for i in $lst
+ do
+ basename=$(echo $i | sed 's!\.frm!!')
+ if [ "$basename" ]
+ then
+ rm -f $basename.*
+ fi
+ done
+fi
=== modified file 'storage/ndb/test/run-test/atrt.hpp'
--- a/storage/ndb/test/run-test/atrt.hpp 2008-11-26 12:26:00 +0000
+++ b/storage/ndb/test/run-test/atrt.hpp 2008-12-12 08:48:37 +0000
@@ -149,10 +149,17 @@ bool setup_hosts(atrt_config&);
bool do_command(atrt_config& config);
-bool
-start_process(atrt_process & proc);
-bool
-stop_process(atrt_process & proc);
+bool start_process(atrt_process & proc);
+bool stop_process(atrt_process & proc);
+
+/**
+ * check configuration if any changes has been
+ * done for the duration of the latest running test
+ * if so, return true, and reset those changes
+ * (true, indicates that a restart is needed to actually
+ * reset the running processes)
+ */
+bool reset_config(atrt_config&);
NdbOut&
operator<<(NdbOut& out, const atrt_process& proc);
=== modified file 'storage/ndb/test/run-test/autotest-boot.sh'
--- a/storage/ndb/test/run-test/autotest-boot.sh 2008-12-10 15:35:47 +0000
+++ b/storage/ndb/test/run-test/autotest-boot.sh 2008-12-12 14:14:52 +0000
@@ -171,9 +171,9 @@ fi
if [ -z "$tag1" ]
then
- dst_place1=${build_dir}/clone-$clone1-$DATE.$$
+ dst_place1=${build_dir}/clone1-$clone1-$DATE.$$
else
- dst_place1=${build_dir}/clone-$tag1-$DATE.$$
+ dst_place1=${build_dir}/clone1-$tag1-$DATE.$$
extra_args="$extra_args --clone1=$tag1"
extra_clone1="-r$tag1"
fi
=== modified file 'storage/ndb/test/run-test/autotest-run.sh'
--- a/storage/ndb/test/run-test/autotest-run.sh 2008-12-10 15:35:47 +0000
+++ b/storage/ndb/test/run-test/autotest-run.sh 2008-12-12 14:14:52 +0000
@@ -218,8 +218,9 @@ choose_conf(){
#########################################
count_hosts(){
- cnt=`grep "CHOOSE_host" $1 | awk '{for(i=1; i<=NF;i++) \
- if(index($i, "CHOOSE_host") > 0) print $i;}' | sort | uniq | wc -l`
+ ch="CHOOSE_host"
+ cnt=$(for i in `grep $ch $1 | sed 's!,! !g'` ; do echo $i; done\
+ | grep $ch | sort | uniq | wc -l)
echo $cnt
}
@@ -252,18 +253,22 @@ cd $run_dir
choose $conf $hosts > d.tmp.$$
sed -e s,CHOOSE_dir,"$run_dir/run",g < d.tmp.$$ > my.cnf
+prefix="--prefix=$install_dir0"
+if [ "$install_dir1" ]
+then
+ prefix="$prefix --prefix1=$install_dir1"
+fi
+
+
# Setup configuration
-$atrt Cdq my.cnf
+$atrt Cdq $prefix my.cnf
# Start...
args=""
args="--report-file=report.txt"
args="$args --log-file=log.txt"
args="$args --testcase-file=$test_dir/$RUN-tests.txt"
-if [ "$install_dir1" ]
-then
- args="$args --prefix=$install_dir0 --prefix1=$install_dir1"
-fi
+args="$args $prefix"
$atrt $args my.cnf
# Make tar-ball
=== modified file 'storage/ndb/test/run-test/command.cpp'
--- a/storage/ndb/test/run-test/command.cpp 2008-11-27 18:03:09 +0000
+++ b/storage/ndb/test/run-test/command.cpp 2008-12-12 08:48:37 +0000
@@ -83,10 +83,12 @@ do_change_version(atrt_config& config, S
atrt_process& proc= *config.m_processes[process_id];
// Save current proc state
- assert(proc.m_save.m_saved == false);
- proc.m_save.m_proc= proc.m_proc;
- proc.m_save.m_saved= true;
-
+ if (proc.m_save.m_saved == false)
+ {
+ proc.m_save.m_proc= proc.m_proc;
+ proc.m_save.m_saved= true;
+ }
+
g_logger.info("stopping process...");
if (!stop_process(proc))
return false;
@@ -145,7 +147,7 @@ do_reset_proc(atrt_config& config, SqlRe
{
ndbout << "process has not changed" << endl;
}
-
+
g_logger.info("starting process...");
if (!start_process(proc))
return false;
=== added file 'storage/ndb/test/run-test/conf-upgrade.cnf'
--- a/storage/ndb/test/run-test/conf-upgrade.cnf 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/test/run-test/conf-upgrade.cnf 2008-12-12 08:04:28 +0000
@@ -0,0 +1,28 @@
+[atrt]
+basedir = CHOOSE_dir
+baseport = 14000
+clusters = .4node
+mysqld = CHOOSE_host1
+fix-nodeid=1
+
+[ndb_mgmd]
+
+[mysqld]
+skip-innodb
+loose-skip-bdb
+
+[cluster_config.4node]
+ndb_mgmd = CHOOSE_host1,CHOOSE_host1
+ndbd = CHOOSE_host2,CHOOSE_host3,CHOOSE_host2,CHOOSE_host3
+ndbapi= CHOOSE_host1,CHOOSE_host1,CHOOSE_host1
+
+NoOfReplicas = 2
+IndexMemory = 50M
+DataMemory = 100M
+BackupMemory = 64M
+MaxNoOfConcurrentScans = 100
+MaxNoOfSavedMessages= 1000
+SendBufferMemory = 2M
+NoOfFragmentLogFiles = 4
+FragmentLogFileSize = 64M
+
=== modified file 'storage/ndb/test/run-test/files.cpp'
--- a/storage/ndb/test/run-test/files.cpp 2008-11-03 12:33:34 +0000
+++ b/storage/ndb/test/run-test/files.cpp 2008-12-12 14:44:00 +0000
@@ -116,6 +116,11 @@ setup_files(atrt_config& config, int set
BaseString mycnf;
mycnf.assfmt("%s/my.cnf", g_basedir);
+ if (!create_directory(g_basedir))
+ {
+ return false;
+ }
+
if (mycnf != g_my_cnf)
{
struct stat sbuf;
=== modified file 'storage/ndb/test/run-test/main.cpp'
--- a/storage/ndb/test/run-test/main.cpp 2008-09-25 10:39:40 +0000
+++ b/storage/ndb/test/run-test/main.cpp 2008-12-12 14:44:00 +0000
@@ -258,15 +258,19 @@ main(int argc, char ** argv)
/**
* Main loop
*/
- while(!feof(g_test_case_file)){
+ while(!feof(g_test_case_file))
+ {
/**
* Do we need to restart ndb
*/
- if(restart){
+ if(restart)
+ {
+ restart = false;
g_logger.info("(Re)starting server processes...");
+
if(!stop_processes(g_config, ~0))
goto end;
-
+
if (!setup_directories(g_config, 2))
goto end;
@@ -280,7 +284,7 @@ main(int argc, char ** argv)
{
g_logger.info("Failed to start server processes");
g_logger.info("Gathering logs and saving them as test %u", test_no);
-
+
int tmp;
if(!gather_result(g_config, &tmp))
goto end;
@@ -331,31 +335,37 @@ main(int argc, char ** argv)
const time_t start = time(0);
time_t now = start;
- do {
+ do
+ {
if(!update_status(g_config, atrt_process::AP_ALL))
goto end;
-
- if(is_running(g_config, p_ndb) != 2){
+
+ if(is_running(g_config, p_ndb) != 2)
+ {
result = ERR_NDB_FAILED;
break;
}
-
- if(is_running(g_config, p_servers) != 2){
+
+ if(is_running(g_config, p_servers) != 2)
+ {
result = ERR_SERVERS_FAILED;
break;
}
- if(is_running(g_config, p_clients) == 0){
+ if(is_running(g_config, p_clients) == 0)
+ {
break;
}
- if (!do_command(g_config)){
+ if (!do_command(g_config))
+ {
result = ERR_COMMAND_FAILED;
break;
}
now = time(0);
- if(now > (start + test_case.m_max_time)){
+ if(now > (start + test_case.m_max_time))
+ {
result = ERR_MAX_TIME_ELAPSED;
break;
}
@@ -375,18 +385,20 @@ main(int argc, char ** argv)
test_no,
(result == 0 ? "OK" : "FAILED"), result);
- if(g_report_file != 0){
+ if(g_report_file != 0)
+ {
fprintf(g_report_file, "%s ; %d ; %d ; %ld\n",
test_case.m_name.c_str(), test_no, result, elapsed);
fflush(g_report_file);
}
- if(g_mode == 0 && result){
+ if(g_mode == 0 && result)
+ {
g_logger.info
("Encountered failed test in interactive mode - terminating");
break;
}
-
+
BaseString resdir;
resdir.assfmt("result.%d", test_no);
remove_dir(resdir.c_str(), true);
@@ -404,11 +416,15 @@ main(int argc, char ** argv)
{
remove_dir("result", true);
}
+
+ if (reset_config(g_config))
+ {
+ restart = true;
+ }
- if(result != 0){
+ if(result != 0)
+ {
restart = true;
- } else {
- restart = false;
}
test_no++;
}
@@ -870,7 +886,8 @@ next:
bool
start_process(atrt_process & proc){
if(proc.m_proc.m_id != -1){
- g_logger.critical("starting already started process: %d", proc.m_index);
+ g_logger.critical("starting already started process: %u",
+ (unsigned)proc.m_index);
return false;
}
@@ -1141,13 +1158,23 @@ setup_test_case(atrt_config& config, con
if(proc.m_type == atrt_process::AP_NDB_API ||
proc.m_type == atrt_process::AP_CLIENT)
{
- proc.m_proc.m_path = "";
+ BaseString cmd;
if (tc.m_command.c_str()[0] != '/')
{
- proc.m_proc.m_path.appfmt("%s/bin/", g_prefix);
+ cmd.appfmt("%s/bin/", g_prefix);
+ }
+ cmd.append(tc.m_command.c_str());
+
+ if (0) // valgrind
+ {
+ proc.m_proc.m_path = "/usr/bin/valgrind";
+ proc.m_proc.m_args.appfmt("%s %s", cmd.c_str(), tc.m_args.c_str());
+ }
+ else
+ {
+ proc.m_proc.m_path = cmd;
+ proc.m_proc.m_args.assign(tc.m_args);
}
- proc.m_proc.m_path.append(tc.m_command.c_str());
- proc.m_proc.m_args.assign(tc.m_args);
if(!tc.m_run_all)
break;
}
@@ -1222,28 +1249,38 @@ setup_hosts(atrt_config& config){
return true;
}
+static
+bool
+do_rsync(const char *dir, const char *dst)
+{
+ BaseString tmp = g_setup_progname;
+ tmp.appfmt(" %s %s/ %s", dst, dir, dir);
+
+ g_logger.info("rsyncing %s to %s", dir, dst);
+ g_logger.debug("system(%s)", tmp.c_str());
+ const int r1 = system(tmp.c_str());
+ if(r1 != 0)
+ {
+ g_logger.critical("Failed to rsync %s to %s", dir, dst);
+ return false;
+ }
+
+ return true;
+}
+
bool
deploy(atrt_config & config)
{
for (size_t i = 0; i<config.m_hosts.size(); i++)
{
- BaseString tmp = g_setup_progname;
- tmp.appfmt(" %s %s/ %s",
- config.m_hosts[i]->m_hostname.c_str(),
- g_prefix,
- g_prefix);
-
- g_logger.info("rsyncing %s to %s", g_prefix,
- config.m_hosts[i]->m_hostname.c_str());
- g_logger.debug("system(%s)", tmp.c_str());
- const int r1 = system(tmp.c_str());
- if(r1 != 0)
- {
- g_logger.critical("Failed to rsync %s to %s",
- g_prefix,
- config.m_hosts[i]->m_hostname.c_str());
+ if (!do_rsync(g_basedir, config.m_hosts[i]->m_hostname.c_str()))
+ return false;
+
+ if (!do_rsync(g_prefix, config.m_hosts[i]->m_hostname.c_str()))
+ return false;
+
+ if (g_prefix1 && !do_rsync(g_prefix1,
config.m_hosts[i]->m_hostname.c_str()))
return false;
- }
}
return true;
@@ -1342,6 +1379,27 @@ require(bool x)
abort();
}
+bool
+reset_config(atrt_config & config)
+{
+ bool changed = false;
+ for(size_t i = 0; i<config.m_processes.size(); i++)
+ {
+ atrt_process & proc = *config.m_processes[i];
+ if (proc.m_save.m_saved)
+ {
+ if (!stop_process(proc))
+ return false;
+
+ changed = true;
+ proc.m_save.m_saved = false;
+ proc.m_proc = proc.m_save.m_proc;
+ proc.m_proc.m_id = -1;
+ }
+ }
+ return changed;
+}
+
template class Vector<Vector<SimpleCpcClient::Process> >;
template class Vector<atrt_host*>;
template class Vector<atrt_cluster*>;
=== modified file 'storage/ndb/test/run-test/setup.cpp'
--- a/storage/ndb/test/run-test/setup.cpp 2008-12-05 09:58:51 +0000
+++ b/storage/ndb/test/run-test/setup.cpp 2008-12-12 14:44:00 +0000
@@ -52,14 +52,14 @@ bool
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"));
+ tmp.appfmt(",.atrt");
}
-
+ Vector<BaseString> clusters;
+ tmp.split(clusters, ",");
+
bool fqpn = clusters.size() > 1 || g_fqpn;
size_t j,k;
@@ -134,6 +134,7 @@ setup_config(atrt_config& config, const
proc_args[1].value = 0;
proc_args[2].value = 0;
proc_args[3].value = 0;
+ proc_args[4].value = atrt_mysqld;
}
/**
@@ -157,10 +158,11 @@ setup_config(atrt_config& config, const
/**
* Load cluster options
*/
-
- argc = 1;
+ int argc = 1;
+ const char * argv[] = { "atrt", 0, 0 };
argv[argc++] = buf.c_str();
const char *groups[] = { "mysql_cluster", 0 };
+ char ** tmp = (char**)argv;
ret = load_defaults(g_my_cnf, groups, &argc, &tmp);
if (ret)
@@ -204,7 +206,7 @@ load_process(atrt_config& config, atrt_c
{
atrt_host * host_ptr = find(hostname, config.m_hosts);
atrt_process *proc_ptr = new atrt_process;
-
+
config.m_processes.push_back(proc_ptr);
host_ptr->m_processes.push_back(proc_ptr);
cluster.m_processes.push_back(proc_ptr);
@@ -215,7 +217,11 @@ load_process(atrt_config& config, atrt_c
proc.m_index = idx;
proc.m_type = type;
proc.m_host = host_ptr;
- proc.m_nodeid= cluster.m_next_nodeid++;
+ proc.m_save.m_saved = false;
+ if (g_fix_nodeid)
+ proc.m_nodeid= cluster.m_next_nodeid++;
+ else
+ proc.m_nodeid= -1;
proc.m_cluster = &cluster;
proc.m_options.m_features = 0;
proc.m_rep_src = 0;
=== added file 'storage/ndb/test/run-test/upgrade-tests.txt'
--- a/storage/ndb/test/run-test/upgrade-tests.txt 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/test/run-test/upgrade-tests.txt 2008-12-12 08:56:22 +0000
@@ -0,0 +1,12 @@
+cmd: testUpgrade
+args: -n Upgrade_NR1 T1
+max-time: 600
+
+cmd: testUpgrade
+args: -n Upgrade_NR2 T1
+max-time: 600
+
+cmd: testUpgrade
+args: -n Upgrade_NR3 T1
+max-time: 600
+
=== modified file 'storage/ndb/test/src/DbUtil.cpp'
--- a/storage/ndb/test/src/DbUtil.cpp 2008-11-10 10:55:33 +0000
+++ b/storage/ndb/test/src/DbUtil.cpp 2008-12-12 14:14:52 +0000
@@ -360,7 +360,7 @@ DbUtil::runQuery(const char* sql,
MYSQL_BIND *bind_param = new MYSQL_BIND[params];
NdbAutoObjArrayPtr<MYSQL_BIND> _guard(bind_param);
- bzero(bind_param, sizeof(bind_param));
+ bzero(bind_param, params * sizeof(MYSQL_BIND));
for(uint i= 0; i < mysql_stmt_param_count(stmt); i++)
{
@@ -431,7 +431,7 @@ DbUtil::runQuery(const char* sql,
uint num_fields= mysql_num_fields(res);
MYSQL_BIND *bind_result = new MYSQL_BIND[num_fields];
NdbAutoObjArrayPtr<MYSQL_BIND> _guard1(bind_result);
- bzero(bind_result, sizeof(bind_result));
+ bzero(bind_result, num_fields * sizeof(MYSQL_BIND));
for (uint i= 0; i < num_fields; i++)
{
@@ -439,6 +439,8 @@ DbUtil::runQuery(const char* sql,
switch(fields[i].type){
case MYSQL_TYPE_STRING:
+ buf_len = fields[i].length + 1;
+ break;
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
buf_len= fields[i].max_length + 1;
@@ -446,14 +448,18 @@ DbUtil::runQuery(const char* sql,
case MYSQL_TYPE_LONGLONG:
buf_len= sizeof(long long);
break;
+ case MYSQL_TYPE_LONG:
+ buf_len = sizeof(long);
+ break;
default:
break;
}
-
+
bind_result[i].buffer_type= fields[i].type;
bind_result[i].buffer= malloc(buf_len);
bind_result[i].buffer_length= buf_len;
-
+ bind_result[i].is_null = (my_bool*)malloc(sizeof(my_bool));
+ * bind_result[i].is_null = 0;
}
if (mysql_stmt_bind_result(stmt, bind_result)){
@@ -466,8 +472,11 @@ DbUtil::runQuery(const char* sql,
{
Properties curr(true);
for (uint i= 0; i < num_fields; i++){
+ if (* bind_result[i].is_null)
+ continue;
switch(fields[i].type){
case MYSQL_TYPE_STRING:
+ ((char*)bind_result[i].buffer)[fields[i].max_length] = 0;
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
curr.put(fields[i].name, (char*)bind_result[i].buffer);
@@ -481,7 +490,7 @@ DbUtil::runQuery(const char* sql,
default:
curr.put(fields[i].name, *(int*)bind_result[i].buffer);
break;
- }
+ }
}
rows.put("row", row++, &curr);
}
@@ -489,8 +498,10 @@ DbUtil::runQuery(const char* sql,
mysql_free_result(res);
for (uint i= 0; i < num_fields; i++)
+ {
free(bind_result[i].buffer);
-
+ free(bind_result[i].is_null);
+ }
}
// Save stats in result set
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (jonas:3173) | Jonas Oreland | 12 Dec |