Skip to content

Commit 64f6c78

Browse files
committed
Bug#34685358 (3/3) Integrate crund build in our cmake files
This patch contains the new test driver runCrund. Now it is possible to: * Use mtr --start-and-test crund to start a CRUND environment * Use runCrund, which by default will run ndbjtieAB and clusterjAB. * runCrund takes a list of properties and options on the command line which are passed to the C++ and Java crund utilities; for example: bin/runCrund nRuns=3 loads=NdbapiAB,NdbjtieAB,ClusterjAB bin/runCrund --show-properties * After running the benchmark, if the property nRuns >= 3, runCrund will run the ResultProcessor to create a summarized CSV file, and then load this into the results table in the crunddb database. nRuns must be 3 or greater because the ResultProcessor treats the first two runs as warm-up runs and discards them. It should generally be possible to open the result CSV file in a spreadsheet application. Miscellaneous changes in this patch include: * Remove the B_clearA operation from the crund AB workload. This was legal in NDB 6.x, but is no longer a legal operation due to the foreign key constraint violation. * Add a missing main() method to the S workloads in Java. * Change some shadowed names that trigger compiler warnings. * Add a --show-properties option to the crund programs. Change-Id: I675ec2673dc9b9ced666488a7feff4a7e62a89ad
1 parent db7c969 commit 64f6c78

File tree

15 files changed

+471
-47
lines changed

15 files changed

+471
-47
lines changed

storage/ndb/test/crund/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/helpers)
2626
#
2727
## runCrund
2828
###
29-
# NDB_ADD_EXECUTABLE(runCrund runCrund.cpp NDBCLIENT)
30-
# TARGET_COMPILE_DEFINITIONS(runCrund PRIVATE
31-
# CMAKE_BINARY_DIR=\"${CMAKE_BINARY_DIR}\"
32-
# WITH_CLASSPATH=\"${WITH_CLASSPATH}\"
33-
# )
29+
NDB_ADD_EXECUTABLE(runCrund runCrund.cpp NDBCLIENT)
30+
TARGET_COMPILE_DEFINITIONS(runCrund PRIVATE
31+
CMAKE_BINARY_DIR=\"${CMAKE_BINARY_DIR}\"
32+
WITH_CLASSPATH=\"${WITH_CLASSPATH}\"
33+
)
3434

3535
#
3636
## C++ Crund Helpers

storage/ndb/test/crund/cpp/Driver.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,14 @@ void Driver::init() {
123123
loadProperties();
124124
initProperties();
125125
printProperties();
126-
if (showPropsAndExit) return;
126+
if (showPropsAndExit) exit(1);
127127

128128
openLogFile();
129129
clearLogBuffers();
130130
initLoads();
131131
}
132132

