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

Function readMultiPage

fdbserver/VersionedBTree.actor.cpp:3159–3207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3157 }
3158
3159 Future<Reference<ArenaPage>> readMultiPage(PagerEventReasons reason,
3160 unsigned int level,
3161 VectorRef<PhysicalPageID> pageIDs,
3162 int priority,
3163 bool cacheable,
3164 bool noHit) override {
3165 // Use cached page if present, without triggering a cache hit.
3166 // Otherwise, read the page and return it but don't add it to the cache
3167 debug_printf("DWALPager(%s) op=read %s reason=%s noHit=%d\n",
3168 filename.c_str(),
3169 toString(pageIDs).c_str(),
3170 PagerEventReasonsStrings[(int)reason],
3171 noHit);
3172 auto& eventReasons = g_redwoodMetrics.level(level).metrics.events;
3173 eventReasons.addEventReason(PagerEvents::CacheLookup, reason);
3174 if (!cacheable) {
3175 debug_printf("DWALPager(%s) op=readUncached %s\n", filename.c_str(), toString(pageIDs).c_str());
3176 PageCacheEntry* pCacheEntry = pageCache.getIfExists(pageIDs.front());
3177 if (pCacheEntry != nullptr) {
3178 ++g_redwoodMetrics.metric.pagerProbeHit;
3179 debug_printf("DWALPager(%s) op=readUncachedHit %s\n", filename.c_str(), toString(pageIDs).c_str());
3180 return pCacheEntry->readFuture;
3181 }
3182 ++g_redwoodMetrics.metric.pagerProbeMiss;
3183 debug_printf("DWALPager(%s) op=readUncachedMiss %s\n", filename.c_str(), toString(pageIDs).c_str());
3184 return forwardError(readPhysicalMultiPage(this, pageIDs, priority), errorPromise);
3185 }
3186
3187 PageCacheEntry& cacheEntry = pageCache.get(pageIDs.front(), pageIDs.size() * physicalPageSize, noHit);
3188 debug_printf("DWALPager(%s) op=read %s cached=%d reading=%d writing=%d noHit=%d\n",
3189 filename.c_str(),
3190 toString(pageIDs).c_str(),
3191 cacheEntry.initialized(),
3192 cacheEntry.initialized() && cacheEntry.reading(),
3193 cacheEntry.initialized() && cacheEntry.writing(),
3194 noHit);
3195 if (!cacheEntry.initialized()) {
3196 debug_printf("DWALPager(%s) issuing actual read of %s\n", filename.c_str(), toString(pageIDs).c_str());
3197 cacheEntry.readFuture = forwardError(readPhysicalMultiPage(this, pageIDs, priority), errorPromise);
3198 cacheEntry.writeFuture = Void();
3199
3200 ++g_redwoodMetrics.metric.pagerCacheMiss;
3201 eventReasons.addEventReason(PagerEvents::CacheMiss, reason);
3202 } else {
3203 ++g_redwoodMetrics.metric.pagerCacheHit;
3204 eventReasons.addEventReason(PagerEvents::CacheHit, reason);
3205 }
3206 return cacheEntry.readFuture;
3207 }
3208
3209 PhysicalPageID getPhysicalPageID(LogicalPageID pageID, Version v) {
3210 auto i = remappedPages.find(pageID);

Callers

nothing calls this directly

Calls 13

readPhysicalMultiPageFunction · 0.85
levelMethod · 0.80
addEventReasonMethod · 0.80
getIfExistsMethod · 0.80
frontMethod · 0.80
readingMethod · 0.80
writingMethod · 0.80
toStringFunction · 0.70
getMethod · 0.65
VoidClass · 0.50
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected