Merge pull request #8233 from sfc-gh-mpilman/features/disable-failure-injection-for-workload
All workloads to disable some failures
This commit is contained in:
commit
3b5117ca92
|
@ -75,6 +75,7 @@ struct TestWorkload : NonCopyable, WorkloadContext, ReferenceCounted<TestWorkloa
|
|||
virtual ~TestWorkload(){};
|
||||
virtual Future<Void> initialized() { return Void(); }
|
||||
virtual std::string description() const = 0;
|
||||
virtual void disableFailureInjectionWorkloads(std::set<std::string>& out) const;
|
||||
virtual Future<Void> setup(Database const& cx) { return Void(); }
|
||||
virtual Future<Void> start(Database const& cx) = 0;
|
||||
virtual Future<bool> check(Database const& cx) = 0;
|
||||
|
|
|
@ -384,19 +384,21 @@ void CompoundWorkload::addFailureInjection(WorkloadRequest& work) {
|
|||
if (!work.runFailureWorkloads || !FLOW_KNOBS->ENABLE_SIMULATION_IMPROVEMENTS) {
|
||||
return;
|
||||
}
|
||||
// Some common workloads won't work with failure injection workloads
|
||||
// Some workloads won't work with some failure injection workloads
|
||||
std::set<std::string> disabledWorkloads;
|
||||
for (auto const& w : workloads) {
|
||||
auto desc = w->description();
|
||||
if (desc == "ChangeConfig") {
|
||||
return;
|
||||
} else if (desc == "SaveAndKill") {
|
||||
return;
|
||||
}
|
||||
w->disableFailureInjectionWorkloads(disabledWorkloads);
|
||||
}
|
||||
if (disabledWorkloads.count("all") > 0) {
|
||||
return;
|
||||
}
|
||||
auto& factories = IFailureInjectorFactory::factories();
|
||||
DeterministicRandom random(sharedRandomNumber);
|
||||
for (auto& factory : factories) {
|
||||
auto workload = factory->create(*this);
|
||||
if (disabledWorkloads.count(workload->description()) > 0) {
|
||||
continue;
|
||||
}
|
||||
while (workload->add(random, work, *this)) {
|
||||
failureInjection.push_back(workload);
|
||||
workload = factory->create(*this);
|
||||
|
@ -419,6 +421,8 @@ void CompoundWorkload::getMetrics(std::vector<PerfMetric>&) {
|
|||
ASSERT(false);
|
||||
}
|
||||
|
||||
void TestWorkload::disableFailureInjectionWorkloads(std::set<std::string>& out) const {}
|
||||
|
||||
FailureInjectionWorkload::FailureInjectionWorkload(WorkloadContext const& wcx) : TestWorkload(wcx) {}
|
||||
|
||||
bool FailureInjectionWorkload::add(DeterministicRandom& random,
|
||||
|
|
|
@ -49,6 +49,8 @@ struct ChangeConfigWorkload : TestWorkload {
|
|||
|
||||
std::string description() const override { return "ChangeConfig"; }
|
||||
|
||||
void disableFailureInjectionWorkloads(std::set<std::string>& out) const override { out.insert("all"); }
|
||||
|
||||
Future<Void> start(Database const& cx) override {
|
||||
if (this->clientId != 0)
|
||||
return Void();
|
||||
|
|
|
@ -45,6 +45,7 @@ struct SaveAndKillWorkload : TestWorkload {
|
|||
}
|
||||
|
||||
std::string description() const override { return "SaveAndKillWorkload"; }
|
||||
void disableFailureInjectionWorkloads(std::set<std::string>& out) const override { out.insert("all"); }
|
||||
Future<Void> setup(Database const& cx) override {
|
||||
g_simulator->disableSwapsToAll();
|
||||
return Void();
|
||||
|
|
Loading…
Reference in New Issue