Fix bugs turned up by _GLIBCXX_DEBUG
Compiling with -D_GLIBCXX_DEBUG enables libstc++ "debug mode", where additional debug information is tracked with iterators and reported if iterators are misused. This turned up two bugs. I threw in removing dead code and avoiding an unnecessary map lookup while I was in the neighborhood.
This commit is contained in:
parent
ca4adb7d93
commit
cb196daefe
|
@ -29,10 +29,12 @@ void HealthMonitor::reportPeerClosed(const NetworkAddress& peerAddress) {
|
|||
}
|
||||
|
||||
void HealthMonitor::purgeOutdatedHistory() {
|
||||
for (auto it : peerClosedHistory) {
|
||||
if (it.first < now() - FLOW_KNOBS->HEALTH_MONITOR_CLIENT_REQUEST_INTERVAL_SECS) {
|
||||
peerClosedNum[it.second] -= 1;
|
||||
ASSERT(peerClosedNum[it.second] >= 0);
|
||||
for (auto it = peerClosedHistory.begin(); it != peerClosedHistory.end();) {
|
||||
if (it->first < now() - FLOW_KNOBS->HEALTH_MONITOR_CLIENT_REQUEST_INTERVAL_SECS) {
|
||||
auto& count = peerClosedNum[it->second];
|
||||
--count;
|
||||
ASSERT(count >= 0);
|
||||
++it; // Increment before pop_front to avoid iterator invalidation
|
||||
peerClosedHistory.pop_front();
|
||||
} else {
|
||||
break;
|
||||
|
|
|
@ -240,7 +240,6 @@ ACTOR Future<vector<vector<UID>>> additionalSources(Standalone<RangeResultRef> s
|
|||
|
||||
std::map<UID, StorageServerInterface> ssiMap;
|
||||
for(int s=0; s<serverListValues.size(); s++) {
|
||||
auto si = decodeServerListValue(serverListValues[s].get());
|
||||
StorageServerInterface ssi = decodeServerListValue(serverListValues[s].get());
|
||||
ssiMap[ssi.id()] = ssi;
|
||||
}
|
||||
|
@ -260,7 +259,7 @@ ACTOR Future<vector<vector<UID>>> additionalSources(Standalone<RangeResultRef> s
|
|||
}
|
||||
|
||||
for(int s=0; s<dest.size(); s++) {
|
||||
if( std::find(src.begin(), src.end(), dest[s]) == dest.end() ) {
|
||||
if (std::find(src.begin(), src.end(), dest[s]) == src.end()) {
|
||||
destInterfs.push_back( ssiMap[dest[s]] );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue