Merge pull request #4653 from sfc-gh-satherton/correctness-fix

Correctness fix:  Prevent writes from being too slow in simulation
This commit is contained in:
Evan Tschannen 2021-04-16 21:57:03 -07:00 committed by GitHub
commit a43897c74c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -197,7 +197,7 @@ private:
this->file = file;
this->filename = filename;
this->diskParameters = diskParameters;
maxWriteDelay = 5.0;
maxWriteDelay = FLOW_KNOBS->NON_DURABLE_MAX_WRITE_DELAY;
hasBeenSynced = false;
killMode = (KillMode)deterministicRandom()->randomInt(1, 3);
@ -434,7 +434,8 @@ private:
state TaskPriority currentTaskID = g_network->getCurrentTask();
wait(g_simulator.onMachine(currentProcess));
state double delayDuration = deterministicRandom()->random01() * self->maxWriteDelay;
state double delayDuration =
g_simulator.speedUpSimulation ? 0.0001 : (deterministicRandom()->random01() * self->maxWriteDelay);
state Standalone<StringRef> dataCopy(StringRef((uint8_t*)data, length));
state Future<bool> startSyncFuture = self->startSyncPromise.getFuture();
@ -606,7 +607,8 @@ private:
state TaskPriority currentTaskID = g_network->getCurrentTask();
wait(g_simulator.onMachine(currentProcess));
state double delayDuration = deterministicRandom()->random01() * self->maxWriteDelay;
state double delayDuration =
g_simulator.speedUpSimulation ? 0.0001 : (deterministicRandom()->random01() * self->maxWriteDelay);
state Future<bool> startSyncFuture = self->startSyncPromise.getFuture();
try {

View File

@ -135,6 +135,7 @@ void FlowKnobs::initialize(bool randomize, bool isSimulated) {
init( DISABLE_POSIX_KERNEL_AIO, 0 );
//AsyncFileNonDurable
init( NON_DURABLE_MAX_WRITE_DELAY, 5.0 );
init( MAX_PRIOR_MODIFICATION_DELAY, 1.0 ); if( randomize && BUGGIFY ) MAX_PRIOR_MODIFICATION_DELAY = 10.0;
//GenericActors

View File

@ -149,6 +149,7 @@ public:
int DISABLE_POSIX_KERNEL_AIO;
// AsyncFileNonDurable
double NON_DURABLE_MAX_WRITE_DELAY;
double MAX_PRIOR_MODIFICATION_DELAY;
// GenericActors