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

Function atomicUpdatePage

fdbserver/VersionedBTree.actor.cpp:2836–2863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2834 }
2835
2836 Future<LogicalPageID> atomicUpdatePage(PagerEventReasons reason,
2837 unsigned int level,
2838 LogicalPageID pageID,
2839 Reference<ArenaPage> data,
2840 Version v) override {
2841 debug_printf("DWALPager(%s) op=writeAtomic %s @%" PRId64 "\n", filename.c_str(), toString(pageID).c_str(), v);
2842 Future<LogicalPageID> f = map(newPageID(), [=](LogicalPageID newPageID) {
2843 updatePage(reason, level, VectorRef<LogicalPageID>(&newPageID, 1), data);
2844 // TODO: Possibly limit size of remap queue since it must be recovered on cold start
2845 RemappedPage r{ v, pageID, newPageID };
2846 remapQueue.pushBack(r);
2847 auto& versionedMap = remappedPages[pageID];
2848
2849 if (SERVER_KNOBS->REDWOOD_EVICT_UPDATED_PAGES) {
2850 // An update page is unlikely to have its old version read again soon, so prioritize its cache eviction
2851 // If the versioned map is empty for this page then the prior version of the page is at stored at the
2852 // PhysicalPageID pageID, otherwise it is the last mapped value in the version-ordered map.
2853 pageCache.prioritizeEviction(versionedMap.empty() ? pageID : versionedMap.rbegin()->second);
2854 }
2855 versionedMap[v] = newPageID;
2856
2857 debug_printf("DWALPager(%s) pushed %s\n", filename.c_str(), RemappedPage(r).toString().c_str());
2858 return pageID;
2859 });
2860
2861 // No need for forwardError here because newPageID() is already wrapped in forwardError
2862 return f;
2863 }
2864
2865 // Free pageID as of version v. This means that once the oldest readable pager snapshot is at version v, pageID is
2866 // not longer in use by any structure so it can be used to write new data.

Callers

nothing calls this directly

Calls 10

mapFunction · 0.85
newPageIDFunction · 0.85
updatePageFunction · 0.85
RemappedPageClass · 0.85
prioritizeEvictionMethod · 0.80
toStringFunction · 0.70
c_strMethod · 0.45
emptyMethod · 0.45
rbeginMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected