make spawnProcess predictable in the simulator

This commit is contained in:
sramamoorthy 2019-04-24 12:45:28 -07:00 committed by Alex Miller
parent 4083af0b01
commit dcd2d96751
3 changed files with 10 additions and 3 deletions

View File

@ -93,7 +93,14 @@ ACTOR Future<int> spawnProcess(std::string binPath, std::vector<std::string> par
state double runTime = 0;
state boost::process::child c(binPath, boost::process::args(paramList),
boost::process::std_err > boost::process::null);
if (!isSync) {
// for async calls in simulator, always delay by a fixed time, otherwise
// the predictability of the simulator breaks
if (!isSync && g_network->isSimulated()) {
wait(delay(g_random->random01()));
}
if (!isSync && !g_network->isSimulated()) {
while (c.running() && runTime <= maxWaitTime) {
wait(delay(0.1));
runTime += 0.1;

View File

@ -24,8 +24,8 @@
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/Notified.h"
#include "fdbclient/KeyRangeMap.h"
#include "fdbclient/SystemData.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/SystemData.h"
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbserver/TLogInterface.h"
#include "fdbserver/Knobs.h"

View File

@ -24,8 +24,8 @@
#include "fdbclient/NativeAPI.actor.h"
#include "fdbclient/Notified.h"
#include "fdbclient/KeyRangeMap.h"
#include "fdbclient/SystemData.h"
#include "fdbclient/RunTransaction.actor.h"
#include "fdbclient/SystemData.h"
#include "fdbserver/WorkerInterface.actor.h"
#include "fdbserver/TLogInterface.h"
#include "fdbserver/Knobs.h"