1
0
mirror of https://github.com/apple/foundationdb.git synced 2025-05-21 22:33:17 +08:00

Clean up clientFailures periodically

This commit is contained in:
Lukas Joswiak 2021-08-20 15:12:16 -07:00
parent d004703cc8
commit adc1025fa1
2 changed files with 12 additions and 3 deletions

@ -204,7 +204,6 @@ class ConfigBroadcasterImpl {
wait(watcher); wait(watcher);
TraceEvent(SevDebug, "ConfigBroadcastClientDied", self->id).detail("ClientID", clientUID); TraceEvent(SevDebug, "ConfigBroadcastClientDied", self->id).detail("ClientID", clientUID);
self->clients.erase(clientUID); self->clients.erase(clientUID);
// TODO: Erase clientUID from clientFailures at some point
return Void(); return Void();
} }
@ -225,6 +224,18 @@ class ConfigBroadcasterImpl {
return Void(); return Void();
} }
// Clean up clientFailures futures. The values in this map should only
// be used for testing, and cleaning them up here ensures tests still
// have enough time to read the future while making sure the map
// doesn't grow unbounded.
for (auto it = impl->clientFailures.begin(); it != impl->clientFailures.end();) {
if (it->second.isReady()) {
it = impl->clientFailures.erase(it);
} else {
++it;
}
}
TraceEvent(SevDebug, "ConfigBroadcasterRegisteringWorker", impl->id) TraceEvent(SevDebug, "ConfigBroadcasterRegisteringWorker", impl->id)
.detail("ClientID", broadcastInterface.id()) .detail("ClientID", broadcastInterface.id())
.detail("MostRecentVersion", impl->mostRecentVersion) .detail("MostRecentVersion", impl->mostRecentVersion)

@ -910,5 +910,3 @@ TEST_CASE("/fdbserver/ConfigDB/Transaction/BadRangeRead") {
} }
return Void(); return Void();
} }
// TODO: Test worker failure detection on ConfigBroadcaster