1
0
mirror of https://github.com/apple/foundationdb.git synced 2025-05-28 02:48:09 +08:00

pair configureDatabase tests with cycle tests to ensure that changing the configuration does not corrupt data

This commit is contained in:
Evan Tschannen 2019-09-04 18:41:22 -07:00
parent 24aad14f06
commit 5bf8d61d81
4 changed files with 19 additions and 44 deletions

@ -271,54 +271,11 @@ struct ConfigureDatabaseWorkload : TestWorkload {
return Void();
}
state int randomChoice = deterministicRandom()->randomInt(0, 7);
if( randomChoice == 0 ) {
if( randomChoice < 3 ) {
double waitDuration = 3.0 * deterministicRandom()->random01();
//TraceEvent("ConfigureTestWaitAfter").detail("WaitDuration",waitDuration);
wait( delay( waitDuration ) );
}
else if( randomChoice == 1 ) {
tr = Transaction( cx );
loop {
try {
tr.clear( normalKeys );
wait( tr.commit() );
break;
} catch( Error &e ) {
wait( tr.onError(e) );
}
}
}
else if( randomChoice == 2 ) {
state double loadDuration = deterministicRandom()->random01() * 10.0;
state double startTime = now();
state int amtLoaded = 0;
loop {
if( now() - startTime > loadDuration )
break;
loop {
tr = Transaction( cx );
try {
for( i = 0; i < 10; i++ ) {
state Key randomKey( "ConfigureTest" + deterministicRandom()->randomUniqueID().toString() );
Optional<Value> val = wait( tr.get( randomKey ) );
uint64_t nextVal = val.present() ? valueToUInt64( val.get() ) + 1 : 0;
tr.set( randomKey, format( "%016llx", nextVal ) );
}
wait( tr.commit() );
amtLoaded += 10;
break;
}
catch( Error& e ) {
wait( tr.onError( e ) );
++self->retries;
}
}
wait( delay( 0.1 ) );
}
//TraceEvent("ConfigureTestLoadData").detail("LoadTime", now() - startTime).detail("AmountLoaded",amtLoaded);
}
else if( randomChoice == 3 ) {
//TraceEvent("ConfigureTestConfigureBegin").detail("NewConfig", newConfig);
int maxRedundancies = sizeof(redundancies)/sizeof(redundancies[0]);

@ -1,7 +1,14 @@
testTitle=CloggedConfigureDatabaseTest
clearAfterTest=false
testName=ConfigureDatabase
testDuration=30.0
clearAfterTest=false
testName=Cycle
transactionsPerSecond=1250.0
testDuration=30.0
expectedRate=0.005
testName=RandomClogging
testDuration=30.0

@ -3,6 +3,12 @@ testTitle=CloggedConfigureDatabaseTest
testName=ConfigureDatabase
testDuration=300.0
runSetup=false
testName=Cycle
transactionsPerSecond=1250.0
testDuration=30.0
expectedRate=0.005
testName=RandomClogging
testDuration=300.0

@ -2,6 +2,11 @@ testTitle=CloggedConfigureDatabaseTest
testName=ConfigureDatabase
testDuration=300.0
testName=Cycle
transactionsPerSecond=1250.0
testDuration=300.0
expectedRate=0.005
testName=RandomClogging
testDuration=300.0