Add backup_type database configuration option

Update simulation tests to randomly set backup types to be one of: old backup
(default), new backup (tagged), or both (default+tagged).
This commit is contained in:
Jingyu Zhou 2020-01-27 16:55:35 -08:00
parent 38aa1903fd
commit 297f22726c
4 changed files with 12 additions and 3 deletions

View File

@ -1036,6 +1036,7 @@ struct BackupType {
}
static ErrorOr<BackupType> FromStringRef(StringRef s) {
if (s == LiteralStringRef("0")) return DEFAULT;
if (s == LiteralStringRef("1")) return TAGGED;
if (s == LiteralStringRef("2")) return DEFAULT_AND_TAGGED;
return default_error_or();

View File

@ -590,7 +590,8 @@ const KeyRef JSONSchemas::statusSchema = LiteralStringRef(R"statusSchema(
"auto_proxies":3,
"auto_resolvers":1,
"auto_logs":3,
"proxies":5
"proxies":5,
"backup_type":2
},
"data":{
"least_operating_space_bytes_log_server":0,

View File

@ -883,6 +883,8 @@ void SimulationConfig::generateNormalConfig(int minimumReplication, int minimumR
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));
int backupType = deterministicRandom()->randomInt(BackupType::DEFAULT, BackupType::END);
set_config(format("backup_type:=%d", backupType));
} else {
if (deterministicRandom()->random01() < 0.7)
set_config(format("log_version:=%d", TLogVersion::MAX_SUPPORTED));

View File

@ -34,6 +34,7 @@ static const char* logTypes[] = {
"log_version:=2", "log_version:=3", "log_version:=4"
};
static const char* redundancies[] = { "single", "double", "triple" };
static const char* backupTypes[] = { "backup_type:=0", "backup_type:=1", "backup_type:=2" };
std::string generateRegions() {
std::string result;
@ -271,7 +272,7 @@ struct ConfigureDatabaseWorkload : TestWorkload {
if(g_simulator.speedUpSimulation) {
return Void();
}
state int randomChoice = deterministicRandom()->randomInt(0, 7);
state int randomChoice = deterministicRandom()->randomInt(0, 8);
if( randomChoice == 0 ) {
wait( success(
runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) -> Future<Optional<Value>>
@ -323,7 +324,11 @@ struct ConfigureDatabaseWorkload : TestWorkload {
// Some configurations will be invalid, and that's fine.
wait(success( IssueConfigurationChange( cx, logTypes[deterministicRandom()->randomInt( 0, sizeof(logTypes)/sizeof(logTypes[0]))], false ) ));
}
else {
else if (randomChoice == 7) {
wait(success(IssueConfigurationChange(
cx, backupTypes[deterministicRandom()->randomInt(0, sizeof(backupTypes) / sizeof(backupTypes[0]))],
false)));
} else {
ASSERT(false);
}
}