Upgrade Tests: Addressing review comments
This commit is contained in:
parent
9e46128b6f
commit
f7636ecf3b
|
@ -42,7 +42,7 @@ public:
|
||||||
virtual void checkProgress() override;
|
virtual void checkProgress() override;
|
||||||
|
|
||||||
// Running specific tests
|
// Running specific tests
|
||||||
// The default implementation generates a workload constisting of
|
// The default implementation generates a workload consisting of
|
||||||
// random operations generated by randomOperation
|
// random operations generated by randomOperation
|
||||||
virtual void runTests();
|
virtual void runTests();
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ protected:
|
||||||
int numRandomOperations;
|
int numRandomOperations;
|
||||||
|
|
||||||
// The number of transactions to be completed for
|
// The number of transactions to be completed for
|
||||||
// a successfull test progress check
|
// a successful test progress check
|
||||||
int numOperationsForProgressCheck;
|
int numOperationsForProgressCheck;
|
||||||
|
|
||||||
// Stop command received (for runUntilStop=true)
|
// Stop command received (for runUntilStop=true)
|
||||||
|
@ -93,9 +93,6 @@ protected:
|
||||||
// Number of random operations left (for runUntilStop=false)
|
// Number of random operations left (for runUntilStop=false)
|
||||||
std::atomic<int> numRandomOpLeft;
|
std::atomic<int> numRandomOpLeft;
|
||||||
|
|
||||||
// Number of random operations left (for runUntilStop=false)
|
|
||||||
int numProgresCheckOpLeft;
|
|
||||||
|
|
||||||
// Key prefix
|
// Key prefix
|
||||||
std::string keyPrefix;
|
std::string keyPrefix;
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
std::string logGroup;
|
std::string logGroup;
|
||||||
std::string externalClientLibrary;
|
std::string externalClientLibrary;
|
||||||
std::string externalClientDir;
|
std::string externalClientDir;
|
||||||
|
bool disableLocalClient = false;
|
||||||
std::string testFile;
|
std::string testFile;
|
||||||
std::string inputPipeName;
|
std::string inputPipeName;
|
||||||
std::string outputPipeName;
|
std::string outputPipeName;
|
||||||
|
|
|
@ -221,8 +221,8 @@ protected:
|
||||||
err = f.getError();
|
err = f.getError();
|
||||||
auto waitTimeUs = timeElapsedInUs(start);
|
auto waitTimeUs = timeElapsedInUs(start);
|
||||||
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
||||||
fmt::print("Long waiting time on a future: {}us, return code {} ({}), commit called: {}\n",
|
fmt::print("Long waiting time on a future: {:.3f}s, return code {} ({}), commit called: {}\n",
|
||||||
waitTimeUs,
|
microsecToSec(waitTimeUs),
|
||||||
err,
|
err,
|
||||||
fdb_get_error(err),
|
fdb_get_error(err),
|
||||||
commitCalled);
|
commitCalled);
|
||||||
|
@ -259,9 +259,9 @@ protected:
|
||||||
auto waitTimeUs = timeElapsedInUs(start);
|
auto waitTimeUs = timeElapsedInUs(start);
|
||||||
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
||||||
fdb_error_t err3 = onErrorFuture.getError();
|
fdb_error_t err3 = onErrorFuture.getError();
|
||||||
fmt::print("Long waiting time on onError({}) future: {}us, return code {} ({})\n",
|
fmt::print("Long waiting time on onError({}) future: {:.3f}s, return code {} ({})\n",
|
||||||
err,
|
err,
|
||||||
waitTimeUs,
|
microsecToSec(waitTimeUs),
|
||||||
err3,
|
err3,
|
||||||
fdb_get_error(err3));
|
fdb_get_error(err3));
|
||||||
}
|
}
|
||||||
|
@ -321,8 +321,10 @@ protected:
|
||||||
fdb_error_t err = fdb_future_get_error(f);
|
fdb_error_t err = fdb_future_get_error(f);
|
||||||
auto waitTimeUs = timeElapsedInUs(cbInfo.startTime, endTime);
|
auto waitTimeUs = timeElapsedInUs(cbInfo.startTime, endTime);
|
||||||
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
||||||
fmt::print(
|
fmt::print("Long waiting time on a future: {:.3f}s, return code {} ({})\n",
|
||||||
"Long waiting time on a future: {}us, return code {} ({})\n", waitTimeUs, err, fdb_get_error(err));
|
microsecToSec(waitTimeUs),
|
||||||
|
err,
|
||||||
|
fdb_get_error(err));
|
||||||
}
|
}
|
||||||
if (err == error_code_transaction_cancelled) {
|
if (err == error_code_transaction_cancelled) {
|
||||||
return;
|
return;
|
||||||
|
@ -364,9 +366,9 @@ protected:
|
||||||
auto waitTimeUs = timeElapsedInUs(onErrorCallTimePoint);
|
auto waitTimeUs = timeElapsedInUs(onErrorCallTimePoint);
|
||||||
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
if (waitTimeUs > LONG_WAIT_TIME_US) {
|
||||||
fdb_error_t err = onErrorFuture.getError();
|
fdb_error_t err = onErrorFuture.getError();
|
||||||
fmt::print("Long waiting time on onError({}): {}us, return code {} ({})\n",
|
fmt::print("Long waiting time on onError({}): {:.3f}s, return code {} ({})\n",
|
||||||
onErrorArg,
|
onErrorArg,
|
||||||
waitTimeUs,
|
microsecToSec(waitTimeUs),
|
||||||
err,
|
err,
|
||||||
fdb_get_error(err));
|
fdb_get_error(err));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
namespace FdbApiTester {
|
namespace FdbApiTester {
|
||||||
|
|
||||||
std::string lower_case(const std::string& str) {
|
std::string lowerCase(const std::string& str) {
|
||||||
std::string res = str;
|
std::string res = str;
|
||||||
std::transform(res.begin(), res.end(), res.begin(), ::tolower);
|
std::transform(res.begin(), res.end(), res.begin(), ::tolower);
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct formatter<std::optional<T>> : fmt::formatter<T> {
|
||||||
|
|
||||||
namespace FdbApiTester {
|
namespace FdbApiTester {
|
||||||
|
|
||||||
std::string lower_case(const std::string& str);
|
std::string lowerCase(const std::string& str);
|
||||||
|
|
||||||
class Random {
|
class Random {
|
||||||
public:
|
public:
|
||||||
|
@ -101,6 +101,10 @@ static inline TimeDuration timeElapsedInUs(const TimePoint& start) {
|
||||||
return timeElapsedInUs(start, timeNow());
|
return timeElapsedInUs(start, timeNow());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline double microsecToSec(TimeDuration timeUs) {
|
||||||
|
return timeUs / 1000000.0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace FdbApiTester
|
} // namespace FdbApiTester
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -66,7 +66,7 @@ bool WorkloadConfig::getBoolOption(const std::string& name, bool defaultVal) con
|
||||||
if (iter == options.end()) {
|
if (iter == options.end()) {
|
||||||
return defaultVal;
|
return defaultVal;
|
||||||
} else {
|
} else {
|
||||||
std::string val = lower_case(iter->second);
|
std::string val = lowerCase(iter->second);
|
||||||
if (val == "true") {
|
if (val == "true") {
|
||||||
return true;
|
return true;
|
||||||
} else if (val == "false") {
|
} else if (val == "false") {
|
||||||
|
@ -280,7 +280,7 @@ void WorkloadManager::confirmProgress(IWorkload* workload) {
|
||||||
}
|
}
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
if (allConfirmed) {
|
if (allConfirmed) {
|
||||||
// Notify the test controller about the successfull progress check
|
// Notify the test controller about the successful progress check
|
||||||
ASSERT(outputPipe.is_open());
|
ASSERT(outputPipe.is_open());
|
||||||
outputPipe << "CHECK_OK" << std::endl;
|
outputPipe << "CHECK_OK" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
// Stop the workload
|
// Stop the workload
|
||||||
virtual void stop() = 0;
|
virtual void stop() = 0;
|
||||||
|
|
||||||
// Check and if the test is progressing from the point of calling
|
// Check if the test is progressing from the point of calling
|
||||||
// Progress must be confirmed by calling confirmProgress on the workload manager
|
// Progress must be confirmed by calling confirmProgress on the workload manager
|
||||||
virtual void checkProgress() = 0;
|
virtual void checkProgress() = 0;
|
||||||
};
|
};
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
WorkloadManager(ITransactionExecutor* txExecutor, IScheduler* scheduler)
|
WorkloadManager(ITransactionExecutor* txExecutor, IScheduler* scheduler)
|
||||||
: txExecutor(txExecutor), scheduler(scheduler), numWorkloadsFailed(0) {}
|
: txExecutor(txExecutor), scheduler(scheduler), numWorkloadsFailed(0) {}
|
||||||
|
|
||||||
// Open names pipes for communication with the test controller
|
// Open named pipes for communication with the test controller
|
||||||
void openControlPipes(const std::string& inputPipeName, const std::string& outputPipeName);
|
void openControlPipes(const std::string& inputPipeName, const std::string& outputPipeName);
|
||||||
|
|
||||||
// Add a workload
|
// Add a workload
|
||||||
|
@ -193,10 +193,10 @@ private:
|
||||||
// To be called by a workload to notify that it is done
|
// To be called by a workload to notify that it is done
|
||||||
void workloadDone(IWorkload* workload, bool failed);
|
void workloadDone(IWorkload* workload, bool failed);
|
||||||
|
|
||||||
// To be called by a workload to confirm a successfull progress check
|
// To be called by a workload to confirm a successful progress check
|
||||||
void confirmProgress(IWorkload* workload);
|
void confirmProgress(IWorkload* workload);
|
||||||
|
|
||||||
// Receive and handing control commands from the input pipe
|
// Receive and handle control commands from the input pipe
|
||||||
void readControlInput(std::string pipeName);
|
void readControlInput(std::string pipeName);
|
||||||
|
|
||||||
// Handle STOP command received from the test controller
|
// Handle STOP command received from the test controller
|
||||||
|
@ -223,7 +223,7 @@ private:
|
||||||
// Thread for receiving test control commands
|
// Thread for receiving test control commands
|
||||||
std::thread ctrlInputThread;
|
std::thread ctrlInputThread;
|
||||||
|
|
||||||
// Output pipe for emmitting test control events
|
// Output pipe for emitting test control events
|
||||||
std::ofstream outputPipe;
|
std::ofstream outputPipe;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ enum TesterOptionId {
|
||||||
OPT_KNOB,
|
OPT_KNOB,
|
||||||
OPT_EXTERNAL_CLIENT_LIBRARY,
|
OPT_EXTERNAL_CLIENT_LIBRARY,
|
||||||
OPT_EXTERNAL_CLIENT_DIRECTORY,
|
OPT_EXTERNAL_CLIENT_DIRECTORY,
|
||||||
|
OPT_DISABLE_LOCAL_CLIENT,
|
||||||
OPT_TEST_FILE,
|
OPT_TEST_FILE,
|
||||||
OPT_INPUT_PIPE,
|
OPT_INPUT_PIPE,
|
||||||
OPT_OUTPUT_PIPE,
|
OPT_OUTPUT_PIPE,
|
||||||
|
@ -64,6 +65,7 @@ CSimpleOpt::SOption TesterOptionDefs[] = //
|
||||||
{ OPT_KNOB, "--knob-", SO_REQ_SEP },
|
{ OPT_KNOB, "--knob-", SO_REQ_SEP },
|
||||||
{ OPT_EXTERNAL_CLIENT_LIBRARY, "--external-client-library", SO_REQ_SEP },
|
{ OPT_EXTERNAL_CLIENT_LIBRARY, "--external-client-library", SO_REQ_SEP },
|
||||||
{ OPT_EXTERNAL_CLIENT_DIRECTORY, "--external-client-dir", SO_REQ_SEP },
|
{ OPT_EXTERNAL_CLIENT_DIRECTORY, "--external-client-dir", SO_REQ_SEP },
|
||||||
|
{ OPT_DISABLE_LOCAL_CLIENT, "--disable-local-client", SO_NONE },
|
||||||
{ OPT_TEST_FILE, "-f", SO_REQ_SEP },
|
{ OPT_TEST_FILE, "-f", SO_REQ_SEP },
|
||||||
{ OPT_TEST_FILE, "--test-file", SO_REQ_SEP },
|
{ OPT_TEST_FILE, "--test-file", SO_REQ_SEP },
|
||||||
{ OPT_INPUT_PIPE, "--input-pipe", SO_REQ_SEP },
|
{ OPT_INPUT_PIPE, "--input-pipe", SO_REQ_SEP },
|
||||||
|
@ -94,6 +96,8 @@ void printProgramUsage(const char* execName) {
|
||||||
" Path to the external client library.\n"
|
" Path to the external client library.\n"
|
||||||
" --external-client-dir DIR\n"
|
" --external-client-dir DIR\n"
|
||||||
" Directory containing external client libraries.\n"
|
" Directory containing external client libraries.\n"
|
||||||
|
" --disable-local-client DIR\n"
|
||||||
|
" Disable the local client, i.e. use only external client libraries.\n"
|
||||||
" --input-pipe NAME\n"
|
" --input-pipe NAME\n"
|
||||||
" Name of the input pipe for communication with the test controller.\n"
|
" Name of the input pipe for communication with the test controller.\n"
|
||||||
" --output-pipe NAME\n"
|
" --output-pipe NAME\n"
|
||||||
|
@ -173,6 +177,9 @@ bool processArg(TesterOptions& options, const CSimpleOpt& args) {
|
||||||
case OPT_EXTERNAL_CLIENT_DIRECTORY:
|
case OPT_EXTERNAL_CLIENT_DIRECTORY:
|
||||||
options.externalClientDir = args.OptionArg();
|
options.externalClientDir = args.OptionArg();
|
||||||
break;
|
break;
|
||||||
|
case OPT_DISABLE_LOCAL_CLIENT:
|
||||||
|
options.disableLocalClient = true;
|
||||||
|
break;
|
||||||
case OPT_TEST_FILE:
|
case OPT_TEST_FILE:
|
||||||
options.testFile = args.OptionArg();
|
options.testFile = args.OptionArg();
|
||||||
options.testSpec = readTomlTestSpec(options.testFile);
|
options.testSpec = readTomlTestSpec(options.testFile);
|
||||||
|
@ -227,9 +234,15 @@ void applyNetworkOptions(TesterOptions& options) {
|
||||||
fdb_check(
|
fdb_check(
|
||||||
FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_EXTERNAL_CLIENT_LIBRARY, options.externalClientLibrary));
|
FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_EXTERNAL_CLIENT_LIBRARY, options.externalClientLibrary));
|
||||||
} else if (!options.externalClientDir.empty()) {
|
} else if (!options.externalClientDir.empty()) {
|
||||||
fdb_check(FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_DISABLE_LOCAL_CLIENT));
|
if (options.disableLocalClient) {
|
||||||
|
fdb_check(FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_DISABLE_LOCAL_CLIENT));
|
||||||
|
}
|
||||||
fdb_check(
|
fdb_check(
|
||||||
FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_EXTERNAL_CLIENT_DIRECTORY, options.externalClientDir));
|
FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_EXTERNAL_CLIENT_DIRECTORY, options.externalClientDir));
|
||||||
|
} else {
|
||||||
|
if (options.disableLocalClient) {
|
||||||
|
throw TesterError("Invalid options: Cannot disable local client if no external library is provided");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.testSpec.multiThreaded) {
|
if (options.testSpec.multiThreaded) {
|
||||||
|
|
|
@ -15,21 +15,21 @@ maxClients = 8
|
||||||
[[test.workload]]
|
[[test.workload]]
|
||||||
name = 'ApiCorrectness'
|
name = 'ApiCorrectness'
|
||||||
minKeyLength = 1
|
minKeyLength = 1
|
||||||
maxKeyLength = 64
|
maxKeyLength = 64
|
||||||
minValueLength = 1
|
minValueLength = 1
|
||||||
maxValueLength = 1000
|
maxValueLength = 1000
|
||||||
maxKeysPerTransaction = 50
|
maxKeysPerTransaction = 50
|
||||||
initialSize = 100
|
initialSize = 100
|
||||||
runUntilStop = true
|
runUntilStop = true
|
||||||
readExistingKeysRatio = 0.9
|
readExistingKeysRatio = 0.9
|
||||||
|
|
||||||
[[test.workload]]
|
[[test.workload]]
|
||||||
name = 'CancelTransaction'
|
name = 'CancelTransaction'
|
||||||
minKeyLength = 1
|
minKeyLength = 1
|
||||||
maxKeyLength = 64
|
maxKeyLength = 64
|
||||||
minValueLength = 1
|
minValueLength = 1
|
||||||
maxValueLength = 1000
|
maxValueLength = 1000
|
||||||
maxKeysPerTransaction = 50
|
maxKeysPerTransaction = 50
|
||||||
initialSize = 100
|
initialSize = 100
|
||||||
runUntilStop = true
|
runUntilStop = true
|
||||||
readExistingKeysRatio = 0.9
|
readExistingKeysRatio = 0.9
|
|
@ -13,21 +13,21 @@ maxClients = 8
|
||||||
[[test.workload]]
|
[[test.workload]]
|
||||||
name = 'ApiCorrectness'
|
name = 'ApiCorrectness'
|
||||||
minKeyLength = 1
|
minKeyLength = 1
|
||||||
maxKeyLength = 64
|
maxKeyLength = 64
|
||||||
minValueLength = 1
|
minValueLength = 1
|
||||||
maxValueLength = 1000
|
maxValueLength = 1000
|
||||||
maxKeysPerTransaction = 50
|
maxKeysPerTransaction = 50
|
||||||
initialSize = 100
|
initialSize = 100
|
||||||
runUntilStop = true
|
runUntilStop = true
|
||||||
readExistingKeysRatio = 0.9
|
readExistingKeysRatio = 0.9
|
||||||
|
|
||||||
[[test.workload]]
|
[[test.workload]]
|
||||||
name = 'CancelTransaction'
|
name = 'CancelTransaction'
|
||||||
minKeyLength = 1
|
minKeyLength = 1
|
||||||
maxKeyLength = 64
|
maxKeyLength = 64
|
||||||
minValueLength = 1
|
minValueLength = 1
|
||||||
maxValueLength = 1000
|
maxValueLength = 1000
|
||||||
maxKeysPerTransaction = 50
|
maxKeysPerTransaction = 50
|
||||||
initialSize = 100
|
initialSize = 100
|
||||||
runUntilStop = true
|
runUntilStop = true
|
||||||
readExistingKeysRatio = 0.9
|
readExistingKeysRatio = 0.9
|
|
@ -238,6 +238,7 @@ class UpgradeTest:
|
||||||
'--cluster-file', self.cluster.cluster_file,
|
'--cluster-file', self.cluster.cluster_file,
|
||||||
'--test-file', test_file,
|
'--test-file', test_file,
|
||||||
'--external-client-dir', self.external_lib_dir,
|
'--external-client-dir', self.external_lib_dir,
|
||||||
|
'--disable-local-client',
|
||||||
'--input-pipe', self.input_pipe_path,
|
'--input-pipe', self.input_pipe_path,
|
||||||
'--output-pipe', self.output_pipe_path,
|
'--output-pipe', self.output_pipe_path,
|
||||||
'--api-version', str(self.api_version),
|
'--api-version', str(self.api_version),
|
||||||
|
|
Loading…
Reference in New Issue