From 8d1e97b329cda898e38953aa24bf97e9318915b2 Mon Sep 17 00:00:00 2001 From: negoyal Date: Mon, 4 Oct 2021 22:43:48 -0700 Subject: [PATCH] Minor changes. --- fdbrpc/AsyncFileChaos.actor.h | 3 ++- fdbserver/workloads/ClearSingleRange.actor.cpp | 15 ++++++++++++--- .../workloads/DiskFailureInjection.actor.cpp | 4 ++-- fdbserver/workloads/Mako.actor.cpp | 2 +- fdbserver/workloads/TargetedKill.actor.cpp | 1 + 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/fdbrpc/AsyncFileChaos.actor.h b/fdbrpc/AsyncFileChaos.actor.h index 3678af63b6..affd48da06 100644 --- a/fdbrpc/AsyncFileChaos.actor.h +++ b/fdbrpc/AsyncFileChaos.actor.h @@ -85,7 +85,8 @@ public: if (enabled && res) { auto bitFlipPercentage = static_cast(res)->getBitFlipPercentage(); if (bitFlipPercentage > 0.0) { - if (deterministicRandom()->random01() < bitFlipPercentage) { + auto bitFlipProb = bitFlipPercentage/100; + if (deterministicRandom()->random01() < bitFlipProb) { pdata = (char*)arena.allocate4kAlignedBuffer(length); memcpy(pdata, data, length); // flip a random bit in the copied buffer diff --git a/fdbserver/workloads/ClearSingleRange.actor.cpp b/fdbserver/workloads/ClearSingleRange.actor.cpp index f8f48be929..5e21e35254 100644 --- a/fdbserver/workloads/ClearSingleRange.actor.cpp +++ b/fdbserver/workloads/ClearSingleRange.actor.cpp @@ -47,9 +47,18 @@ struct ClearSingleRange : TestWorkload { ACTOR static Future fdbClientClearRange(Database db, ClearSingleRange* self) { state Transaction tr(db); - TraceEvent("ClearSingleRangeWaiting").detail("StartDelay", self->startDelay); - wait(delay(self->startDelay)); - tr.clear(KeyRangeRef(self->begin, self->end)); + try { + TraceEvent("ClearSingleRange"). + detail("Begin", printable(self->begin)). + detail("End", printable(self->end)).detail("StartDelay", self->startDelay); + tr.setOption(FDBTransactionOptions::NEXT_WRITE_NO_WRITE_CONFLICT_RANGE); + wait(delay(self->startDelay)); + tr.clear(KeyRangeRef(self->begin, self->end)); + wait(tr.commit()); + } catch (Error& e) { + TraceEvent("ClearRangeError").error(e); + wait(tr.onError(e)); + } return Void(); } }; diff --git a/fdbserver/workloads/DiskFailureInjection.actor.cpp b/fdbserver/workloads/DiskFailureInjection.actor.cpp index b9079b39eb..359e0e19c3 100644 --- a/fdbserver/workloads/DiskFailureInjection.actor.cpp +++ b/fdbserver/workloads/DiskFailureInjection.actor.cpp @@ -225,7 +225,7 @@ struct DiskFailureInjectionWorkload : TestWorkload { if (self->throttleDisk) { int diskDelays = chaosMetrics->second.getInt("DiskDelays"); if (diskDelays > 0) { - foundChaosMetrics++; + foundChaosMetrics += diskDelays; } } @@ -233,7 +233,7 @@ struct DiskFailureInjectionWorkload : TestWorkload { if (self->corruptFile) { int bitFlips = chaosMetrics->second.getInt("BitFlips"); if (bitFlips > 0) { - foundChaosMetrics++; + foundChaosMetrics += bitFlips; } } } diff --git a/fdbserver/workloads/Mako.actor.cpp b/fdbserver/workloads/Mako.actor.cpp index 9611f057bb..67720c2249 100644 --- a/fdbserver/workloads/Mako.actor.cpp +++ b/fdbserver/workloads/Mako.actor.cpp @@ -56,7 +56,7 @@ struct MakoWorkload : TestWorkload { commits("Commits"), totalOps("Operations") { // init parameters from test file // Number of rows populated - rowCount = getOption(options, LiteralStringRef("rows"), 10000); + rowCount = getOption(options, LiteralStringRef("rows"), (uint64_t )10000); // Test duration in seconds testDuration = getOption(options, LiteralStringRef("testDuration"), 30.0); warmingDelay = getOption(options, LiteralStringRef("warmingDelay"), 0.0); diff --git a/fdbserver/workloads/TargetedKill.actor.cpp b/fdbserver/workloads/TargetedKill.actor.cpp index 1c40cd47b6..b77b97a18c 100644 --- a/fdbserver/workloads/TargetedKill.actor.cpp +++ b/fdbserver/workloads/TargetedKill.actor.cpp @@ -78,6 +78,7 @@ struct TargetedKillWorkload : TestWorkload { workers[i].processClass != ProcessClass::TesterClass)) { TraceEvent("WorkerKill").detail("TargetedMachine", address).detail("Worker", workers[i].interf.id()); workers[i].interf.clientInterface.reboot.send(rbReq); + killed++; } }