Fix notifyBytes bug: infinite vector item creation. (version 2)

This commit is contained in:
Xiaoxi Wang 2023-05-14 20:49:28 -07:00
parent e0bf36a14e
commit 92f83c7756
3 changed files with 7 additions and 5 deletions

View File

@ -184,7 +184,9 @@ void StorageServerMetrics::notifyBytes(
StorageMetrics notifyMetrics; StorageMetrics notifyMetrics;
notifyMetrics.bytes = bytes; notifyMetrics.bytes = bytes;
for (int i = 0; i < shard.value().size(); i++) { auto size = shard->cvalue().size();
for (int i = 0; i < size; i++) {
// fmt::print("NotifyBytes {} {}\n", shard->value().size(), shard->range().toString());
CODE_PROBE(true, "notifyBytes"); CODE_PROBE(true, "notifyBytes");
shard.value()[i].send(notifyMetrics); shard.value()[i].send(notifyMetrics);
} }

View File

@ -12928,8 +12928,8 @@ ACTOR Future<Void> waitMetrics(StorageServerMetrics* self, WaitMetricsRequest re
state Error error = success(); state Error error = success();
state bool timedout = false; state bool timedout = false;
// state UID metricReqId = deterministicRandom()->randomUniqueID(); state UID metricReqId = deterministicRandom()->randomUniqueID();
DisabledTraceEvent(SevDebug, "WaitMetrics", metricReqId) TraceEvent(SevDebug, "WaitMetrics", metricReqId)
.detail("Keys", req.keys) .detail("Keys", req.keys)
.detail("Metrics", metrics.toString()) .detail("Metrics", metrics.toString())
.detail("ReqMin", req.min.toString()) .detail("ReqMin", req.min.toString())
@ -13000,7 +13000,7 @@ ACTOR Future<Void> waitMetrics(StorageServerMetrics* self, WaitMetricsRequest re
wait(delay(0)); // prevent iterator invalidation of functions sending changes wait(delay(0)); // prevent iterator invalidation of functions sending changes
} }
// fmt::print("PopWaitMetricsMap {}\n", req.keys.toString());
auto rs = self->waitMetricsMap.modify(req.keys); auto rs = self->waitMetricsMap.modify(req.keys);
for (auto i = rs.begin(); i != rs.end(); ++i) { for (auto i = rs.begin(); i != rs.end(); ++i) {
auto& x = i->value(); auto& x = i->value();

View File

@ -44,7 +44,7 @@ public:
MockDDTestWorkload::setup(cx); MockDDTestWorkload::setup(cx);
// populate sharedMgs before run DD // populate sharedMgs before run DD
populateMgs(); populateMgs();
// sharedMgs->addStoragePerProcess(); sharedMgs->addStoragePerProcess();
mock = makeReference<DDMockTxnProcessor>(sharedMgs); mock = makeReference<DDMockTxnProcessor>(sharedMgs);
return Void(); return Void();
} }