g_random -> deterministicRandom()

This commit is contained in:
sramamoorthy 2019-05-28 17:29:05 -07:00 committed by Alex Miller
parent b43c100e57
commit 4bcb590f12
4 changed files with 7 additions and 7 deletions

View File

@ -1478,7 +1478,7 @@ ACTOR Future<Void> mgmtSnapCreate(Database cx, StringRef snapCmd) {
state int retryCount = 0;
loop {
state UID snapUID = g_random->randomUniqueID();
state UID snapUID = deterministicRandom()->randomUniqueID();
try {
wait(snapCreate(cx, snapCmd, snapUID));
printf("Snapshots tagged with UID: %s, check logs for status\n", snapUID.toString().c_str());

View File

@ -3385,7 +3385,7 @@ ACTOR Future<Void> snapCreate(Database inputCx, StringRef snapCmd, UID snapUID)
TraceEvent("SnapCreateAfterSnappingTLogStorage").detail("UID", snapUID);
if (BUGGIFY) {
int32_t toDelay = g_random->randomInt(1, 30);
int32_t toDelay = deterministicRandom()->randomInt(1, 30);
wait(delay(toDelay));
}

View File

@ -97,7 +97,7 @@ ACTOR Future<int> spawnProcess(std::string binPath, std::vector<std::string> par
// 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()));
wait(delay(deterministicRandom()->random01()));
}
if (!isSync && !g_network->isSimulated()) {

View File

@ -180,7 +180,7 @@ public: // workload functions
state vector<int64_t> keys;
for (int i = 0; i < 1000; i++) {
keys.push_back(g_random->randomInt64(0, INT64_MAX - 2));
keys.push_back(deterministicRandom()->randomInt64(0, INT64_MAX - 2));
}
state int retry = 0;
@ -220,7 +220,7 @@ public: // workload functions
wait(self->_create_keys(cx, "snapKey"));
} else if (self->testID == 1) {
// create a snapshot
state double toDelay = fmod(g_random->randomUInt32(), self->maxSnapDelay);
state double toDelay = fmod(deterministicRandom()->randomUInt32(), self->maxSnapDelay);
TraceEvent("ToDelay").detail("Value", toDelay);
ASSERT(toDelay < self->maxSnapDelay);
wait(delay(toDelay));
@ -228,7 +228,7 @@ public: // workload functions
state int retry = 0;
state bool snapFailed = false;
loop {
self->snapUID = g_random->randomUniqueID();
self->snapUID = deterministicRandom()->randomUniqueID();
try {
StringRef snapCmdRef = LiteralStringRef("/bin/snap_create.sh");
Future<Void> status = snapCreate(cx, snapCmdRef, self->snapUID);
@ -339,7 +339,7 @@ public: // workload functions
state bool testedFailure = false;
snapFailed = false;
loop {
self->snapUID = g_random->randomUniqueID();
self->snapUID = deterministicRandom()->randomUniqueID();
try {
StringRef snapCmdRef = LiteralStringRef("/bin/snap_create1.sh");
Future<Void> status = snapCreate(cx, snapCmdRef, self->snapUID);