MCPcopy Create free account
hub / github.com/apple/foundationdb / simulateFailure

Method simulateFailure

fdbserver/workloads/Rollback.actor.cpp:59–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57 void getMetrics(std::vector<PerfMetric>& m) override {}
58
59 ACTOR Future<Void> simulateFailure(Database cx, RollbackWorkload* self) {
60 state ServerDBInfo system = self->dbInfo->get();
61 auto tlogs = system.logSystemConfig.allPresentLogs();
62
63 if (tlogs.empty() || system.client.commitProxies.empty()) {
64 TraceEvent(SevInfo, "UnableToTriggerRollback").detail("Reason", "No tlogs in System Map");
65 return Void();
66 }
67
68 state CommitProxyInterface proxy = deterministicRandom()->randomChoice(system.client.commitProxies);
69
70 int utIndex = deterministicRandom()->randomInt(0, tlogs.size());
71 state NetworkAddress uncloggedTLog = tlogs[utIndex].address();
72
73 for (int t = 0; t < tlogs.size(); t++)
74 if (t != utIndex)
75 if (tlogs[t].address().ip == proxy.address().ip) {
76 TraceEvent(SevInfo, "UnableToTriggerRollback").detail("Reason", "proxy-clogged tLog shared IPs");
77 return Void();
78 }
79
80 TraceEvent("AttemptingToTriggerRollback")
81 .detail("CommitProxy", proxy.address())
82 .detail("UncloggedTLog", uncloggedTLog);
83
84 for (int t = 0; t < tlogs.size(); t++) {
85 if (t != utIndex) {
86 g_simulator.clogPair(proxy.address().ip, tlogs[t].address().ip, self->clogDuration);
87 // g_simulator.clogInterface( g_simulator.getProcess( system.tlogs[t].commit.getEndpoint() ),
88 // self->clogDuration, ClogAll );
89 }
90 }
91
92 // While the clogged machines are still clogged...
93 wait(delay(self->clogDuration / 3));
94 system = self->dbInfo->get();
95
96 // Kill the proxy and clog the unclogged tlog
97 if (self->enableFailures) {
98 g_simulator.killProcess(g_simulator.getProcessByAddress(proxy.address()), ISimulator::KillInstantly);
99 g_simulator.clogInterface(uncloggedTLog.ip, self->clogDuration, ClogAll);
100 } else {
101 g_simulator.clogInterface(proxy.address().ip, self->clogDuration, ClogAll);
102 g_simulator.clogInterface(uncloggedTLog.ip, self->clogDuration, ClogAll);
103 }
104 return Void();
105 }
106
107 ACTOR Future<Void> rollbackFailureWorker(Database cx, RollbackWorkload* self, double delay) {
108 state PromiseStream<Void> events;

Callers 2

rollbackFailureWorkerMethod · 0.95
RollbackWorkloadClass · 0.95

Calls 12

TraceEventClass · 0.85
deterministicRandomFunction · 0.85
delayFunction · 0.85
allPresentLogsMethod · 0.80
detailMethod · 0.80
randomChoiceMethod · 0.80
getMethod · 0.65
VoidClass · 0.50
emptyMethod · 0.45
randomIntMethod · 0.45
sizeMethod · 0.45
addressMethod · 0.45

Tested by

no test coverage detected