Added options to test config that specify maxtlogversion and array of excluded storage engine types
This commit is contained in:
parent
2f61bf3c42
commit
2a64c227fb
|
@ -21,6 +21,7 @@
|
|||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include "fdbrpc/Locality.h"
|
||||
#include "fdbrpc/simulator.h"
|
||||
#include "fdbclient/DatabaseContext.h"
|
||||
|
@ -874,7 +875,9 @@ void SimulationConfig::set_config(std::string config) {
|
|||
StringRef StringRefOf(const char* s) {
|
||||
return StringRef((uint8_t*)s, strlen(s));
|
||||
}
|
||||
|
||||
// Generates and sets an appropriate configuration for the database according to
|
||||
// the provided testConfig. Some attributes are randomly generated for more coverage
|
||||
// of different combinations
|
||||
void SimulationConfig::generateNormalConfig(const TestConfig& testConfig) {
|
||||
set_config("new");
|
||||
const bool simple = false; // Set true to simplify simulation configs for easier debugging
|
||||
|
@ -897,7 +900,9 @@ void SimulationConfig::generateNormalConfig(const TestConfig& testConfig) {
|
|||
db.resolverCount = deterministicRandom()->randomInt(1, 7);
|
||||
int storage_engine_type = deterministicRandom()->randomInt(0, 4);
|
||||
// Continuously re-pick the storage engine type if it's the one we want to exclude
|
||||
while (storage_engine_type == testConfig.storageEngineExcludeType) {
|
||||
while (std::find(testConfig.storageEngineExcludeTypes.begin(),
|
||||
testConfig.storageEngineExcludeTypes.end(),
|
||||
storage_engine_type) != testConfig.storageEngineExcludeTypes.end()) {
|
||||
storage_engine_type = deterministicRandom()->randomInt(0, 4);
|
||||
}
|
||||
switch (storage_engine_type) {
|
||||
|
@ -989,11 +994,11 @@ void SimulationConfig::generateNormalConfig(const TestConfig& testConfig) {
|
|||
if (deterministicRandom()->random01() < 0.5) {
|
||||
int logSpill = deterministicRandom()->randomInt(TLogSpillType::VALUE, TLogSpillType::END);
|
||||
set_config(format("log_spill:=%d", logSpill));
|
||||
int logVersion = deterministicRandom()->randomInt(TLogVersion::MIN_RECRUITABLE, TLogVersion::MAX_SUPPORTED + 1);
|
||||
int logVersion = deterministicRandom()->randomInt(TLogVersion::MIN_RECRUITABLE, testConfig.maxTLogVersion + 1);
|
||||
set_config(format("log_version:=%d", logVersion));
|
||||
} else {
|
||||
if (deterministicRandom()->random01() < 0.7)
|
||||
set_config(format("log_version:=%d", TLogVersion::MAX_SUPPORTED));
|
||||
set_config(format("log_version:=%d", testConfig.maxTLogVersion));
|
||||
if (deterministicRandom()->random01() < 0.5)
|
||||
set_config(format("log_spill:=%d", TLogSpillType::DEFAULT));
|
||||
}
|
||||
|
@ -1663,8 +1668,17 @@ void checkTestConf(const char* testFile, TestConfig* testConfig) {
|
|||
sscanf(value.c_str(), "%d", &testConfig->logAntiQuorum);
|
||||
}
|
||||
|
||||
if (attrib == "storageEngineExcludeType") {
|
||||
sscanf(value.c_str(), "%d", &testConfig->storageEngineExcludeType);
|
||||
if (attrib == "storageEngineExcludeTypes") {
|
||||
std::stringstream ss(value);
|
||||
for (int i; ss >> i;) {
|
||||
testConfig->storageEngineExcludeTypes.push_back(i);
|
||||
if (ss.peek() == ',') {
|
||||
ss.ignore();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (attrib == "maxTLogVersion") {
|
||||
sscanf(value.c_str(), "%d", &testConfig->maxTLogVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,12 +109,15 @@ struct TestConfig {
|
|||
bool startIncompatibleProcess = false;
|
||||
int logAntiQuorum = -1;
|
||||
// Storage Engine Types: Verify match with SimulationConfig::generateNormalConfig
|
||||
// -1 = None
|
||||
// 0 = "ssd"
|
||||
// 1 = "memory"
|
||||
// 2 = "memory-radixtree-beta"
|
||||
// 3 = "ssd-redwood-experimental"
|
||||
int storageEngineExcludeType = -1;
|
||||
// Requires a comma-separated list of numbers WITHOUT whitespaces
|
||||
std::vector<int> storageEngineExcludeTypes;
|
||||
// Set the maximum TLog version that can be selected for a test
|
||||
// Refer to FDBTypes.h::TLogVersion. Defaults to the maximum supported version.
|
||||
int maxTLogVersion = TLogVersion::MAX_SUPPORTED;
|
||||
};
|
||||
|
||||
struct TesterInterface {
|
||||
|
|
|
@ -1036,8 +1036,10 @@ std::map<std::string, std::function<void(const std::string&)>> testSpecGlobalKey
|
|||
} },
|
||||
{ "startIncompatibleProcess",
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedStartIncompatibleProcess", value); } },
|
||||
{ "storageEngineExcludeType",
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedStorageEngineExcludeType", ""); } }
|
||||
{ "storageEngineExcludeTypes",
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedStorageEngineExcludeTypes", ""); } },
|
||||
{ "maxTLogVersion",
|
||||
[](const std::string& value) { TraceEvent("TestParserTest").detail("ParsedMaxTLogVersion", ""); } }
|
||||
};
|
||||
|
||||
std::map<std::string, std::function<void(const std::string& value, TestSpec* spec)>> testSpecTestKeys = {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
storageEngineExcludeType=-1
|
||||
storageEngineExcludeTypes=-1,-2
|
||||
maxTLogVersion=6
|
||||
testTitle=Clogged
|
||||
clearAfterTest=false
|
||||
testName=Cycle
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
storageEngineExcludeType=-1
|
||||
storageEngineExcludeTypes=-1,-2
|
||||
maxTLogVersion=6
|
||||
testTitle=Clogged
|
||||
runSetup=false
|
||||
testName=Cycle
|
||||
|
|
Loading…
Reference in New Issue