| 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. |
nothing calls this directly
no test coverage detected