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

Method LogRouterData

fdbserver/LogRouter.actor.cpp:136–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134 }
135
136 LogRouterData(UID dbgid, const InitializeLogRouterRequest& req)
137 : dbgid(dbgid), logSystem(new AsyncVar<Reference<ILogSystem>>()), version(req.startVersion - 1), minPopped(0),
138 startVersion(req.startVersion), minKnownCommittedVersion(0), poppedVersion(0), routerTag(req.routerTag),
139 allowPops(false), foundEpochEnd(false), generation(req.recoveryCount),
140 peekLatencyDist(Histogram::getHistogram(LiteralStringRef("LogRouter"),
141 LiteralStringRef("PeekTLogLatency"),
142 Histogram::Unit::microseconds)),
143 cc("LogRouter", dbgid.toString()), getMoreCount("GetMoreCount", cc),
144 getMoreBlockedCount("GetMoreBlockedCount", cc) {
145 // setup just enough of a logSet to be able to call getPushLocations
146 logSet.logServers.resize(req.tLogLocalities.size());
147 logSet.tLogPolicy = req.tLogPolicy;
148 logSet.locality = req.locality;
149 logSet.updateLocalitySet(req.tLogLocalities);
150
151 for (int i = 0; i < req.tLogLocalities.size(); i++) {
152 Tag tag(tagLocalityRemoteLog, i);
153 auto tagData = getTagData(tag);
154 if (!tagData) {
155 tagData = createTagData(tag, 0, 0);
156 }
157 }
158
159 eventCacheHolder = makeReference<EventCacheHolder>(dbgid.shortString() + ".PeekLocation");
160
161 // FetchedVersions: How many version of mutations buffered at LR and have not been popped by remote tLogs
162 specialCounter(cc, "Version", [this]() { return this->version.get(); });
163 specialCounter(cc, "MinPopped", [this]() { return this->minPopped.get(); });
164 // TODO: Add minPopped locality and minPoppedId, similar as tLog Metrics
165 specialCounter(cc, "FetchedVersions", [this]() {
166 return std::max<Version>(0,
167 std::min<Version>(SERVER_KNOBS->MAX_READ_TRANSACTION_LIFE_VERSIONS,
168 this->version.get() - this->minPopped.get()));
169 });
170 specialCounter(cc, "MinKnownCommittedVersion", [this]() { return this->minKnownCommittedVersion; });
171 specialCounter(cc, "PoppedVersion", [this]() { return this->poppedVersion; });
172 specialCounter(cc, "FoundEpochEnd", [this]() { return this->foundEpochEnd; });
173 specialCounter(cc, "WaitForVersionMS", [this]() {
174 double val = this->waitForVersionTime;
175 this->waitForVersionTime = 0;
176 return int64_t(1000 * val);
177 });
178 specialCounter(cc, "WaitForVersionMaxMS", [this]() {
179 double val = this->maxWaitForVersionTime;
180 this->maxWaitForVersionTime = 0;
181 return int64_t(1000 * val);
182 });
183 specialCounter(cc, "GetMoreMS", [this]() {
184 double val = this->getMoreTime;
185 this->getMoreTime = 0;
186 return int64_t(1000 * val);
187 });
188 specialCounter(cc, "GetMoreMaxMS", [this]() {
189 double val = this->maxGetMoreTime;
190 this->maxGetMoreTime = 0;
191 return int64_t(1000 * val);
192 });
193 specialCounter(cc, "Generation", [this]() { return this->generation; });

Callers

nothing calls this directly

Calls 8

specialCounterFunction · 0.85
updateLocalitySetMethod · 0.80
shortStringMethod · 0.80
detailMethod · 0.80
getMethod · 0.65
toStringMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected