Add a TLogVersion::V4

And refactor some code to make adding more TLogVersions easier.
This commit is contained in:
Alex Miller 2019-07-08 22:22:45 -07:00
parent 5041ff38b1
commit d2ef84a8f9
4 changed files with 37 additions and 22 deletions

View File

@ -601,8 +601,9 @@ struct TLogVersion {
// V1 = 1, // 4.6 is dispatched to via 6.0
V2 = 2, // 6.0
V3 = 3, // 6.1
V4 = 4, // 6.2
MIN_SUPPORTED = V2,
MAX_SUPPORTED = V3,
MAX_SUPPORTED = V4,
MIN_RECRUITABLE = V2,
DEFAULT = V3,
} version;
@ -624,6 +625,7 @@ struct TLogVersion {
static ErrorOr<TLogVersion> FromStringRef( StringRef s ) {
if (s == LiteralStringRef("2")) return V2;
if (s == LiteralStringRef("3")) return V3;
if (s == LiteralStringRef("4")) return V4;
return default_error_or();
}
};

View File

@ -850,23 +850,15 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
}
if (deterministicRandom()->random01() < 0.5) {
if (deterministicRandom()->random01() < 0.5) {
set_config("log_spill:=1"); // VALUE
}
int logVersion = deterministicRandom()->randomInt( 0, 3 );
switch (logVersion) {
case 0:
break;
case 1:
set_config("log_version:=2"); // 6.0
break;
case 2:
set_config("log_version:=3"); // 6.1
break;
}
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 );
set_config(format("log_version:=%d", logVersion));
} else {
set_config("log_version:=3"); // 6.1
set_config("log_spill:=2"); // REFERENCE
if (deterministicRandom()->random01() < 0.7)
set_config(format("log_version:=%d", TLogVersion::MAX_SUPPORTED));
if (deterministicRandom()->random01() < 0.5)
set_config(format("log_spill:=%d", TLogSpillType::DEFAULT));
}
if(generateFearless || (datacenters == 2 && deterministicRandom()->random01() < 0.5)) {

View File

@ -278,10 +278,27 @@ struct TLogOptions {
TLogFn tLogFnForOptions( TLogOptions options ) {
auto tLogFn = tLog;
if ( options.version == TLogVersion::V2 && options.spillType == TLogSpillType::VALUE) return oldTLog_6_0::tLog;
if ( options.version == TLogVersion::V2 && options.spillType == TLogSpillType::REFERENCE) ASSERT(false);
if ( options.version == TLogVersion::V3 && options.spillType == TLogSpillType::VALUE ) return oldTLog_6_0::tLog;
if ( options.version == TLogVersion::V3 && options.spillType == TLogSpillType::REFERENCE) return tLog;
if ( options.spillType == TLogSpillType::VALUE ) {
switch (options.version) {
case TLogVersion::V2:
case TLogVersion::V3:
case TLogVersion::V4:
return oldTLog_6_0::tLog;
default:
ASSERT(false);
}
}
if ( options.spillType == TLogSpillType::REFERENCE ) {
switch (options.version) {
case TLogVersion::V2:
ASSERT(false);
case TLogVersion::V3:
case TLogVersion::V4:
return tLog;
default:
ASSERT(false);
}
}
ASSERT(false);
return tLogFn;
}

View File

@ -27,7 +27,11 @@
// "ssd" is an alias to the preferred type which skews the random distribution toward it but that's okay.
static const char* storeTypes[] = { "ssd", "ssd-1", "ssd-2", "memory", "memory-1", "memory-2" };
static const char* logTypes[] = { "log_engine:=1", "log_engine:=2", "log_spill:=1", "log_spill:=2", "log_version:=2", "log_version:=3" };
static const char* logTypes[] = {
"log_engine:=1", "log_engine:=2",
"log_spill:=1", "log_spill:=2",
"log_version:=2", "log_version:=3", "log_version:=4"
};
static const char* redundancies[] = { "single", "double", "triple" };
std::string generateRegions() {