133133
void Driver::close() {
134-
if (showPropsAndExit) return;
135134
closeLoads();
136135
clearLogBuffers();
137136
closeLogFile();
@@ -259,8 +258,6 @@ void Driver::addLoads() {
259258

260259
void Driver::runLoads() {
261260
if (hasIgnoredSettings) {
262-
if (showPropsAndExit) return;
263-
264261
cout << endl
265262
<< "++++++++++++ SOME SETTINGS IGNORED, SEE ABOVE ++++++++++++"
266263
<< endl;

storage/ndb/test/crund/cpp/unused-tws/NdbapiTwsDriver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ void NdbapiTwsDriver::initConnection() {
707707
cout << "creating cluster connection ..." << flush;
708708
assert(!mgmdConnect.empty());
709709
mgmd = new Ndb_cluster_connection(mgmdConnect.c_str());
710-
mgmd->configure_tls(opt_tls_search_path, opt_mgm_tls);
710+
// mgmd->configure_tls(opt_tls_search_path, opt_mgm_tls);
711711
cout << " [ok: mgmd@" << mgmdConnect << "]" << endl;
712712

713713
// connect to cluster management node (ndb_mgmd)

storage/ndb/test/crund/cpp/unused-tws/TwsDriver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void TwsDriver::runTests() {
146146

147147
assert(nOpsStart <= nOpsEnd && nOpsScale > 1);
148148
for (int i = nOpsStart; i <= nOpsEnd; i *= nOpsScale) {
149-
runLoads(i);
149+
runLoads_(i);
150150
}
151151

152152
cout << endl
@@ -157,7 +157,7 @@ void TwsDriver::runTests() {
157157
closeConnection();
158158
}
159159

160-
void TwsDriver::runLoads(int nOps) {
160+
void TwsDriver::runLoads_(int nOps) {
161161
cout << endl
162162
<< "------------------------------------------------------------"
163163
<< endl;

storage/ndb/test/crund/cpp/unused-tws/TwsDriver.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class TwsDriver : public Driver {
3737
static const char *toStr(XMode mode);
3838
bool renewConnection;
3939
bool renewOperations;
40-
bool logSumOfOps;
4140
LockMode lockMode;
4241
int nOpsStart;
4342
int nOpsEnd;
@@ -59,7 +58,7 @@ class TwsDriver : public Driver {
5958
virtual void initOperations() = 0;
6059
virtual void closeOperations() = 0;
6160
virtual void runTests();
62-
virtual void runLoads(int nOps);
61+
virtual void runLoads_(int nOps);
6362
virtual void runOperations(int nOps);
6463
virtual void runInserts(XMode mode, int nOps) = 0;
6564
virtual void runLookups(XMode mode, int nOps) = 0;

storage/ndb/test/crund/helpers/hrt_stopwatch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ extern "C" {
4545
*/
4646
typedef struct hrt_stopwatch {
4747
hrt_tstamp *tstamps;
48-
unsigned int top;
49-
unsigned int cap;
48+
int top;
49+
int cap;
5050
} hrt_stopwatch;
5151

5252
/*

storage/ndb/test/crund/helpers/hrt_utils.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*
3030
*/
3131

32+
#include "ndb_config.h"
33+
3234
#ifndef _utils_hrt_utils
3335
#define _utils_hrt_utils
3436
#ifdef __cplusplus
@@ -192,7 +194,7 @@ extern "C" {
192194
#error "unsupported HRT_REALTIME_METHOD: " HRT_REALTIME_METHOD
193195
#endif
194196
#else
195-
#if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS + 0 >= 0))
197+
#if HAVE_CLOCK_GETTIME
196198
#define HRT_REALTIME_METHOD HRT_USE_CLOCK_GETTIME
197199
#else
198200
#define HRT_REALTIME_METHOD HRT_USE_GETTIMEOFDAY
@@ -206,8 +208,7 @@ extern "C" {
206208
#error "unsupported HRT_CPUTIME_METHOD: " HRT_CPUTIME_METHOD
207209
#endif
208210
#else
209-
#if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS + 0 >= 0) && \
210-
defined(_POSIX_CPUTIME) && (_POSIX_CPUTIME + 0 >= 0))
211+
#if HAVE_CLOCK_GETTIME
211212
#define HRT_CPUTIME_METHOD HRT_USE_CLOCK_GETTIME
212213
#else
213214
#define HRT_CPUTIME_METHOD HRT_USE_GETRUSAGE

storage/ndb/test/crund/java/ClusterjAB.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -614,17 +614,6 @@ protected void check(int id, IB o) {
614614
}
615615
});
616616

617-
ops.add(
618-
new WriteOp("B_clearA", xMode) {
619-
protected void write(int id) {
620-
// blind update
621-
final IB o = session.newInstance(IB.class);
622-
o.setId(id);
623-
final int aId = -1;
624-
o.setAid(aId);
625-
session.updatePersistent(o);
626-
}
627-
});
628617

629618
ops.add(
630619
new WriteOp("B_del", xMode) {

storage/ndb/test/crund/java/ClusterjS.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ public ClusterjS(CrundDriver driver) {
4949
super(driver);
5050
}
5151

52+
static public void main(String[] args) {
53+
System.out.println("ClusterjS.main()");
54+
CrundDriver.parseArguments(args);
55+
final CrundDriver driver = new CrundDriver();
56+
final CrundSLoad load = new ClusterjS(driver);
57+
driver.run();
58+
System.out.println();
59+
System.out.println("ClusterjS.main(): done.");
60+
}
61+
5262
// ----------------------------------------------------------------------
5363
// ClusterJ intializers/finalizers
5464
// ----------------------------------------------------------------------

storage/ndb/test/crund/java/Driver.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public abstract class Driver {
6464
// driver command-line arguments
6565
static private final List<String> propFileNames = new ArrayList<String>();
6666
static private String logFileName;
67+
static protected boolean showPropsAndExit = false;
6768

6869
// driver settings
6970
protected final Properties props = new Properties();
@@ -99,6 +100,7 @@ static protected void exitUsage() {
99100
out.println(" [-p <file name>]... properties file name");
100101
out.println(" [-l <file name>] log file name for results");
101102
out.println(" [-h|--help] print usage message and exit");
103+
out.println(" [--show-properties] display properties and exit");
102104
out.println();
103105
System.exit(1); // return an error code
104106
}
@@ -121,6 +123,8 @@ static public void parseArguments(String[] args) {
121123
logFileName = args[++i];
122124
} else if (arg.equals("-h") || arg.equals("--help")) {
123125
exitUsage();
126+
} else if (arg.equals("--show-properties")) {
127+
showPropsAndExit = true;
124128
} else {
125129
out.println("unknown option: " + arg);
126130
exitUsage();
@@ -191,6 +195,8 @@ protected void init() throws Exception {
191195
loadProperties();
192196
initProperties();
193197
printProperties();
198+
if(showPropsAndExit) System.exit(1);
199+
194200
writeProperties();
195201
openLogFile();
196202
clearLogBuffers();

0 commit comments

Comments
 (0)